cancel
Showing results for 
Search instead for 
Did you mean: 

Servcietask‘s Transaction Problem

yuhu84
Champ in-the-making
Champ in-the-making
I use a Servicetask to complete some work.
but when the task takes too long time to end,there happened some exception:connection had been closed !
I found that because of transation,so i use a thread to finish the work
I write MyServiceServiceeTask extends TaskActivityBehavior ,such as

        @Override
   public void signal(ActivityExecution execution, String signalName,
         Object signalData) throws Exception {
      leave(execution);
   }

       @Override
   public void execute(ActivityExecution execution) throws Exception {
      //this is need
      execution.getVariables();
                Thread t = new AsynRunThread(execution);
      t.start();
   }

and at the end of thread,I call signal method to leave this task.
there some times happened that task finished but table act_hi_actinst's end_time_ is null
because Thread sometime finished before the Main class(MyServiceServiceeTask)'s transaction end

who encoutered this problem or give me some advices
1 REPLY 1

trademak
Star Contributor
Star Contributor
When you get an exception is this circumstances, it's due to your database closing the connecting because it has been open for too long. So you can change your database settings to allow a longer period of time for your connections. How much time are we talking about?
For the issue of the end time, can you create a unit test showing this issue?

Best regards,