Long running threads.

Hello everyone,
Thanks for your interest in this post. I have a design question on a feature we are currently working on - I have described it below as best as I can. I would be thankful for any direction or guidance from all the good and experienced folks here in this forum :)
We have a system which receives some input data (say in the form of files or a db update) from external sources. We have a job which wakes up periodically, checks for the presence of new data and then does some parsing/data manipulation. I have posted it below and for the sake of brevity and conciseness kept it simple.
public class Work{  
    private SomeVar _var;  
    //constructor here  
    public void doWork(){  
         //run job  
}  Note we have multiple kind of input (so multiple Work classes each of which have different parse logic).
So far so good.
We have jdk 1.4 (no java.util.concurrent) and we dont have an option to use a scheduling f/w like quartz
Its simple enough and we dont have a need for Listeners, dynamic scheduling etc.
That leaves us with 2 options to implement this
Option 1
Create a thread for each kind of job on startup.
Each thread checks for presence of input data and creates a Work object to process the job.
public class WorkThread extends Thread{//some common functionality here}
public class SpecificWorkThread extends WorkThread{  
       private MetaInfo _meta;  
       //constructor  
       public void run(){  
          while(true){  
                //check for presence of input data  
                Work _w = new Work();  
                _w.doWork();  
                //sleep for some time  
pulic class Controller{
      psv main(String args[]){
     //for each job{
             WorkThread t = new SpecificWorkThread();
             t.start();
         //join on all threads
}  As you can see this would create (from the main), a long running thread for each job type
Option 2
Have the input data check in the controller clas. When there is input data to parse, create a Thread which does the parsing.
The thread in its run method parses and comes out. So for each parse cycle, a short lived thread is created, somthing like below
public class WorkController{  
       psv main(String args[]){  
               while(true){  
                  //check for input condition  
                  new SpecificWorkThread(new Work()).start();  
                 //sleep for sometime  
          public class SpecificWorkThread extends Thread{  
              private Work _work;  
              //constructor  
              public void run(){  
                    _work.doWork();  
        The difference between the two is that while the first creates long running threads per job type, in option(2) a thread is created on demand. Each thread is short lived (it does its job and dies), but then a thread needs to be created every time for a job.
Both would work and work correctly. What I would like to understand is if the options presented above just a programmer's prefence or is one option better than the other (performance, memory considerations) etc?
Thanks for your patience in reading this post.
cheers,
ram.

Generally creating a new thread is an expensive process. Well, everything is relative. My laptop can create & run & stop 7,000+ threads per second, test program below, YMMV. If you are dealing with thousands of thread creations per second, pooling may be sensible; if not, premature optimization is the root of all evil, etc.
public class ThreadSpeed
    public static void main(String args[])
     throws Exception
        System.out.println("Ignore the first few timings.");
        System.out.println("They may include Hotspot compilation time.");
        System.out.println("I hope you are running me with \"java -server\"!");
     for (int n = 0; n < 5; n++)
         doit();
        System.out.println("Did you run me with \"java -server\"?  You should!");
    public static void doit()
     throws Exception
        long start = System.currentTimeMillis();
        for (int n = 0; n < 10000; n++) {
         Thread thread = new Thread(new MyRunnable());
         thread.start();
         thread.join();
        long end = System.currentTimeMillis();
        System.out.println("thread time " + (end - start) + " ms");
    static class MyRunnable
     implements Runnable
     public void run()
}Edited by: sjasja on Jan 14, 2010 2:20 AM

Similar Messages

  • Long running threads (Jasper Reports) and AM-Pooling

    Hi,
    we are developing quite large application with ADF an BC. We have quite a lot of reports generated through Jasper that take quite long time to complete. The result is a PDF document that user gets on the UI so he can download it over download link. Reports that take over an hour to finish are never completed and returned to the user on UI. I think the problem is in AM-Polling because we are using default AM-Polling settings:
    <AM-Pooling jbo.ampool.maxinactiveage="600000" jbo.ampool.monitorsleepinterval="600000" jbo.ampool.timetolive="3600000"/>
    The AM is destroyed or returned to pool before reports finishes. How to properly configure those settings that even long running threads will do there jobs to the end.
    We also modified web.xml as follows:
      <session-config>
        <session-timeout>300</session-timeout>
      </session-config>
    Any help appreciated.
    Regards, Tadej

    Your problem is not related to ADF ApplicationModules. AMs are returned to the pool no earlier than the end of request, so for sure they are not destroyed by the framework while the report is running. The AM timeout settings you are referring to are applicable only to idle AMs in the pool but not to AMs that have been checked out and used by some active request.
    If you are using MS Internet Explorer, then most probably your problem is related to the IE's ReceiveTimeout setting, which defines a timeout for receiving a response from the server. I have had such problems with long running requests (involving DB processing running for more than 1 hour) and solved my problem by increasing this timeout. By default this timeout is as follows:
    IE4 - 5 minutes
    IE5, 6, 7, 8 - 60 minutes
    I cannot find what the default value is for IE9 and IE10, but some people claim it is only 10 seconds, although this information does not sound reasonable and reliable! Anyway, the real value is hardly greater than 60 minutes.
    You should increase the ReceiveTimeout registry value to an appropriate value (greater than the time necessary for your report to complete). Follow the instructions of MS Support here:
    Internet Explorer error &quot;connection timed out&quot; when server does not respond
    I have searched Internet for similar timeout settings for Google Chrome and Mozilla Firefox, but I have not found anything, so I instructed my customers (who execute long-running DB processing) to configure and use IE for these requests.
    Dimitar

  • Long running threads in DB2 DBSM/ job triggered by DDIC

    Hi Basis Gurus,
    I have ECC 6.0 , DB2 8.1.5 and SM 4.0.
    Every day a job kicks up on the SM with user id DDIC and consumes a lot of CPU.This job fires up again at some irreular intervals 2-3 times in a day.And whenevrer it runs, takes a lot of CPU.
    In sm50 it shows up as: CL_SQL_STATEMENT===CP 
    When you go into the details of it , it says
    Loading DB library 'D:\usr\sap\SLM\DVEBMGS01\exe\dbdb2slib.dll' ..
    Library 'D:\usr\sap\SLM\DVEBMGS01\exe\dbdb2slib.dll' loaded  
    After that it calls DB connect , and tries to monitor something.
    and gives the following error...
    C  Monitor for DB2 system not started. Retrieving EBCDIC CCSID from SYSIBM.SYSSTRINGS.
    C  EBCDIC CCSID calculated from SYSIBM.SYSSTRINGS is 37 .                             
    Then it tries to do something, and gets disconnected ..
    C  *** ERROR => DB2 Call 'SQLEndTran' Error: sqlcode = -900 : [IBM][CLI Driver] SQL0900N  The application state is in error.  A data
    and again tries to connect....and monitor and the process continues...
    =============================================
    In omega Mon for DB2,  i can see the following 3 sql statements being triggered over and over again..
    SELECT COUNT(*) FROM "BC_SLD_INST" WHERE "APPL" = ? AND "NA_KEY" = ? AND
      "INST_HASH" = ?                                                        
    SELECT "INST_HANDLE","INSTNAME_BYTES" FROM "BC_SLD_INST" WHERE "APPL" = 
    ? AND "NA_KEY" = ? AND "INST_HASH" = ?                                  
    INSERT INTO "BC_SLD_ASSINST" ("APPL","NA_KEY","ASSINST_HASH","ASSINST_HA
    NDLE","INST_HASH","INST_HANDLE","ROLE_HASH","ROLE_HANDLE") VALUES (?,?,?
    I am not sure as to :
    1.) What this process is, what it is trying to do.
    2.)How is it getting triggered, as it does not show up as scheduled task in sm36.Only time i can monitor it in sm37, is when it is running..
    3.)And is it really necessary to run it everyday 2-3 times.if not how can i stop it from running.
    Please advice.......
    Regards....

    Hi Guys,
    Did you found a solution for this issue?
    I am making a DB Export on DB2 V8.1 FixPak14 and I am getting error SQLCODE -429 SQLSTATE 54028 on the same table "BC_SLD_INST".
    Do you know what is the porpose of this table? Which kind of data does it record?
    I have looked everywhere and there is any documentation about this table.
    Thanks in advance.
    Regards,
    Jose Flores

  • ProgressIndicator and  hourglass for long running processes

    Hi all,
    Iam using Oracle ADF 10g with EJBs.
    I have a long running process for which I want to give the user an indication of its progress. The process is run upon clicking a submit button.
    I have tested the use of the combination of progressIndicator + poll according to the example of Gerger consulting( http://gergerconsulting.blogspot.com/2007/04/adf-faces-progressindicator-example-for.html) but it did not work. The problem is that my long running process hangs the page and the progress bar does not work until the process has finished.
    I have seen a similar post in this foum (Re: How to run long background jobs in ADF applications where a user complains that there is not an Oracle method for running asynchronous processes from Oracle ADF.
    I've tested to isolate my asynchronous process with the progressIndicator + poll in a single ADF page. The process is being activated from an invokeAction from the executables of the pagedef file. But again the process hangs the page and the progressIndicator does not display at all.
    So I have abandoned the idea of the progress indicator and Iam thinking of using an hourglass.
    Is there an example or guidelines of how I can do it?

    Thanks John for your reply,
    Iam still working on the progressIndicator. I have read the discussion thoroughly quite many times.
    One thing I have not yet figured out from your discussion is how you manage to create the long-running-process thread within an action method within the managed bean and make the thread still be active, while the parent action method has finished.
    Usually the managed beans attached to a .jspx pages has request scope. So a commandButton's action method (that will spawn the long running thread) will finish much earlier than the thread and it will kill the thread.
    Thanks,
    Dimitris

  • Long-running Batch eWay JCD - threading and stopping

    I have a requirement to poll for files on a remote server, every few seconds, almost continuously. Furthermore, without making a connections every polling interval. In other words, connect once and stay running, If a file is found, send a JMS message to another service that will process the file, but keep polling for more files. Thus, a long-running service. This will tie up the thread?
    Can I have an array of BatchFTP instances, and in each loop of the long-running process, check each connected instance for incoming files? Or can I only have one instance?
    If the domain is shutdown, will this service shutdown nicely, if it is still in its looping process? If not, I could check another 'command queue' for a shutdown command, but now I have to add code to the domain shutdown script to send that shutdown message to the command queue. Could I instead, somehow check the status of another service in the same project to see if it is shutdown, and therefore know to stop the loop and allow it to be shutdown? I saw an example of a JMX command to check the status of an object. Is that the best way to check the status of a jcd from inside another jcd?
    thanks, Pete

    Hi Chris and thank you,
    I also do not want to build and manage a long-running service, from a performance point of view. The owners of the target server want a file to be picked up as soon as it arrives (within 5 seconds), but they don't want FTP connections created and deleted every 5 seconds. They expect that we will make a connect() call, and then continually loop / poll using dirlist() method.
    When I look at this requirement I also think of re-using it as a generic service - as long as I have a long-running service, I might as well use it for any other long-running, open FTP connections to other servers/userids. So in the same jcd instance, I would connect to multiple FTP servers and execute a loop where I go through a list of FTP connections, and for each, I would go through a list of folders that should be polled (using dirlist method). So I only have one JCD running for a long time but it could have multiple FTP connections open. That is why I am thinking of using an array of BatchFTP objects.
    When your code shows a Scheduler eWay input, do you mean that the JCD will triggered by the first Scheduler message, but would then go into a loop, doing work, and performing a JMS.receive on that Scheduler queue for the 2dn, 3rd, .. nth Scheduler message? So because the jcd is still running, it still had all its objects and FTP connections (open), but its looping is controlled by the Scheduler message?
    I'm running 513u3. I am worried about shutdown. I think it might not listen to a shutdown command. So that is why I was thinking about putting in some code at the bottom of the loop that would check, somehow, if a shutdown is in progress.
    Peter

  • WIJ 20002 error on long running reports

    When trying to run a long running report, an error message is received .
    Quote:
    *"The Web Intelligence Java Report Panel cannot connect to the server. Close
    the report panel and try to connect again or see your BusinessObjects
    administrator. (Error: WIJ 20002)"*
    What happens next is you are advised to "close" (twice) and are then advised to close this window.
    If you select Details on the first error message:
    Server: https://test.i3access.iowa.gov:443/desktoplaunch/InfoView/CrystalEnterprise_Webi/cdzServlet?
    java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 502 for URL: https://test.i3access.iowa.gov:443/desktoplaunch/InfoView/CrystalEnterprise_Webi/cdzServlet
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
         at com.businessobjects.wp.cpi.CPIConnection.postRequest(CPIConnection.java:437)
         at com.businessobjects.wp.xml.XMLViaHttp.loadScript(XMLViaHttp.java:144)
         at com.businessobjects.wp.xml.XMLViaHttp.getPromptList(XMLViaHttp.java:1284)
         at com.businessobjects.wp.xml.XMLLoader.getPromptList(XMLLoader.java:279)
         at com.businessobjects.wp.om.OMQuery.loadPromptsAndContexts(OMQuery.java:359)
         at com.businessobjects.wp.om.OMQuery.getActiveContextCount(OMQuery.java:384)
         at com.businessobjects.wp.tc.query.TCQueryPropertie.buildQueryContextFromUI(TCQueryPropertie.java:496)
         at com.businessobjects.wp.tc.query.TCQueryTab.buildQueryContextFromUI(TCQueryTab.java:846)
         at com.businessobjects.wp.tc.query.TCQueryTab.modifyQueryProperties(TCQueryTab.java:638)
         at com.businessobjects.wp.tc.query.TCQueryTabManager.modifyQueryTabs(TCQueryTabManager.java:306)
         at com.businessobjects.wp.tc.query.TCQueryPanel.modifyQueryTabs(TCQueryPanel.java:310)
         at com.businessobjects.wp.tc.query.TCQueryPanel.load(TCQueryPanel.java:383)
         at com.businessobjects.wp.tc.TCMainPanel.switchToQueryPanel(TCMainPanel.java:563)
         at com.businessobjects.wp.tc.TCMainPanel.actionPerformed(TCMainPanel.java:506)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at com.jidesoft.plaf.basic.BasicJideButtonListener.mouseReleased(Unknown Source)
         at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
         at com.businessobjects.wp.cpi.CPIConnection.postRequest(CPIConnection.java:441)
         at com.businessobjects.wp.xml.XMLViaHttp.loadScript(XMLViaHttp.java:144)
         at com.businessobjects.wp.xml.XMLViaHttp.getPromptList(XMLViaHttp.java:1284)
         at com.businessobjects.wp.xml.XMLLoader.getPromptList(XMLLoader.java:279)
         at com.businessobjects.wp.om.OMQuery.loadPromptsAndContexts(OMQuery.java:359)
         at com.businessobjects.wp.om.OMQuery.getActiveContextCount(OMQuery.java:384)
         at com.businessobjects.wp.tc.query.TCQueryPropertie.buildQueryContextFromUI(TCQueryPropertie.java:496)
         at com.businessobjects.wp.tc.query.TCQueryTab.buildQueryContextFromUI(TCQueryTab.java:846)
         at com.businessobjects.wp.tc.query.TCQueryTab.modifyQueryProperties(TCQueryTab.java:638)
         at com.businessobjects.wp.tc.query.TCQueryTabManager.modifyQueryTabs(TCQueryTabManager.java:306)
         at com.businessobjects.wp.tc.query.TCQueryPanel.modifyQueryTabs(TCQueryPanel.java:310)
         at com.businessobjects.wp.tc.query.TCQueryPanel.load(TCQueryPanel.java:383)
         at com.businessobjects.wp.tc.TCMainPanel.switchToQueryPanel(TCMainPanel.java:563)
         at com.businessobjects.wp.tc.TCMainPanel.actionPerformed(TCMainPanel.java:506)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at com.jidesoft.plaf.basic.BasicJideButtonListener.mouseReleased(Unknown Source)
         at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Please let me know what the solution is.

    Matt,
    A namesake of yours is my client for this issue.
    Coming to the problem, the customer says there is proxy configured between HTTP server and WebSphere. This proxy server times out for long running reports. If the HTTPServer is bypassed, things work fine.
    A colleague of mine opened a case with BOBJ. I can get you the case# if you need it. We got this reply:
    From: Takano, Hitomi
    Sent: Tuesday, November 04, 2008 10:26 AM
    Hi Matt,
    I was away for the last two days, so I couldn't reply to you sooner.
    Extending the timeout setting from Webi and Infoview in BOXI R2 will not
    make the long running reports work as your proxy setting at the lower
    layer than BOXI just allows 5 minutes and after that the connection will
    be cancelled by the proxy. I'm not sure why this setting was effective
    for https only or timeout out after 2 min. This is out of scope of BOXI
    R2 and your network admin would be the best person to handle. You were
    getting 502 error in Java Report Panel. I googled with "502 error and
    ProxyTimeout", and I got the some articles returned which say  when
    backend doesn't answer on requests(because it timed out), it returns to
    a client an error 502.
    I'll close this thread as the n/w admin at the client are working things out.
    Thanks for your support.

  • Long running query--- included steps given by Randolf

    Hi,
    I have done my best to follow Randolf instruction word-by-word and hope to get solution for my
    problem soon. Sometime back I have posted a thread on this problem then got busy with other
    stuff and was not able to follow it. Here I am again with same issue.
    here is link for my previous post
    long running query in database 10gHere is backgroud of my requriemment.
    I am working on Oracle forms 10g which is using package given below. We want to display client information
    with order count basd on different status like Pending, Error, back Order, expedited, std shipping.
    Output will look something like.
    client name   pending    error   backorder   expedited   std shipping
    ABC            24         0       674          6789         78900
    XYZ            35         673    5700           0           798274
    .There are total 40 clients . The long running query are expedited and std shipping.
    When i run package from Oracle Form Developer it takes 3 mintues to run but when I run same query in our application using forms
    (which uses Oracle Application Server) it takes around 1 hour, which is completly unacceptable.
    User wants it be done in less than 1 mintue.
    I have tried combining Pending,error and backorder queries together but as far as I know it will not
    work in Oracle Form as we need a place holder for each status.
    Please dont think it is Forms related question, it is a Performance problem.
    PACKAGE BODY ORDER_COUNT_PKG IS
    PROCEDURE post_query IS
      BEGIN
           BEGIN
                SELECT count(*)
                  INTO :ORDER_STATUS.PENDING
                  FROM orders o
              WHERE o.status = 'P'
                   AND (parent_order_id is null
                    OR  (order_type='G'
                         AND parent_order_id=original_order_number))
                      AND  o.client = :ORDER_STATUS.CLIENT_NUMBER;
         EXCEPTION
           WHEN OTHERS THEN
           NULL;
           END;
             BEGIN
                 SELECT  count(*)
                   INTO  :ORDER_STATUS.ERROR
                   FROM  orders o
                  WHERE  o.status = 'E'
                    AND  (parent_order_id is null
                     OR  (order_type='G'
                           AND parent_order_id=original_order_number))
                       AND  o.client = :ORDER_STATUS.CLIENT_NUMBER;
                EXCEPTION
           WHEN OTHERS THEN
           NULL;     
            END;
           BEGIN
                SELECT count(*)
                  INTO :ORDER_STATUS.BACK_ORDER
                  FROM orders o
              WHERE o.status = 'B'
                   AND (parent_order_id is null
                    OR (order_type='G'
                         AND parent_order_id=original_order_number))
                      AND o.client = :ORDER_STATUS.CLIENT_NUMBER;
          EXCEPTION
           WHEN OTHERS THEN
           NULL;   
         END;
           BEGIN
                SELECT count(*)
                  INTO :ORDER_STATUS.EXPEDITE
                  FROM orders o,shipment_type_methods stm
                 WHERE o.status in ('A','U')
             AND (o.parent_order_id is null
              OR (o.order_type = 'G'
             AND o.parent_order_id = o.original_order_number))
             AND o.client = stm.client
             AND o.shipment_class_code = stm.shipment_class_code
             AND (nvl(o.priority,'1') = '2'
              OR  stm.surcharge_amount <> 0)
                      AND  o.client = :ORDER_STATUS.CLIENT_NUMBER
              GROUP BY  o.client;
              EXCEPTION
           WHEN OTHERS THEN
           NULL;          
         END;           
           BEGIN
                SELECT count(*)
                  INTO :ORDER_STATUS.STD_SHIP
                  FROM  orders o,shipment_type_methods stm
                 WHERE o.status in ('A','U')
             AND  (o.parent_order_id is null
              OR (o.order_type = 'G'
             AND o.parent_order_id = o.original_order_number))
             AND nvl(o.priority,'1') <> '2'
             AND o.client = stm.client
             AND o.shipment_class_code = stm.shipment_class_code
             AND stm.surcharge_amount = 0
                      AND o.client = :ORDER_STATUS.CLIENT_NUMBER
              GROUP BY o.client;
          EXCEPTION
           WHEN OTHERS THEN
           NULL;
           END;
      END post_query;
      END ORDER_COUNT_PKG;one of the query which is taking long time is
    SELECT count(*)
                   FROM  orders o,shipment_type_methods stm
                 WHERE o.status in ('A','U')
             AND  (o.parent_order_id is null
              OR (o.order_type = 'G'
             AND o.parent_order_id = o.original_order_number))
             AND nvl(o.priority,'1') <> '2'
             AND o.client = stm.client
             AND o.shipment_class_code = stm.shipment_class_code
             AND stm.surcharge_amount = 0
               AND o.client = :CLIENT_NUMBER
              GROUP BY o.clientThe version of the database is 10.2.1.0.2
    SQL> alter session force parallel dml;These are the parameters relevant to the optimizer:
    SQL> show parameter user_dump_dest
    NAME                                 TYPE        VALUE
    user_dump_dest                       string      /u01/app/oracle/admin/mcgemqa/
                                                     udump
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      10.2.0.4
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     16
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACTHere is the output of EXPLAIN PLAN:
    SQL> explain plan for
      2  SELECT count(*)
      3         FROM  orders o,shipment_type_methods stm
      4       WHERE o.status in ('A','U')
      5           AND  (o.parent_order_id is null
      6            OR (o.order_type = 'G'
      7           AND o.parent_order_id = o.original_order_number))
      8           AND nvl(o.priority,'1') <> '2'
      9           AND o.client = stm.client
    10           AND o.shipment_class_code = stm.shipment_class_code
    11           AND stm.surcharge_amount = 0
    12     AND o.client = :CLIENT_NUMBER
    13    GROUP BY o.client
    14  /
    Explained.
    Elapsed: 00:00:00.12
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 559278019
    | Id  | Operation                      | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |   1 |  SORT GROUP BY NOSORT          |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | ORDERS                  |   175K|  3431K| 25979   (3)| 00:05:12 |
    |   3 |    NESTED LOOPS                |                         | 25300 |   864K| 46764   (3)| 00:09:22 |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| SHIPMENT_TYPE_METHODS   |     1 |    15 |     2   (0)| 00:00
    |*  5 |      INDEX RANGE SCAN          | U_SHIPMENT_TYPE_METHODS |     2 |       |     1   (0)| 00:00:01 |
    |*  6 |     INDEX RANGE SCAN           | ORDERS_ORDER_DATE       |   176K|       |  2371   (8)| 00:00:29 |
    Predicate Information (identified by operation id):
       2 - filter(("O"."PARENT_ORDER_ID" IS NULL OR "O"."ORDER_TYPE"='G' AND
                  "O"."PARENT_ORDER_ID"=TO_NUMBER("O"."ORIGINAL_ORDER_NUMBER")) AND NVL("O"."PRIORITY",'1')<>'2
                  AND "O"."SHIPMENT_CLASS_CODE"="STM"."SHIPMENT_CLASS_CODE")
       4 - filter("STM"."SURCHARGE_AMOUNT"=0)
       5 - access("STM"."CLIENT"=:CLIENT_NUMBER)
       6 - access("O"."CLIENT"=:CLIENT_NUMBER)
           filter("O"."STATUS"='A' OR "O"."STATUS"='U')
    24 rows selected.
    Elapsed: 00:00:00.86
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.07Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
    SQL> SELECT count(*)
      2         FROM  orders o,shipment_type_methods stm
      3       WHERE o.status in ('A','U')
      4           AND  (o.parent_order_id is null
      5            OR (o.order_type = 'G'
      6           AND o.parent_order_id = o.original_order_number))
      7           AND nvl(o.priority,'1') <> '2'
      8           AND o.client = stm.client
      9           AND o.shipment_class_code = stm.shipment_class_code
    10           AND stm.surcharge_amount = 0
    11     AND o.client = :CLIENT_NUMBER
    12    GROUP BY o.client
    13  /
    Elapsed: 00:00:03.09
    Execution Plan
    Plan hash value: 559278019
    | Id  | Operation                      | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |   1 |  SORT GROUP BY NOSORT          |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | ORDERS                  |   175K|  3431K| 25979   (3)| 00:05:12 |
    |   3 |    NESTED LOOPS                |                         | 25300 |   864K| 46764   (3)| 00:09:22 |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| SHIPMENT_TYPE_METHODS   |     1 |    15 |     2   (0)| 00:00
    |*  5 |      INDEX RANGE SCAN          | U_SHIPMENT_TYPE_METHODS |     2 |       |     1   (0)| 00:00:01 |
    |*  6 |     INDEX RANGE SCAN           | ORDERS_ORDER_DATE       |   176K|       |  2371   (8)| 00:00:29 |
    Predicate Information (identified by operation id):
       2 - filter(("O"."PARENT_ORDER_ID" IS NULL OR "O"."ORDER_TYPE"='G' AND
                  "O"."PARENT_ORDER_ID"=TO_NUMBER("O"."ORIGINAL_ORDER_NUMBER")) AND NVL("O"."PRIORITY",'1')<>'2
                  AND "O"."SHIPMENT_CLASS_CODE"="STM"."SHIPMENT_CLASS_CODE")
       4 - filter("STM"."SURCHARGE_AMOUNT"=0)
       5 - access("STM"."CLIENT"=:CLIENT_NUMBER)
       6 - access("O"."CLIENT"=:CLIENT_NUMBER)
           filter("O"."STATUS"='A' OR "O"."STATUS"='U')
    Statistics
             55  recursive calls
              0  db block gets
           7045  consistent gets
              0  physical reads
              0  redo size
            206  bytes sent via SQL*Net to client
            238  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> The TKPROF output for this statement looks like the following:
    SELECT count(*)
           FROM  orders o,shipment_type_methods stm
         WHERE o.status in ('A','U')
             AND  (o.parent_order_id is null
              OR (o.order_type = 'G'
             AND o.parent_order_id = o.original_order_number))
             AND nvl(o.priority,'1') <> '2'
             AND o.client = stm.client
             AND o.shipment_class_code = stm.shipment_class_code
             AND stm.surcharge_amount = 0
       AND o.client = :CLIENT_NUMBER
      GROUP BY o.client
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.04       0.04          0          0          0           0
    Fetch        2      2.96       2.91          0       7039          0           1
    total        4      3.01       2.95          0       7039          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 95 
    Rows     Row Source Operation
          1  SORT GROUP BY NOSORT (cr=7039 pr=0 pw=0 time=2913701 us)
         91   TABLE ACCESS BY INDEX ROWID ORDERS (cr=7039 pr=0 pw=0 time=261997906 us)
         93    NESTED LOOPS  (cr=6976 pr=0 pw=0 time=20740 us)
          1     TABLE ACCESS BY INDEX ROWID SHIPMENT_TYPE_METHODS (cr=2 pr=0 pw=0 time=208 us)
          3      INDEX RANGE SCAN U_SHIPMENT_TYPE_METHODS (cr=1 pr=0 pw=0 time=88 us)(object id 81957)
         91     INDEX RANGE SCAN ORDERS_ORDER_DATE (cr=6974 pr=0 pw=0 time=70 us)(object id 81547)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2        0.02          0.02
    ********************************************************************************The DBMS_XPLAN.DISPLAY_CURSOR output:
    SQL> variable CLIENT_NUMBER varchar2(20)
    SQL> exec :CLIENT_NUMBER := '14'
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.06
    SQL> SELECT /*+ gather_plan_statistics */ count(*)
      2         FROM  orders o,shipment_type_methods stm
      3       WHERE o.status in ('A','U')
      4           AND  (o.parent_order_id is null
      5            OR (o.order_type = 'G'
      6           AND o.parent_order_id = o.original_order_number))
      7           AND nvl(o.priority,'1') <> '2'
      8           AND o.client = stm.client
      9           AND o.shipment_class_code = stm.shipment_class_code
    10           AND stm.surcharge_amount = 0
    11     AND o.client = :CLIENT_NUMBER
    12    GROUP BY o.client
    13  /
      COUNT(*)
            91
    Elapsed: 00:00:02.85
    SQL> set termout on
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  4nfj368y8w6a3, child number 0
    SELECT /*+ gather_plan_statistics */ count(*)        FROM  orders o,shipment_type_methods stm      WHERE
    o.status in ('A','U')          AND  (o.parent_order_id is null           OR (o.order_type = 'G'
    AND o.parent_order_id = o.original_order_number))          AND nvl(o.priority,'1') <> '2'          AND
    o.client = stm.client          AND o.shipment_class_code = stm.shipment_class_code          AND
    stm.surcharge_amount = 0    AND o.client = :CLIENT_NUMBER   GROUP BY o.client
    Plan hash value: 559278019
    | Id  | Operation                      | Name                    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  SORT GROUP BY NOSORT          |                         |      1 |      1 |      1 |00:00:02.63 |    7039 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | ORDERS                  |      1 |    175K|     91 |00:03:56.87 |    7039 |
    |   3 |    NESTED LOOPS                |                         |      1 |  25300 |     93 |00:00:00.02 |    6976 |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| SHIPMENT_TYPE_METHODS   |      1 |      1 |      1 |00:00:00.01 |       2 |
    |*  5 |      INDEX RANGE SCAN          | U_SHIPMENT_TYPE_METHODS |      1 |      2 |      3 |00:00:00.01 |       1 |
    |*  6 |     INDEX RANGE SCAN           | ORDERS_ORDER_DATE       |      1 |    176K|     91 |00:00:00.01 |    6974 |
    Predicate Information (identified by operation id):
       2 - filter((("O"."PARENT_ORDER_ID" IS NULL OR ("O"."ORDER_TYPE"='G' AND
                  "O"."PARENT_ORDER_ID"=TO_NUMBER("O"."ORIGINAL_ORDER_NUMBER"))) AND NVL("O"."PRIORITY",'1')<>'
                  "O"."SHIPMENT_CLASS_CODE"="STM"."SHIPMENT_CLASS_CODE"))
       4 - filter("STM"."SURCHARGE_AMOUNT"=0)
       5 - access("STM"."CLIENT"=:CLIENT_NUMBER)
       6 - access("O"."CLIENT"=:CLIENT_NUMBER)
           filter(("O"."STATUS"='A' OR "O"."STATUS"='U'))
    32 rows selected.
    Elapsed: 00:00:01.30
    SQL> I'm looking forward for suggestions how to improve the performance of this statement.
    Thanks
    Sandy

    Please find explain plan for No hint
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 559278019
    | Id  | Operation                      | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |   1 |  SORT GROUP BY NOSORT          |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | ORDERS                  |   175K|  3431K| 25979   (3)| 00:05:12 |
    |   3 |    NESTED LOOPS                |                         | 25300 |   864K| 46764   (3)| 00:09:22 |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| SHIPMENT_TYPE_METHODS   |     1 |    15 |     2   (0)| 00:00
    |*  5 |      INDEX RANGE SCAN          | U_SHIPMENT_TYPE_METHODS |     2 |       |     1   (0)| 00:00:01 |
    |*  6 |     INDEX RANGE SCAN           | ORDERS_ORDER_DATE       |   176K|       |  2371   (8)| 00:00:29 |
    Predicate Information (identified by operation id):
       2 - filter(("O"."PARENT_ORDER_ID" IS NULL OR "O"."ORDER_TYPE"='G' AND
                  "O"."PARENT_ORDER_ID"=TO_NUMBER("O"."ORIGINAL_ORDER_NUMBER")) AND NVL("O"."PRIORITY",'1')<>'2
                  AND "O"."SHIPMENT_CLASS_CODE"="STM"."SHIPMENT_CLASS_CODE")
       4 - filter("STM"."SURCHARGE_AMOUNT"=0)
       5 - access("STM"."CLIENT"=:CLIENT_NUMBER)
       6 - access("O"."CLIENT"=:CLIENT_NUMBER)
           filter("O"."STATUS"='A' OR "O"."STATUS"='U')
    24 rows selected.
    Elapsed: 00:00:00.86Explain Plan for Parallel Hint
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 559278019
    | Id  | Operation                      | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |   1 |  SORT GROUP BY NOSORT          |                         |     1 |    35 | 46764   (3)| 00:09:22 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | ORDERS                  |   175K|  3431K| 25979   (3)| 00:05:12 |
    |   3 |    NESTED LOOPS                |                         | 25300 |   864K| 46764   (3)| 00:09:22 |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| SHIPMENT_TYPE_METHODS   |     1 |    15 |     2   (0)| 00:00
    |*  5 |      INDEX RANGE SCAN          | U_SHIPMENT_TYPE_METHODS |     2 |       |     1   (0)| 00:00:01 |
    |*  6 |     INDEX RANGE SCAN           | ORDERS_ORDER_DATE       |   176K|       |  2371   (8)| 00:00:29 |
    Predicate Information (identified by operation id):
       2 - filter(("O"."PARENT_ORDER_ID" IS NULL OR "O"."ORDER_TYPE"='G' AND
                  "O"."PARENT_ORDER_ID"=TO_NUMBER("O"."ORIGINAL_ORDER_NUMBER")) AND NVL("O"."PRIORITY",'1')<>'2
                  AND "O"."SHIPMENT_CLASS_CODE"="STM"."SHIPMENT_CLASS_CODE")
       4 - filter("STM"."SURCHARGE_AMOUNT"=0)
       5 - access("STM"."CLIENT"='14')
       6 - access("O"."CLIENT"='14')
           filter("O"."STATUS"='A' OR "O"."STATUS"='U')
    24 rows selected.
    Elapsed: 00:00:08.92Explain Plan for USE_Hash hint
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1465232248
    | Id  | Operation                     | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |                         |     1 |    35 | 46786   (3)| 00:09:22 |
    |   1 |  SORT GROUP BY NOSORT         |                         |     1 |    35 | 46786   (3)| 00:09:22 |
    |*  2 |   HASH JOIN                   |                         | 25300 |   864K| 46786   (3)| 00:09:22 |
    |*  3 |    TABLE ACCESS BY INDEX ROWID| SHIPMENT_TYPE_METHODS   |     1 |    15 |     2   (0)| 00:00:0
    |*  4 |     INDEX RANGE SCAN          | U_SHIPMENT_TYPE_METHODS |     2 |       |     1   (0)| 00:00:01 |
    |*  5 |    TABLE ACCESS BY INDEX ROWID| ORDERS                  |   175K|  3431K| 46763   (3)| 00:09:22 |
    |*  6 |     INDEX RANGE SCAN          | ORDERS_ORDER_DATE       |   176K|       |  4268   (8)| 00:00:52 |
    Predicate Information (identified by operation id):
       2 - access("O"."CLIENT"="STM"."CLIENT" AND "O"."SHIPMENT_CLASS_CODE"="STM"."SHIPMENT_CLASS_COD
                  E")
       3 - filter("STM"."SURCHARGE_AMOUNT"=0)
       4 - access("STM"."CLIENT"='14')
       5 - filter(("O"."PARENT_ORDER_ID" IS NULL OR "O"."ORDER_TYPE"='G' AND
                  "O"."PARENT_ORDER_ID"=TO_NUMBER("O"."ORIGINAL_ORDER_NUMBER")) AND NVL("O"."PRIORITY",'1')<>'2
       6 - access("O"."CLIENT"='14')
           filter("O"."STATUS"='A' OR "O"."STATUS"='U')
    25 rows selected.
    Elapsed: 00:00:01.09
    SQL> Thanks
    Sandy

  • ORABPEL-05002 for long running process

    Hi everybody,
    My question is related with a long running process I have designed and which, after running for a couple of days, ends by reporting the ORABPEL-05002 error:
    ===============================================================
    ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.PerformMessage"; the exception is: Transaction was rolled back: timed out; nested exception is: java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
         java.lang.Exception: No Exception - originate from:
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:152)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    ===============================================================
    Looking in the Manual Recovery screen, I can see an Activity I can recover. It's about an assign Activity where I'm doing a single boolean assignation.
    Of course, together with the ORABPEL-05002 error I got also the 'Transaction was rolled back: time out' message. Note that I have modified the transaction-timeout value to 180000. The error occurs during the night, with no heavy load of the server.
    Recovering the assign activity brings back the process in the running state.
    My process pattern:
    while (1 == 1) {
    do activity;
    wait_timeout();
    So, I have the following questions:
    1. Which is cause of this error?
    2. How may I automatically recover this lost activity? RecoveryAgent?
    Any suggestion is appreciated.
    Regards,
    amo
    P.S: the full stack of error messages reported in domain.log:
    ===============================================================
    <2006-09-18 08:08:34,101> <ERROR> <SRH.collaxa.cube.engine.dispatch> <DispatchHelper::handleMessage> failed to handle message
    javax.ejb.EJBException: Transaction was rolled back: timed out; nested exception is: java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
         java.lang.Exception: No Exception - originate from:
    java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
         java.lang.Exception: No Exception - originate from:
         at com.evermind.server.ejb.EJBUtils.makeException(EJBUtils.java:873)
         at ICubeEngineLocalBean_StatelessSessionBeanWrapper0.handleWorkItem(ICubeEngineLocalBean_StatelessSessionBeanWrapper0.java:1479)
         at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handle(PerformMessageHandler.java:45)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: java.lang.Exception: No Exception - originate from:
         at com.evermind.server.ejb.EJBUtils.makeException(EJBUtils.java:871)
         ... 10 more
    javax.ejb.EJBException: Transaction was rolled back: timed out; nested exception is: java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
         java.lang.Exception: No Exception - originate from:
         at ICubeEngineLocalBean_StatelessSessionBeanWrapper0.handleWorkItem(ICubeEngineLocalBean_StatelessSessionBeanWrapper0.java:1479)
         at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handle(PerformMessageHandler.java:45)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    <2006-09-18 08:08:34,129> <ERROR> <SRH.collaxa.cube.engine.dispatch> <BaseScheduledWorker::process> Failed to handle dispatch message ... exception ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.PerformMessage"; the exception is: Transaction was rolled back: timed out; nested exception is: java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
         java.lang.Exception: No Exception - originate from:
    ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.PerformMessage"; the exception is: Transaction was rolled back: timed out; nested exception is: java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
         java.lang.Exception: No Exception - originate from:
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:152)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    <2006-09-18 08:09:05,236> <ERROR> <SRH.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "activity manager": Scope not found.
    The scope "BpSwt2.30995" has not been defined in the current instance.
    ORABPEL-02094
    Scope not found.
    The scope "BpSwt2.30995" has not been defined in the current instance.
         at com.collaxa.cube.engine.core.ScopeContext.getScope(ScopeContext.java:213)
         at com.collaxa.cube.engine.core.WorkItem.setCubeInstance(WorkItem.java:259)
         at com.collaxa.cube.engine.core.WorkItemFactory.init(WorkItemFactory.java:68)
         at com.collaxa.cube.engine.core.WorkItemFactory.create(WorkItemFactory.java:58)
         at com.collaxa.cube.engine.adaptors.common.BaseWorkItemPersistenceAdaptor.load(BaseWorkItemPersistenceAdaptor.java:147)
         at com.collaxa.cube.engine.data.WorkItemPersistenceMgr.load(WorkItemPersistenceMgr.java:75)
         at com.collaxa.cube.engine.CubeEngine.load(CubeEngine.java:5185)
         at com.collaxa.cube.engine.CubeEngine.load(CubeEngine.java:5173)
         at com.collaxa.cube.engine.CubeEngine.expireActivity(CubeEngine.java:2136)
         at com.collaxa.cube.ejb.impl.ActivityManagerBean.expireActivity(ActivityManagerBean.java:145)
         at com.collaxa.cube.ejb.impl.ActivityManagerBean.expireActivity(ActivityManagerBean.java:116)
         at IActivityManagerLocalBean_StatelessSessionBeanWrapper52.expireActivity(IActivityManagerLocalBean_StatelessSessionBeanWrapper52.java:645)
         at com.collaxa.cube.engine.dispatch.message.instance.ExpirationMessageHandler.handle(ExpirationMessageHandler.java:43)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    <2006-09-18 08:09:05,274> <ERROR> <SRH.collaxa.cube.engine.dispatch> <DispatchHelper::handleMessage> failed to handle message
    ORABPEL-02094
    Scope not found.
    The scope "BpSwt2.30995" has not been defined in the current instance.
         at com.collaxa.cube.engine.core.ScopeContext.getScope(ScopeContext.java:213)
         at com.collaxa.cube.engine.core.WorkItem.setCubeInstance(WorkItem.java:259)
         at com.collaxa.cube.engine.core.WorkItemFactory.init(WorkItemFactory.java:68)
         at com.collaxa.cube.engine.core.WorkItemFactory.create(WorkItemFactory.java:58)
         at com.collaxa.cube.engine.adaptors.common.BaseWorkItemPersistenceAdaptor.load(BaseWorkItemPersistenceAdaptor.java:147)
         at com.collaxa.cube.engine.data.WorkItemPersistenceMgr.load(WorkItemPersistenceMgr.java:75)
         at com.collaxa.cube.engine.CubeEngine.load(CubeEngine.java:5185)
         at com.collaxa.cube.engine.CubeEngine.load(CubeEngine.java:5173)
         at com.collaxa.cube.engine.CubeEngine.expireActivity(CubeEngine.java:2136)
         at com.collaxa.cube.ejb.impl.ActivityManagerBean.expireActivity(ActivityManagerBean.java:145)
         at com.collaxa.cube.ejb.impl.ActivityManagerBean.expireActivity(ActivityManagerBean.java:116)
         at IActivityManagerLocalBean_StatelessSessionBeanWrapper52.expireActivity(IActivityManagerLocalBean_StatelessSessionBeanWrapper52.java:645)
         at com.collaxa.cube.engine.dispatch.message.instance.ExpirationMessageHandler.handle(ExpirationMessageHandler.java:43)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    <2006-09-18 08:09:05,275> <ERROR> <SRH.collaxa.cube.engine.dispatch> <BaseScheduledWorker::process> Failed to handle dispatch message ... exception ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.ExpirationMessage"; the exception is: Scope not found.
    The scope "BpSwt2.30995" has not been defined in the current instance.
    ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.ExpirationMessage"; the exception is: Scope not found.
    The scope "BpSwt2.30995" has not been defined in the current instance.
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:152)
         at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
         at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
         at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
         at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
         at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    ===============================================================

    These are the possible cause to the problem and their solutions:
    Poor performance of the dehydration database If you are using Oracle Lite as dehydration store, please switch to use Oracle 9i or 10g. If Oracle 9i/10g is already in use, check the database parameter 'process' and 'session' to make sure it can handle the expected throughput.
    OC4J has too few available connections to the dehydration database. Increase the maxConnection number of the BPELServerDataSource at the BPEL_HOME/integration/orabpel/system/appserver/oc4j/j2ee/home/config/data-sources.xml (for developer edition) or IAS_HOME/j2ee/OC4J_BPEL/config/data-sources.xml (mid-tier installation).
    Size of message is too big Two ways to deal with this problem:
    Increase the transaction timeout at PEL_HOME/integration/orabpel/system/appserver/oc4j/j2ee/home/config/server.xml (developer edition) or IAS_HOME/j2ee/OC4J_BPEL/config/server.xml (mid-tier installation)
    Decrease the auditLevel from BPELConsole -> Manage BPEL Domain -> Configurations tab. Doing so will reduce the amount of data saved to the dehydration store.
    Cheers
    Anirudh Pucha

  • After running Software update, I can no longer run, open, sync or use iTunes in any way. PLEASE what happened??

    I was running the newest version of Snow Leopard, and after running Software update, I can no longer run, open, sync or use iTunes in any way. PLEASE what happened?
    I really regret that I said "OK" to Software Update message... after Software Update of these updates on 7-26-11:
    Migration Assistant Update for Mac
    Mac OSX 10.6.8 Supplemental Update
    Safari
    iTunes
    Remote Desktop Client Update
    Now I get a message:
    iTunes cannot be opened because of a problem
    Check with developer to make sure iTunes works with this version of Mac OSX. You may need to reinstall the application. Be sure to install any available updates for the application and Mac OSX.
    Process:         iTunes [5092]
    Path:            /Applications/iTunes.app/Contents/MacOS/iTunes
    Identifier:      com.apple.iTunes
    Version:         ??? (???)
    Build Info:      iTunes-10315501~1
    Code Type:       X86 (Native)
    Parent Process:  launchd [111]
    Date/Time:       2011-07-26 12:08:18.568 -0500
    OS Version:      Mac OS X 10.6.8 (10K540)
    Report Version:  6
    Interval Since Last Report:          504736 sec
    Crashes Since Last Report:           20
    Per-App Crashes Since Last Report:   13
    Anonymous UUID:                      B8B5EE28-970A-4E79-949B-EA2DD6E6DAA2
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Crashed Thread:  0
    Dyld Error Message:
      Library not loaded: @loader_path/libgnsdk_musicid.1.8.2.dylib
      Referenced from: /Applications/iTunes.app/Contents/MacOS/iTunes
      Reason: image not found
    Binary Images:
    0x8fe00000 - 0x8fe4162b  dyld 132.1 (???) <A4F6ADCC-6448-37B4-ED6C-ABB2CD06F448> /usr/lib/dyld
    Model: Macmini3,1, BootROM MM31.00AD.B00, 2 processors, Intel Core 2 Duo, 2.26 GHz, 2 GB, SMC 1.35f1
    Graphics: NVIDIA GeForce 9400, NVIDIA GeForce 9400, PCI, 256 MB
    Memory Module: global_name
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x90), Broadcom BCM43xx 1.0 (5.10.131.42.4)
    Bluetooth: Version 2.4.5f3, 2 service, 19 devices, 1 incoming serial ports
    Network Service: Ethernet, Ethernet, en0
    Serial ATA Device: Hitachi HTS543216L9SA02, 149.05 GB
    Serial ATA Device: OPTIARC DVD RW AD-5680H
    USB Device: External HDD, 0x1058  (Western Digital Technologies, Inc.), 0x0704, 0x24100000 / 2
    USB Device: Hub, 0x0424  (SMSC), 0x2507, 0x26400000 / 2
    USB Device: iMic USB audio system, 0x077d, 0x07af, 0x26440000 / 4
    USB Device: Hub, 0x0424  (SMSC), 0x2502, 0x26470000 / 3
    USB Device: Deskjet D4300 series, 0x03f0  (Hewlett Packard), 0x1f04, 0x26471000 / 5
    USB Device: GD-0608-U, 0x056a  (WACOM Co., Ltd.), 0x0021, 0x04700000 / 4
    USB Device: IR Receiver, 0x05ac  (Apple Inc.), 0x8242, 0x04500000 / 3
    USB Device: Hub in Apple Pro Keyboard, 0x05ac  (Apple Inc.), 0x1003, 0x04300000 / 2
    USB Device: Apple Optical USB Mouse, 0x05ac  (Apple Inc.), 0x0307, 0x04310000 / 6
    USB Device: Apple Pro Keyboard, 0x05ac  (Apple Inc.), 0x020b, 0x04330000 / 5
    USB Device: BRCM2046 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0x06100000 / 2
    USB Device: Bluetooth USB Host Controller, 0x05ac  (Apple Inc.), 0x8216, 0x06110000 / 5
    FireWire Device: unknown_device, Unknown
    FireWire Device: d2 DVDRW FW, LaCie, Up to 400 Mb/sec

    Same thing happened to me and I get the same error message. These are the programs that don't work
    mail
    keynote
    pages
    all Office 2011 programs
    safari

  • How to delay a long running tasks start until display is updated?

    I am having a problem in that a progress bar I want to use to show progress of a long running background process is not showing up for a long time (up to 10 seconds) after the long running process is started. This is in an AIR application and the background process is an external native process, so once it is launched the UI thread is free to run, but the launch of the process can take time.
    Below is the current state of the relevant code.
    In addition to the current format I have also tried using the CREATION_COMPLETE, EXIT_FRAME and RENDER events with the same results.
    If I up the value in setTimeout to 500ms the progress bar displays quickly, but I would prefer to not delay the launch of the background process for no reason.
    If I comment out the loadPorject call the progress bar is displayed instantly.
    Any help is appreciated.
    private function continueLoad(evt:Event):void
         // We are about to start some potentially long running process
         CursorManager.setBusyCursor();
         curPopup = new SyncProgress();
         curPopup.addEventListener(Event.ENTER_FRAME, popupLoadedHandler);
         PopUpManager.addPopUp(curPopup, parentView, true);
         PopUpManager.centerPopUp(curPopup);
         curPopup.stage.invalidate();
    private function popupLoadedHandler(event:Event):void
         curPopup.removeEventListener(Event.ENTER_FRAME, popupLoadedHandler);
         setTimeout(function():void{syncManager.loadProject(mainViewModel.selectedUserItem.id,proj ectFile.nativePath,overwrite);},0);

    DBMS_SCHEDULER is very powerful and can be a bit unwieldy. I tend to use DBMS_SCHEDULER for jobs which are purely 'in the database' i.e. not specifically APEX-related - in addition, I find it's better for stuff that needs to be run regularly without human intervention (some sort of refresh process, daily cleanup etc).
    If you are intending to run this process from APEX as a pseudo "on demand" process (i.e. generated by a user request) and have quite simple requirements (e.g. there's no dependencies on other jobs), it might be worth checking out the apex scheduling API - namely the package APEX_PLSQL_JOB:
    http://download.oracle.com/docs/cd/E14373_01/apirefs.32/e13369/apex_plsql_job.htm#BGBCJIJI
    It generates a unique job number which you can use to reference its progress - plus it's much simpler to use.
    p.s. using DBMS_SCHEDULER, yes the job name has to be unique but you can generate one by either using a sequence or data not likely to be repeated, like the current timestamp.

  • Handle long-running EDT tasks (f.i. TreeModel searching)

    Note: this is a cross-post from SO
    http://stackoverflow.com/questions/9378232/handle-long-running-edt-tasks-f-i-treemodel-searching
    copied below, input highly appreciated :-)
    Cheers
    Jeanette
    Trigger is a recently re-detected SwingX issue (https://java.net/jira/browse/SWINGX-1233): support deep - that is under collapsed nodes as opposed to visible nodes only, which is the current behaviour - node searching.
    "Nichts leichter als das" with all my current exposure to SwingWorker: walk the TreeModel in the background thread and update the ui in process, like shown in a crude snippet below. Fest's EDT checker is happy enough, but then it only checks on repaint (which is nicely happening on the EDT here)
    Only ... strictly speaking, that background thread must be the EDT as it is accessing (by reading) the model. So, the questions are:
    - how to implement the search thread-correctly?
    - or can we live with that risk (heavily documented, of course)
    One possibility for a special case solution would be to have a second (cloned or otherwise "same"-made) model for searching and then find the corresponding matches in the "real" model. That doesn't play overly nicely with a general searching support, as that can't know anything about any particular model, that is can't create a clone even if it wanted. Plus it would have to apply all the view sorting/filtering (in future) ...
    // a crude worker (match hard-coded and directly coupled to the ui)
    public static class SearchWorker extends SwingWorker<Void, File> {
        private Enumeration enumer;
        private JXList list;
        private JXTree tree;
        public SearchWorker(Enumeration enumer, JXList list, JXTree tree) {
            this.enumer = enumer;
            this.list = list;
            this.tree = tree;
        @Override
        protected Void doInBackground() throws Exception {
            int count = 0;
            while (enumer.hasMoreElements()) {
                count++;
                File file = (File) enumer.nextElement();
                if (match(file)) {
                    publish(file);
                if (count > 100){
                    count = 0;
                    Thread.sleep(50);
            return null;
        @Override
        protected void process(List<File> chunks) {
            for (File file : chunks) {
                ((DefaultListModel) list.getModel()).addElement(file);
                TreePath path = createPathToRoot(file);
                tree.addSelectionPath(path);
                tree.scrollPathToVisible(path);
        private TreePath createPathToRoot(File file) {
            boolean result = false;
            List<File> path = new LinkedList<File>();
            while(!result && file != null) {
                result = file.equals(tree.getModel().getRoot());
                path.add(0, file);
                file = file.getParentFile();
            return new TreePath(path.toArray());
        private boolean match(File file) {
            return file.getName().startsWith("c");
    // its usage in terms of SwingX test support
    public void interactiveDeepSearch() {
        final FileSystemModel files = new FileSystemModel(new File("."));
        final JXTree tree = new JXTree(files);
        tree.setCellRenderer(new DefaultTreeRenderer(IconValues.FILE_ICON, StringValues.FILE_NAME));
        final JXList list = new JXList(new DefaultListModel());
        list.setCellRenderer(new DefaultListRenderer(StringValues.FILE_NAME));
        list.setVisibleRowCount(20);
        JXFrame frame = wrapWithScrollingInFrame(tree, "search files");
        frame.add(new JScrollPane(list), BorderLayout.SOUTH);
        Action traverse = new AbstractAction("worker") {
            @Override
            public void actionPerformed(ActionEvent e) {
                setEnabled(false);
                Enumeration fileEnum = new PreorderModelEnumeration(files);
                SwingWorker worker = new SearchWorker(fileEnum, list, tree);
                PropertyChangeListener l = new PropertyChangeListener() {
                    @Override
                    public void propertyChange(PropertyChangeEvent evt) {
                        if (evt.getNewValue() == SwingWorker.StateValue.DONE) {
                            //T.imeOut("search end ");
                            setEnabled(true);
                            ((SwingWorker) evt.getSource()).removePropertyChangeListener(this);
                worker.addPropertyChangeListener(l);
                // T.imeOn("starting search ... ");
                worker.execute();
        addAction(frame, traverse);
        show(frame)
    }

    At the end of the day, it turned out that I asked the wrong question (or right question in a wrong context ;-): the "problem" arose by an assumed solution, the real task to solve is to support a hierarchical search algorithm (right now the AbstractSearchable is heavily skewed on linear search).
    Once that will solved, the next question might be how much a framework can do to support concrete hierarchical searchables. Given the variety of custom implementations of TreeModels, that's most probably possible only for the most simple.
    Some thoughts that came up in the discussions here and the other forums. In a concrete context, first measure if the traversal is slow: most in-memory models are lightning fast to traverse, nothing needs to be done except using the basic support.
    Only if the traversal is the bottleneck (as f.i. in the FileSystemModel implementations of SwingX) additional work is needed:
    - in a truly immutable and unmodifiable TreeModel we might get away with read-only access in a SwingWorker's background thread
    - the unmodifiable precondition is violated in lazy loading/deleting scenarios
    there might be a natural custom data structure which backs the model, which is effectively kind-of "detached" from the actual model which allows synchronization to that backing model (in both traversal and view model)
    - pass the actual search back to the database
    - use an wrapper on top of a given TreeModel which guarantees to access the underlying model on the EDT
    - "fake" background searching: actually do so in small-enough blocks on the EDT (f.i. in a Timer) so that the user doesn't notice any delay
    Whatever the technical option to a slow search, there's the same usability problem to solve: how to present the delay to the end user? And that's an entirely different story, probably even more context/requirement dependent :-)
    Thanks for all the valuable input!
    Jeanette

  • Cancel long running statement in Oracle Lite (OLITE_10.3.0.3.0 olite40.jar)

    On JDBC statement, there is the method 'cancel' to instruct the database to cancel an executing statement. This works fine on Oracle server database, but not on Oracle lite database. The method call 'cancel' just blocks and the running statement is never interrupted.
    The example I tried is very simple. There is a thread started which executes a long running statement. I noticed, that when moving the cursor forward by calling rs.next(), it just blocks. That would be ok, if the statement could be canceled from within the main thread by stmt.cancel. But this call blocks as well with no implact on the running statement. Why is that? Do I miss something or is it not possible to cancel a long running statements in Oracle Lite?
    In the following my code snipped:
    public class CancelStatement {
         private static final String PATH_DB = "XX";
         private static final String PATH_LIB = "XX";
         private static final String CON_STRING = "jdbc:polite:whatever;DataDirectory=" + PATH_DB + ";Database=XX;IsolationLevel=Read Committed;Autocommit=Off;CursorType=Forward Only";
         private static final String USER = "XX";
         private static final String PASSWORD = "XX";
         public static void main(String args[]) throws Exception {
              System.setProperty("java.library.path", PATH_LIB);
              Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
              Connection con = DriverManager.getConnection(CON_STRING, USER, PASSWORD);
              Statement stmt = con.createStatement();
              Thread thread = new Thread(new LongStatementRunnable(con, stmt));
              thread.start();
              Thread.sleep(3000);
              // stop long running statement
              System.out.println("cancel long running statement");
              stmt.cancel(); // XXX does not work, as call is blocked until out of memory
              System.out.println("statement canceled");
         private static class LongStatementRunnable implements Runnable {
              private Connection con;
              private Statement stmt;
              public LongStatementRunnable(Connection con, Statement stmt) {
                   this.con = con;
                   this.stmt = stmt;
              @Override
              public void run() {
                   try {
                        System.out.println("start long running statement...");
                        // execute long running statement
                        ResultSet rs = stmt.executeQuery("SELECT * FROM PERSON P1, PERSON P2");
                        while (rs.next()) { // here the execution gets blocked
                             System.out.println("row"); // is never entered
                        rs.close();
                        stmt.close();
                        con.close();
                        System.out.println("long running statement finished...");
                   } catch (Exception e) {
                        e.printStackTrace();
    }I would be very glad if you could help me.
    Thanks a lot
    Daniel
    Edited by: 861793 on 26.05.2011 14:29

    Unfortunately Oracle Lite doesn't have this option. You can call your statement from a second thread as you have done, but you won't be able to kill or cancel this operation. The only way to get fix this is by rebooting. You can use process explorer to find the dll process that is executing the SQL, but the tables will be locked and sync would be locked as well until the process is finished running in shared memory.

  • Using MDBs for long running transactions

    Although MDBs are not the best vehicles for running long transactions, I am
              forced to use them for one such scenario (let's say for lack of a better
              pattern). In order to let my long running MDB (with Container Managed Tx)
              do it's chores I increased the time-out value to a higher number rather than
              using the default of 30 secs. Strangely, I was seeing
              IllegalStateExceptions in stdout. So I created a brand new test MDB with a
              Thread.sleep for 60 seconds, increased my MDBs timeout value to 120 secs,
              made sure there was only one MDB in the pool and ran the test again. I
              still see the below error after 30 seconds.
              I guess I should probably open a support case, but I thought I'll post here
              as well in case there's something I am missing.
              <May 27, 2003 5:26:31 PM PDT> <Notice> <EJB> <Error marking transaction for
              rollback: java.lang.IllegalStateException: Cannot m
              ark the transaction for rollback. xid=64:bea55f200db2c786, status=Rolled
              back. [Reason=weblogic.transaction.internal.TimedOutEx
              ception: Transaction timed out after 34 seconds
              Xid=64:bea55f200db2c786(-33600248),Status=Active,numRepliesOwedMe=0,numRepli
              esOwedOthers=0,seconds since begin=34,seconds left=
              30,activeThread=Thread[ExecuteThread: '9' for queue: 'default',5,Thread
              Group for Queue: 'default'],ServerResourceInfo[JMS_hmJD
              BCStore]=(state=started,assigned=none),SCInfo[wlcsDomain+wlcsServer]=(state=
              active),OwnerTransactionManager=ServerTM[ServerCoor
              dinatorDescriptor=(CoordinatorURL=wlcsServer+155.14.3.140:7501+wlcsDomain+,
              Resources={})],CoordinatorURL=wlcsServer+155.14.3.1
              40:7501+wlcsDomain+)]
              java.lang.IllegalStateException: Cannot mark the transaction for rollback.
              xid=64:bea55f200db2c786, status=Rolled back. [Reason
              =weblogic.transaction.internal.TimedOutException: Transaction timed out
              after 34 seconds
              Xid=64:bea55f200db2c786(-33600248),Status=Active,numRepliesOwedMe=0,numRepli
              esOwedOthers=0,seconds since begin=34,seconds left=
              30,activeThread=Thread[ExecuteThread: '9' for queue: 'default',5,Thread
              Group for Queue: 'default'],ServerResourceInfo[JMS_hmJD
              BCStore]=(state=started,assigned=none),SCInfo[wlcsDomain+wlcsServer]=(state=
              active),OwnerTransactionManager=ServerTM[ServerCoor
              dinatorDescriptor=(CoordinatorURL=wlcsServer+155.14.3.140:7501+wlcsDomain+,
              Resources={})],CoordinatorURL=wlcsServer+155.14.3.1
              40:7501+wlcsDomain+)]
              at
              weblogic.transaction.internal.TransactionImpl.throwIllegalStateException(Tra
              nsactionImpl.java:1486)
              at
              weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImp
              l.java:466)
              at
              weblogic.ejb20.manager.BaseEJBManager.handleSystemException(BaseEJBManager.j
              ava:255)
              at
              weblogic.ejb20.manager.BaseEJBManager.setupTxListener(BaseEJBManager.java:21
              5)
              at
              weblogic.ejb20.manager.StatelessManager.preInvoke(StatelessManager.java:153)
              at
              weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:117)
              at
              weblogic.ejb20.internal.StatelessEJBObject.preInvoke(StatelessEJBObject.java
              :63)
              at
              com.xoriant.hm.ejb.session.HierarchyManagerBean_fzysig_EOImpl.getHierarchyId
              (HierarchyManagerBean_fzysig_EOImpl.java
              :1477)
              at
              com.ebiz.application.customerprofile.hm.CPXHMController.SynchronizeMHTH(Unkn
              own Source)
              at
              com.ebiz.application.customerprofile.hm.CPHMOrgGroupMsgBean.onMessage(Unknow
              n Source)
              at weblogic.ejb20.internal.MDListener.execute(MDListener.java:254)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              

    Hi Adarsh,
              It may be that the transaction time-out setting in the descriptor
              is not taking effect. The tx is still timing out after
              the default 30 seconds, so the later attempt to call
              "setRollbackOnly" fails as the transaction has already
              rolled back The ignored descriptor setting is a known issue
              in some earlier SPs, but I'm not sure when and where it
              was fixed - so yes, contact customer support. The work-around
              is to set the default transaction time-out for the entire server to a
              higher value. (I'm not sure where to set this on the console,
              but the relevant JTA MBean field is "TimeoutSeconds".)
              Tom
              Adarsh Dattani wrote:
              > Although MDBs are not the best vehicles for running long transactions, I am
              > forced to use them for one such scenario (let's say for lack of a better
              > pattern). In order to let my long running MDB (with Container Managed Tx)
              > do it's chores I increased the time-out value to a higher number rather than
              > using the default of 30 secs. Strangely, I was seeing
              > IllegalStateExceptions in stdout. So I created a brand new test MDB with a
              > Thread.sleep for 60 seconds, increased my MDBs timeout value to 120 secs,
              > made sure there was only one MDB in the pool and ran the test again. I
              > still see the below error after 30 seconds.
              > I guess I should probably open a support case, but I thought I'll post here
              > as well in case there's something I am missing.
              >
              > <May 27, 2003 5:26:31 PM PDT> <Notice> <EJB> <Error marking transaction for
              > rollback: java.lang.IllegalStateException: Cannot m
              >
              > ark the transaction for rollback. xid=64:bea55f200db2c786, status=Rolled
              > back. [Reason=weblogic.transaction.internal.TimedOutEx
              >
              > ception: Transaction timed out after 34 seconds
              >
              > Xid=64:bea55f200db2c786(-33600248),Status=Active,numRepliesOwedMe=0,numRepli
              > esOwedOthers=0,seconds since begin=34,seconds left=
              >
              > 30,activeThread=Thread[ExecuteThread: '9' for queue: 'default',5,Thread
              > Group for Queue: 'default'],ServerResourceInfo[JMS_hmJD
              >
              > BCStore]=(state=started,assigned=none),SCInfo[wlcsDomain+wlcsServer]=(state=
              > active),OwnerTransactionManager=ServerTM[ServerCoor
              >
              > dinatorDescriptor=(CoordinatorURL=wlcsServer+155.14.3.140:7501+wlcsDomain+,
              > Resources={})],CoordinatorURL=wlcsServer+155.14.3.1
              >
              > 40:7501+wlcsDomain+)]
              >
              > java.lang.IllegalStateException: Cannot mark the transaction for rollback.
              > xid=64:bea55f200db2c786, status=Rolled back. [Reason
              >
              > =weblogic.transaction.internal.TimedOutException: Transaction timed out
              > after 34 seconds
              >
              > Xid=64:bea55f200db2c786(-33600248),Status=Active,numRepliesOwedMe=0,numRepli
              > esOwedOthers=0,seconds since begin=34,seconds left=
              >
              > 30,activeThread=Thread[ExecuteThread: '9' for queue: 'default',5,Thread
              > Group for Queue: 'default'],ServerResourceInfo[JMS_hmJD
              >
              > BCStore]=(state=started,assigned=none),SCInfo[wlcsDomain+wlcsServer]=(state=
              > active),OwnerTransactionManager=ServerTM[ServerCoor
              >
              > dinatorDescriptor=(CoordinatorURL=wlcsServer+155.14.3.140:7501+wlcsDomain+,
              > Resources={})],CoordinatorURL=wlcsServer+155.14.3.1
              >
              > 40:7501+wlcsDomain+)]
              >
              > at
              > weblogic.transaction.internal.TransactionImpl.throwIllegalStateException(Tra
              > nsactionImpl.java:1486)
              >
              > at
              > weblogic.transaction.internal.TransactionImpl.setRollbackOnly(TransactionImp
              > l.java:466)
              >
              > at
              > weblogic.ejb20.manager.BaseEJBManager.handleSystemException(BaseEJBManager.j
              > ava:255)
              >
              > at
              > weblogic.ejb20.manager.BaseEJBManager.setupTxListener(BaseEJBManager.java:21
              > 5)
              >
              > at
              > weblogic.ejb20.manager.StatelessManager.preInvoke(StatelessManager.java:153)
              >
              > at
              > weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:117)
              >
              > at
              > weblogic.ejb20.internal.StatelessEJBObject.preInvoke(StatelessEJBObject.java
              > :63)
              >
              > at
              > com.xoriant.hm.ejb.session.HierarchyManagerBean_fzysig_EOImpl.getHierarchyId
              > (HierarchyManagerBean_fzysig_EOImpl.java
              >
              > :1477)
              >
              > at
              > com.ebiz.application.customerprofile.hm.CPXHMController.SynchronizeMHTH(Unkn
              > own Source)
              >
              > at
              > com.ebiz.application.customerprofile.hm.CPHMOrgGroupMsgBean.onMessage(Unknow
              > n Source)
              >
              > at weblogic.ejb20.internal.MDListener.execute(MDListener.java:254)
              >
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              >
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              >
              >
              >
              

  • Should EntryProcessors be used for long-running operations?

    Hi Gene and All,
         a couple of other questions come from the seemingly unexhaustible list :-)
         - what happens if the caller of an InvocableMap.invokeAll or invoke method dies?
         - all entryProcessors complete regardless of the client being there or not
         - all already started process method calls complete, the unprocessed entries will not get processed
         - something else happens
         - what happens if the caller of an InvocableMap.aggregate method with a parallel-aggregator dies
         - all aggregate methods in the parallel-aggregator complete
         - the aggregate methods in the parallel-aggregator stop during processing
         - something else happens
         - should an entryprocessor or a parallel-aware entryaggregator implement a comparably long-running operation (e.g. jdbc access), or does that seriously affect performance of other concurrent operations within the cluster node or the entire cluster (e.g. becuase of blocking other events/requests)?
         - should the work manager be used instead for these kinds of things (e.g. jdbc access)?
         Thanks and best regards,
         Robert

    Robert,
         As soon as an EntryProcessor or EntryAggregator get delivered to the server nodes, it will get executed regardless of the requestor's state.
         In regard to long-running operations the only thing you have to be conscious about is a number of worker threads allocated for such a processing. Since there is a single client thread issuing a request, it would suggests allocation as many worker threads (across the cache server tier) as there are client thread (across the presentation/application tier).
         Regards,
         Gene

  • Long running servlet in a single node of a cluster

    Good evening,
    I am developing a J2EE application that consists of a number of web services that perform background processing of relatively long-running jobs.  Status of the jobs actually need to be reported back to the SAP ABAP system, which we do via JCo.  All communication back to ABAP occurs in a single long-running, JMS driven servlet.  This callback servlet uses both a timestamp (last time status was sent back) or a  count of status events to determine when to send data to the ABAP system.
    All of this works great in a single Java instance J2EE configuration.  However, when we introduce clustering into the configuration, we get one instance of the callback servlet per J2EE server process.  Is there an easy way to configure the servlet so that it only runs on a single J2EE server process in one instance?
    TIA,
    - Bill

    Hi Bill,
    Launching manually threads even from a web container is also not recommended as good J2EE practice.
    If each applications launches its own set of threads that may easily crash the server. Another drawback of such long running servlet is that you are blocking application thread from the server. One last point - it seems that you are storing the data in the servlet at some intermediate variables without any persistance. What will happen if the server crashes ? Can you afford to loose the data ?
    I am not implying that you launch threads from the MDB. I am just saying that you could define that single MDB and send messages directly to it. You do the job there inside the onMessage, no new thread. You will be guaranteed that no other call will be executed. You are guaranteed nothing will be lost in case server crashes, you will not use resources even if there is no traffic.
    Btw, please feel free to give me a phone call or write an email to further discuss the issue. You can take the details from your CSN I am currently processing
    Best Regards
    Peter

Maybe you are looking for