Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

JBPM-3947/BZ869289 - Process persistent timers

  • Loading branch information...
commit b2719c403af24bb4e04eae19332337eb0baf585d 1 parent 95c7f29
@mswiderski mswiderski authored
View
7 drools-core/src/main/java/org/drools/core/SessionConfiguration.java
@@ -447,14 +447,19 @@ public TimerService newTimerService() {
try {
return clazz.newInstance();
} catch ( Exception e ) {
+
throw new IllegalArgumentException(
"Unable to instantiate timer service '" + className
+ "'",
e );
}
} else {
- throw new IllegalArgumentException( "Timer service '" + className
+ try {
+ return (TimerService) MVEL.eval(className);
+ } catch (Exception e) {
+ throw new IllegalArgumentException( "Timer service '" + className
+ "' not found" );
+ }
}
}
View
2  drools-core/src/main/java/org/drools/core/marshalling/impl/OutputMarshaller.java
@@ -172,7 +172,7 @@ public static void writeSession(MarshallerWriteContext context) throws IOExcepti
}
// Only works for JpaJDKTimerService
- writeTimers( context.wm.getTimerService().getTimerJobInstances(), context );
+ writeTimers( context.wm.getTimerService().getTimerJobInstances(context.wm.getId()), context );
//context.out.println( "--- write session --- END");
}
View
6 drools-core/src/main/java/org/drools/core/marshalling/impl/ProtobufOutputMarshaller.java
@@ -173,7 +173,7 @@ public static void writeSession(MarshallerWriteContext context) throws IOExcepti
_session.setProcessData( _pdata.build() );
}
- Timers _timers = writeTimers( context.wm.getTimerService().getTimerJobInstances(),
+ Timers _timers = writeTimers( context.wm.getTimerService().getTimerJobInstances(context.wm.getId()),
context );
if ( _timers != null ) {
_session.setTimers( _timers );
@@ -730,7 +730,9 @@ public int compare(TimerJobInstance o1,
JobContext jctx = ((SelfRemovalJobContext) timer.getJobContext()).getJobContext();
TimersOutputMarshaller writer = outCtx.writersByClass.get( jctx.getClass() );
Timer _timer = writer.serialize( jctx, outCtx );
- _timers.addTimer( _timer );
+ if (_timer != null) {
+ _timers.addTimer( _timer );
+ }
}
return _timers.build();
}
View
6 drools-core/src/main/java/org/drools/core/time/SelfRemovalJob.java
@@ -1,6 +1,10 @@
package org.drools.core.time;
-public class SelfRemovalJob implements Job {
+import java.io.Serializable;
+
+public class SelfRemovalJob implements Job, Serializable {
+
+ private static final long serialVersionUID = 8876468420174364422L;
private Job job;
public SelfRemovalJob(Job job) {
View
2  drools-core/src/main/java/org/drools/core/time/TimerService.java
@@ -52,6 +52,6 @@
* This method may return null for some TimerService implementations that do not want the overhead of maintain this.
* @return
*/
- public Collection<TimerJobInstance> getTimerJobInstances();
+ public Collection<TimerJobInstance> getTimerJobInstances(int id);
}
View
3  drools-core/src/main/java/org/drools/core/time/impl/DefaultJobHandle.java
@@ -16,6 +16,7 @@
package org.drools.core.time.impl;
+import java.io.Serializable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.drools.core.time.JobHandle;
@@ -25,7 +26,7 @@
*/
public class DefaultJobHandle
implements
- JobHandle {
+ JobHandle, Serializable {
private static final long serialVersionUID = 510l;
View
7 drools-core/src/main/java/org/drools/core/time/impl/DefaultTimerJobInstance.java
@@ -1,5 +1,6 @@
package org.drools.core.time.impl;
+import java.io.Serializable;
import java.util.Date;
import java.util.concurrent.Callable;
@@ -15,14 +16,16 @@
implements
Callable<Void>,
Comparable<DefaultTimerJobInstance>,
- TimerJobInstance {
+ TimerJobInstance, Serializable {
+
+ private static final long serialVersionUID = -4441139572159254264L;
protected static transient Logger logger = LoggerFactory.getLogger(DefaultTimerJobInstance.class);
private final Job job;
private final Trigger trigger;
private final JobContext ctx;
- protected final InternalSchedulerService scheduler;
+ protected transient InternalSchedulerService scheduler;
private final JobHandle handle;
public DefaultTimerJobInstance(Job job,
View
2  drools-core/src/main/java/org/drools/core/time/impl/JDKTimerService.java
@@ -160,7 +160,7 @@ public long getTimeToNextJob() {
return 0;
}
- public Collection<TimerJobInstance> getTimerJobInstances() {
+ public Collection<TimerJobInstance> getTimerJobInstances(int id) {
return jobFactoryManager.getTimerJobInstances();
}
View
2  drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java
@@ -227,7 +227,7 @@ public long getTimeToNextJob() {
}
}
- public Collection<TimerJobInstance> getTimerJobInstances() {
+ public Collection<TimerJobInstance> getTimerJobInstances(int id) {
return jobFactoryManager.getTimerJobInstances();
}
View
1  drools-persistence-jpa/src/main/java/org/drools/persistence/SingleSessionCommandService.java
@@ -118,7 +118,6 @@ public SingleSessionCommandService(KieBase kbase,
// Use the App scoped EntityManager if the user has provided it, and it is open.
// - open the entity manager before the transaction begins.
PersistenceContext persistenceContext = jpm.getApplicationScopedPersistenceContext();
-
boolean transactionOwner = false;
try {
transactionOwner = txm.begin();
Please sign in to comment.
Something went wrong with that request. Please try again.