Threading long operations

Hi
In our J2ME-project we execute long operations like parsing (with KXml) and network activity in a separate worker thread, so the UI keeps "responsive" . Whats about operations like inserting or retrieving small amount of data (until 15 KB) from the recordstore? Is the recordstore perfomant enough or do you recommend to put it's operations in a separate thread too?
Regards
Michael

v$session_longops will keep only the portions it can calculate the timed operations for and that are taking over a certain period of time. These would include full table scans, parallel query, sorting and a few others. The table being queried must also meet certain criteria. A long running session could have multiple parts to it thus some portions of the execution are obtainable through v$session_longops and others or not. You have probably had a couple that were eligible, but the transaction is still taking place but is not eligible for v$session_longops.
Lee

Similar Messages

  • More on Updating Swing Components during long operations...

    After reading thru a few posts here, I've come to the conclusion that what I need is going to be much more difficult than I'd planned. Neverthess i'll try to explain...
    I have a JFrame which contains a simple JLabel and JProgressBar. While I am performing a long network operation, I am making calls to a Thread class (which contains the above components) to update the JFrame indicating the current status. Normally I have no problem with this as the paintImmediately method suffices. However, when I call this long operation from the constructor of a larger, more complex JFrame, the GUI remains unresponsive (despite the plethora of paintImmediately calls that are executed) until the user clicks in the threaded progress box.
    Unfortunately the SwingWorker solution will not work for me as I need to be completely backwards compatible with JDK 1.3 (supporting Mac OSX 10.X). Oddly enough tho, I don;t get these problems when I use the same code in JDK 1.1.8 on Mac OS9.
    Any ideas?
    thanks!

    heh...looks like it was a simple thing afterall :)
    The JDialog (not JFrame) just needed focus.
    heh...is it friday yet? ;)

  • Not Connected Exception during long operation

    Hi all. My program does a very long operation - more than an hour. (import records from excel file). I create a thread, the operation runs there, and put af:poll on the page for changing progress indicator. So it's ok. The trouble is that I get
    Exception in thread "Thread-90" oracle.jbo.NotConnectedException: JBO-25200: Application module is not connected to a database.
         at oracle.jbo.server.DefaultTxnHandlerImpl.handleRollback(DefaultTxnHandlerImpl.java:145)
         at oracle.jbo.server.DBTransactionImpl.doRollback(DBTransactionImpl.java:4872)
         at oracle.jbo.server.DBTransactionImpl.rollback(DBTransactionImpl.java:2429)
         at kz.kklife.insis.modules.policyImport.ImportRunner.run(ImportRunner.java:124)
         at java.lang.Thread.run(Thread.java:619)
    after some time.
    With default jbo.ampool.timetolive (3 600 000) it throws exactly in an hour after starting developer server. So I changed it to 7 200 000. But I got an error on a production server in a random time - because I don't restart it just before importing, of course.
    So, is there any settings for weblogic not to disconnect transactions? (I get a transaction object through getDBTransaction() method of application module) I tried to uncheck "Ignore In-Use Connections" option, but it didn't help.

    Timo Hahn wrote:
    As far as I understand the framework, a transaction begins directly after the last commit or rollback.
    So I assume that the timeout is reset at this point. I would not make sense doing it otherwise. As you already mentioned if you set the timeout to e.g. 2 hours and you get the am instance from the pool after 1:59,59 of initializing the transaction it would be stale before you had any chance to do something with it.Oh. I'll try to commit new transaction just before import, thanks. Need I do something like
      DBTransaction transaction = ADFFacesUtils.getApplicationModuleForDataControl("ImportAppModuleDataControl").getDBTransaction();
      transaction.commit();
      // -- do long running stuffor you mean some another way to commit?
    I would set up a different configuration for this long running transaction (an other AM configuration) where I increase the timeout value to a higher number. Then use an instance from this configuration for the long running stuff only.I use another AM, only for long running stuff. But users can do import simultaneously.

  • Getting screen to repaint() before long operation

    greetings all,
    lately, i've been having a heck of a time getting my JFrame to repaint itself before i start a long operation. In this case, i'm generating a little network traffic. What i'd like to do is be able to update a label on my JFrame so that text is displayed telling the user that a long operation is starting, and then start the operation. However, no attempt i've made so far works. i've tried calling repaint() on multiple objects in a row, i've tried calling repaint() on the same object many times in a row....nothing seems to work.
    Can anyone shed some light on this?
    peace
    ...alan lew

    I find it very disappointing that Java can;t do a simple task like this. I guess i won;t be including this status message into the app i'm writing at this point. That is, unless someone has a definitive answer that doesn;t involve re-writing code for a simple graphics update.
    I, too, had the same problem when I just started out with Swing stuff. I had a status bar that needed updated immediately. I solved it by taking good advantage of Java's multithreading abilities, and ever since then I've never had the problem.
    I don't think it comes down to Java not being able to do it, but rather to a fundamental design flaw in your program. If you would have thought about the status problem BEFORE writing it, then the threading stuff would have been no problem. Please don't take that the wrong way, I'm not knocking your program or competence or anything. I'm just saying, that some times when you've never done a particular thing before, then you don't really think about problems like that because you don't know they exist, and therefore when they come up, you're pretty unprepared and it's a pain in the ass.
    Granted, it seems like paintImmediately() should work, or at least there should be some way to do that. But, the fact remains that paint() doesn't work and it may come down to you having to rewrite part of your code.
    I still have the original code for my program that had the status bar problem. If I can figure anything out, I'll let you know. If you figure out how to do it without threads, post it here.
    Good luck,
    Jason

  • HT1420 old computer no longer operable, how do I get the contents of m iPod onto new compter

    I have an older iPod, and the computer I had it associated with is no longer operable at all. How do I get the music on my iPod onto my new computer?

    follow the steps given here...
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • Long operations session killing

    hi
    i want to remove a particular session which one is running a long query.ie.some user a running a query which one is taking too much time to run.how to kill such session??
    regards
    Edited by: you on May 19, 2010 6:02 AM

    To find SQLs running for more than 5 Seconds:
    col username for a30
    col machine for a30
    select s.sid, a.sql_text, s.username, s.machine
         from v$sqltext a,
         v$session s
         where s.sql_address = a.address
         and s.sid in (select sid
    from v$session
    where LAST_CALL_ET > 5
    and status = 'ACTIVE'
    and username = 'USERNAME' )
    order by s.sid, a.piece;
    check for long operations :
    SET LINES 150
    COLUMN sid FORMAT 9999
    COLUMN serial# FORMAT 9999999
    COLUMN username FORMAT A30
    COLUMN machine FORMAT A30
    COLUMN progress_pct FORMAT 99999999.00
    COLUMN elapsed FORMAT A10
    COLUMN remaining FORMAT A10
    SELECT s.sid,
    s.serial#,
    s.username,
    s.machine,
    ROUND(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,
    ROUND(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) remaining,
    ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
    FROM v$session s,
    v$session_longops sl
    WHERE s.sid = sl.sid
    AND s.serial# = sl.serial#
    AND sl.time_remaining > 0;
    the below query will tell on which object lock has been acquired , if you know the object name on which long operation is running . then after getting sid you can kill it
    select session_id "sid",SERIAL# "Serial",
    substr(object_name,1,20) "Object",
    substr(os_user_name,1,10) "Terminal",
    substr(oracle_username,1,10) "Locker",
    nvl(lockwait,'active') "Wait",
    decode(locked_mode,
    2, 'row share',
    3, 'row exclusive',
    4, 'share',
    5, 'share row exclusive',
    6, 'exclusive', 'unknown') "Lockmode",
    OBJECT_TYPE "Type"
    FROM
    SYS.V_$LOCKED_OBJECT A,
    SYS.ALL_OBJECTS B,
    SYS.V_$SESSION c
    WHERE
    A.OBJECT_ID = B.OBJECT_ID AND
    C.SID = A.SESSION_ID
    ORDER BY 1 ASC, 5 Desc
    Edited by: PrafullaNath on May 19, 2010 3:15 PM
    Edited by: PrafullaNath on May 19, 2010 3:16 PM
    Edited by: PrafullaNath on May 19, 2010 3:17 PM

  • Hyper-V Vswitch erro Microsoft Network Adapter Multiplexor Driver) is no longer operational. Eventid 24/22

    Hello
    Yesterday I got this error and I lost the connectivity with my hyper-v and  all of the VMs(60). I Solved it disabling and reenabling the nics , team and vSwitch.
    I have 4 NICS LACP Dynamic
    First error in the event viewer:
    Event id:16949
    Member Nic {ffb08f0f-1111-1111-89b8-689ce5cba3da} Disconnected.
    Then:
    Event id:22
    Media disconnected on NIC /DEVICE/{5D11FA06-1111-4851-1111-25BE3A349F7A} (Friendly Name: Microsoft Network Adapter Multiplexor Driver).
    And now the problem:
    Event id:24
    NIC /DEVICE/{5D11FA06-1111-4851-1111-25BE3A349F7A} (Friendly Name: Microsoft Network Adapter Multiplexor Driver) is no longer operational.
    Is this normal? If one member of the team fails all the team in not longer operantional?
    Thank you
    Regards

    This is not normal, this is usually cause by driver issues or Windows bugs.
    Have you installe dall Windows latest updates ?
    Are your NIC  firmware and drivers up to date ?
    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

  • Long Operation - OEM

    I ran a query on a table with 2 million records. When i looked in OEM the session in which the query is running is on Long operation. Selected the Long Operations tab, in which i can see three sections Active Operations, Past Operations and Details.
    My Question is in Detail section the progress bar starts with 0 and ends with a Calculated number (say 2442013). What is the Logic/calculation that oracle uses to arrive at this number (Blocks). My advance thanks for your responses

    When you run the query, it is optimizer who check optimal path to access data, it also know how many block need to scan.
    Same info you will get from v$session_longops.
    SELECT s.sid,s.serial#,s.machine,
    sl.elapsed_seconds, sl.time_remaining,
    ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
    FROM v$session s, v$session_longops sl
    WHERE s.serial# = sl.serial# and s.sid = sl.sid
    Virag

  • Long Operation

    Does anyone know what the following SQL statement is doing?
    SELECT ARGUMENT,OVERLOAD#,POSITION# POSITION,TYPE# TYPE,
    NVL(DEFAULT#,0) DEFAULT#,NVL(IN_OUT,0) IN_OUT,NVL(LEVEL#,0)
    LEVEL#,NVL(LENGTH,0) LENGTH,NVL(PRECISION#,0)
    PRECISION,NVL(SCALE,0) SCALE,NVL(RADIX,0) RADIX
    FROM ARGUMENT$ WHERE OBJ# = :b1 AND
    PROCEDURE$ = :b2 ORDER BY OBJ#,PROCEDURE$,OVERLOAD#,SEQUENCE#
    I see this when viewing the SQL tab of DBA Studio for a session involved a 'long operation' (little clock icon).
    I need to find the statement causing this operation.
    Unfortunately this is a 3rd party package written VB with 1000's of imbeded SQL statements in it.

    When you run the query, it is optimizer who check optimal path to access data, it also know how many block need to scan.
    Same info you will get from v$session_longops.
    SELECT s.sid,s.serial#,s.machine,
    sl.elapsed_seconds, sl.time_remaining,
    ROUND(sl.sofar/sl.totalwork*100, 2) progress_pct
    FROM v$session s, v$session_longops sl
    WHERE s.serial# = sl.serial# and s.sid = sl.sid
    Virag

  • Try to catch the 'long' operation ...

    Hello,
    With the following SQL statement, I try to catch the remaining time of a long operation :
    select sid,totalwork, sofar, time_remaining, ELAPSED_SECONDS
    from v$session_longops
    where totalwork > sofar;
    The aim is to use it to warn the user when he does a long search.
    But i can't find a way to isolate one long operation concerning one user/action.
    The problem is that multiple person login into the same user (not really good, I know but ...) and with a user, I can't get his SID ...
    Any help willbe gladly appreciated.
    Miguel

    I finnaly found it! ;-)
    select sid,serial# from v$session where audsid=userenv('SESSIONID');

  • "Preloading" GUI / disabling GUI during long operations

    Hello everyone.
    I got a question that comes with two aspects I think. I'm working on a fairly large Swing-based userinterface. There are some rather complex input forms which can for example be split up into a number of tabs in a tabbed pane. Currently, these forms are constructed/instantiated, when the user performs an action (e.g. selecting an option from a menu) and I can already see some performance problems coming around using that approach. Are there any common ways to handle this, like for example to load the needed classes in advance or sth like that?
    The other part of my question is referred to disabling the GUI when there are operations involved that could probably take a "long" time (database access, or the above mentioned dynamic construction of GUI elements) during which the user should be prevented from e.g. clicking on a button. Additionally, the program should indicate to the user that it is still working.
    As for the second part, I came up with the "glasspane-technique" after some research, which I think might be quite useful. But the question is: how do I put all this together in a "real" program? Like when would I actually spawn the thread that fetches the data from the database or construct the complex GUI forms? Would that happen directly in the eventlistener of a button for example?
    Thanks for any hints,
    Jan.

    To understand background worker threading issues with Swing check "http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html"
    You can minimize the runtime gitter associated with initializing dialog boxes by creating new instances of the JDialogs/JFrames at startup. However, this can only be done if you can access the instance reference variables associated with the JDialogs/JFrames from your main method.
    For Example:
    public static void main(String[] args){
    //Get references to the dialogs that will be set to visible when the user clicks
    //E.g. optionsDialog = someProviderClassInYourProgram.getGlobalOptionsDialogReference();
    //Initialize the JDialogs
    optionsDialog = new myOptionsDialogBox();
    colorChooserDialog = new myColorChooserDialog();
    //But don't display them here. only when the user requests them.
    }If you have extended the JFrame/JDialog etc. classes to create your program's dialogs (e.g. public class myOptionsDialog extends JDialog {..} ), then you don't need to have direct access to instance variable references (e.g. optionsDialog = someProviderClassInYourProgram.getGlobalOptionsDialogReference();).
    Instead you can just use Class.forName("Fully.qualified.class.name"); for each class that you would like to have preloaded and initialized.
    So your code might look like
    public static void main(String[] args){
    Class.forName("mypackage.dialogs.myOptionsDialogBox");
    Class.forName("mypackage.dialogs.myColorChooserDialog");
    }Keep in mind that either of these approaches will increase your application's start up time.

  • Thread safe operations on table in pl/sql procedure?

    I am developing java application which will be running in N localizations simultaneously, each application will have M threads. Every thread takes an unique ID with status NOT_TAKEN from table Queue and changes its status to TAKEN.
    Problem:
    How to prevent thread from situation like this:
    1. Thread A select first ID with status NOT_TAKEN
    2. In the same time thread B select first (so it will be the same ID which selected thread A) ID with status NOT_TAKEN.
    3. Thread A changes status of ID to TAKEN
    4. Thread B changes status of ID to TAKEN
    After this operation thread A and B are using the same ID.
    What I did:
    I have written pl/sql procedure which lock table Queue in exclusive mode, selects first ID, changes its status to TAKEN and unlocks the table. Because it is lock in exclusive mode so only one thread can run this procedure simultaneously.
    Question:
    How optimally should it be solved, because mine solution prevents from doing all other Updates on Queue table while it is locked, like changing status from TAKEN to OPERATION_DONE so it has performance issue.

    As Centinul has said, you need to lock just one row.
    I would just add NOWAIT to the select statement to let the Java thread go and try again, instead of waiting for the other threads.
    Example: (not tested)
    -- Assuming structure of your QueueTable: ( IDCol is PK , StatusCol is VARCHAR2, ... )
    -- or make it part of the package....
    CREATE OF REPLACE
    FUNCTION updateQueue( nQID QueueTable.IDCol%TYPE) RETURN VARCHAR2 AS
       eLocked EXCEPTION;
       PRAGMA EXCEPTION_INIT(eLocked,-54);
       CURSOR curQueueTable IS SELECT 1 CNTR FROM QueueTable WHERE IDCol=nQID AND StatusCol='NOT_TAKEN' FOR UPDATE OF StatusCol NOWAIT;
       recQueueTable curQueueTable%ROWTYPE;
       cRtn VARCHAR2(1);
    BEGIN
       cRtn := 'Y';
       BEGIN
          OPEN curQueueTable;
          FETCH curBuffSummary INTO recQueueTable;
          CLOSE curQueueTable;
          IF recQueueTable.CNTR IS NOT NULL AND recQueueTable.CNTR = 1 THEN
              UPDATE QueueTable SET StatusCol = 'TAKEN' WHERE IDCol=nQID;
          ELSE
              -- Already updated
              cRtn := 'N';
          END IF;
             -- You can control your transaction here as well
             -- COMMIT;
             -- But if realy should be done in the Java thread.
        EXCEPTION
           WHEN eLocked OR STANDARD.TIMEOUT_ON_RESOURCE THEN
           -- Thread could not get exclusice row lock. Ignore error.
             cRtn := 'N';
             NULL;
          WHEN OTHERS THEN
             -- Handle other errors...
             -- NULL; just kidding...
             RAISE;
       END;
       RETURN cRtn;
    END; Edited by: thomaso on Sep 18, 2009 10:30 AM

  • How do i download the adobe photoshop cc trial? it says i am running a no longer operating system or something...

    You are running an operating system that Photoshop no longer supports. Refer to the system requirements below for a full list of supported platforms.

    yd$p wrote:
    I have a windows vista home premium
    That operating system is not supported. It's too old.
    Photoshop CC requires Windows 7 or Windows 8.
    Adobe Photoshop CC for Mac, Windows, PC - Tech specs

  • Runspace threading long running process;

    We started using(ForEach-Parallel)
    http://gallery.technet.microsoft.com/scriptcenter/Foreach-Parallel-Parallel-a8f3d22b#content
    function for running sql server queries against multiple machines.
    We have a schedule (created through task scheduler)that runs every 15 minutes against multiple machines, but on a few instances queries against some machines take longer than others , say 1 hr compared to 10 secs on others, but when the next instance of task
    starts is it possible not to start a new thread that's already running against an existing machine? We don't want to overload our sql servers and it won't add value if it just hangs(ie: if an existing query is still running).
    Posted there to run against multiple machines.
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/32799e2e-07fd-42d0-95be-d7ed9f2c5e7d/error-calling-function?forum=winserverpowershell
    Thanks

    Thanks for the info, I went ahead with your logging suggestion. I am logging every machine it runs against into a temp file and  at the end of the script I am trying to append to the final file, i keep getting error saying process cannot use the file
    because its used by another process, but no process is holding a lock on the final file, because of this lot of temp files get left behind.  I used a checkfileexists function(from stackoverflow) to see if file can be updated but still throws an error
    saying another process is using it. I also tested against one machine so there won't be any collision but still complains of the same error.
    http://stackoverflow.com/questions/9394629/how-to-check-if-file-is-being-used-by-another-process-powershell
    So i have this inside my script.
    $filestatus =CheckFileStatus("L:\dba\Logs\SQLBackup_RunSpace.log")
    IF(!$filestatus)
    WriteLog2 -Msg "Waiting to update log file going into loop" -Log  $global:LogFileTmp
    $QCheckCtr = 0
    do{  
    Start-Sleep -s 3
    $filestatus =CheckFileStatus($global:LogFile)
    IF(!$filestatus)
    WriteLog2 -Msg "Waiting to update log file" -Log  $global:LogFileTmp
    $QCheckCtr = $QCheckCtr + 1  
    } #End of first try
    else
    WriteLog2 -Msg "proceeding to update log waiting after $QCheckCtr try" -Log  $global:LogFileTmp
    cat $global:LogFileTmp >> $global:LogFile
    RmFile $global:LogFileTmp | Out-Null
    break;
    }while ($QCheckCtr -le 5)
    } #End of checking file is locked
    else
    WriteLog2 -Msg "proceeding to update log file without waiting" -Log  $global:LogFileTmp
    cat $global:LogFileTmp >> $global:LogFile
    RmFile $global:LogFileTmp | Out-Null
    The process cannot access the file 'L:\dba\Logs\SQLBackup_RunSpace.log' because it is being used by another process.
    At line:300 char:30
    +                 cat $global:LogFileTmp >> <<<<  $global:LogFile
        + CategoryInfo          : OpenError: (:) [], IOException
        + FullyQualifiedErrorId : FileOpenFailure
    Is it due to using the runspace? 
    Thanks

  • Progress monitoring for long operation

    I know that questions similar to this have been asked many times, but I have not gotten an answer that works for me, so here goes. I have a dialog box with various parameters that the user can specify for a long running task. After the user clicks "OK", I want the dialog box to disappear and instead to have an indeterminate jprogressbar display while the task is running. I have tried using SwingWorker classes and invokeLater(), but I ahve not gotten anything to work. Could someebody please help me out with which parts of the code:
    1. Destroying the old dialog box
    2. Starting the long task
    3. creating the JProgressbar and making it indeterminate
    4. Destroying the JProgressBar
    5. informing the user that the task is complete
    need to be performed using a SwingWorker or invokelater and how the parts should fit together.
    Thank you for the help,
    Jeff

    1. Destroying the old dialog box"old dialog box".dispose();
    3. creating the JProgressbar and making it
    indeterminateBetter create JProgressBar object before starting the thread.
    2. Starting the long task
    4. Destroying the JProgressBar
    5. informing the user that the task is completeIn your class, define the SwingWorker as:
        final SwingWorker worker = new SwingWorker() {
            public Object construct() {
                /* start your long task.
                 * Call local method, method from other
                 * class, whatever.
                return new Object();
            public void finished() {
                /* To finish off the long task.
                 * This method is called when the thread
                 * finishes.
                 * This where you destroy your progress bar
                 * and inform user the task is completed.
        };Of course, you'll need another thread to monitor the progress of your task, and increment the value in progress bar.
    As for indeterminate progress bar, you'll need to know some estimate anyway.
    If at all possible to break the long task in blocks/sections, that number can be applied to the progress bar. Otherwise, get an average performance time, and set the maximum with a figure, and slowly increment the progress bar. If it reaches 99% before finish, then I guess you have to wait till the task ends, then display 100%. If finishes quickly, then you can boost the speed of increment (or instantly display 100%).
    Alternatively, if you can determine (dynamically) how long before the end of task while running your task, you can always update your JProgressBar values (you probably aware of this, anyway).
    Hope this helps.

Maybe you are looking for