Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-4435

Timers fail when ContainerManagedTransactions are being used

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • jBPM 6.2.0.Final
    • jBPM 6.1.0.Final
    • Runtime Engine
    • None

      When container managed transactions are selected, no transaction is present when a timer is fired, causing an exception to be thrown.

      Workaround:

      Extend ThreadPoolSchedulerService, overriding internalSchedule(), wrapping Callable item in a callable that will wrap the call in a transaction. This service must then be set in the RuntimeEngineBuilder.

      i.e.:

      private class TxCallable implements Callable<Void> {
      		
      		private Callable<?> delegate;
      		
      		public TxCallable(Callable<?> delegate) {
      			this.delegate = delegate;
      		}
      
      		@Override
      		public Void call() throws Exception {
      			ut.begin();
      			try {
      				delegate.call();
      				
      				ut.commit();
      			} catch (Exception e) {
      				ut.rollback();
      			}
      			return null;
      		}
      		
      	}
      

              swiderski.maciej Maciej Swiderski (Inactive)
              jblinick_jira Josh B (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: