[jboss-svn-commits] JBL Code SVN: r20343 - in labs/jbossrules/trunk: drools-core/src/main/java/org/drools/common and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jun 5 15:43:42 EDT 2008
Author: tirelli
Date: 2008-06-05 15:43:41 -0400 (Thu, 05 Jun 2008)
New Revision: 20343
Added:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/SessionPseudoClock.java
Modified:
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SerializationHelper.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/Scheduler.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/MarshallerWriteContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/process/instance/timer/TimerManager.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimerServiceFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/impl/PseudoClockScheduler.java
labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/impl/JDKTimerServiceTest.java
Log:
Fixing session clock usage
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -5,6 +5,7 @@
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -61,7 +62,7 @@
return ruleBase;
}
- public void FIXME_testEventAssertion() throws Exception {
+ public void testEventAssertion() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertion.drl" ) );
RuleBase ruleBase = loadRuleBase( reader );
@@ -116,7 +117,7 @@
}
- public void FIXME_testEventAssertionWithDuration() throws Exception {
+ public void testEventAssertionWithDuration() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertionWithDuration.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
@@ -187,7 +188,7 @@
}
- public void FIXME_testTimeRelationalOperators() throws Exception {
+ public void testTimeRelationalOperators() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_TimeRelationalOperators.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
@@ -282,17 +283,17 @@
3 );
InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
- clock.advanceTime( 4 );
+ clock.advanceTime( 4, TimeUnit.MILLISECONDS );
InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
- clock.advanceTime( 4 );
+ clock.advanceTime( 4, TimeUnit.MILLISECONDS );
InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
- clock.advanceTime( 4 );
+ clock.advanceTime( 4, TimeUnit.MILLISECONDS );
InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
InternalFactHandle handle5 = (InternalFactHandle) wm.insert( tick5 );
- clock.advanceTime( 1 );
+ clock.advanceTime( 1, TimeUnit.MILLISECONDS );
InternalFactHandle handle6 = (InternalFactHandle) wm.insert( tick6 );
InternalFactHandle handle7 = (InternalFactHandle) wm.insert( tick7 );
- clock.advanceTime( 2 );
+ clock.advanceTime( 2, TimeUnit.MILLISECONDS );
InternalFactHandle handle8 = (InternalFactHandle) wm.insert( tick8 );
assertNotNull( handle1 );
@@ -405,7 +406,7 @@
// how to configure the clock?
PseudoClockScheduler clock = (PseudoClockScheduler) wm.getSessionClock();
- clock.advanceTime( 5000 ); // 5 seconds
+ clock.advanceTime( 5, TimeUnit.SECONDS ); // 5 seconds
EventFactHandle handle1 = (EventFactHandle) wm.insert( new OrderEvent( "1",
"customer A",
70 ) );
@@ -423,7 +424,7 @@
((Number) results.get( 0 )).intValue() );
// advance clock and assert new data
- clock.advanceTime( 10000 ); // 10 seconds
+ clock.advanceTime( 10, TimeUnit.SECONDS ); // 10 seconds
EventFactHandle handle2 = (EventFactHandle) wm.insert( new OrderEvent( "2",
"customer A",
60 ) );
@@ -440,7 +441,7 @@
((Number) results.get( 1 )).intValue() );
// advance clock and assert new data
- clock.advanceTime( 10000 ); // 10 seconds
+ clock.advanceTime( 10, TimeUnit.SECONDS ); // 10 seconds
EventFactHandle handle3 = (EventFactHandle) wm.insert( new OrderEvent( "3",
"customer A",
50 ) );
@@ -457,7 +458,7 @@
((Number) results.get( 2 )).intValue() );
// advance clock and assert new data
- clock.advanceTime( 10000 ); // 10 seconds
+ clock.advanceTime( 10, TimeUnit.SECONDS ); // 10 seconds
EventFactHandle handle4 = (EventFactHandle) wm.insert( new OrderEvent( "4",
"customer A",
25 ) );
@@ -473,7 +474,7 @@
results.size() );
// advance clock and assert new data
- clock.advanceTime( 10000 ); // 10 seconds
+ clock.advanceTime( 10, TimeUnit.SECONDS ); // 10 seconds
EventFactHandle handle5 = (EventFactHandle) wm.insert( new OrderEvent( "5",
"customer A",
70 ) );
@@ -490,7 +491,7 @@
results.size() );
// advance clock and assert new data
- clock.advanceTime( 10000 ); // 10 seconds
+ clock.advanceTime( 10, TimeUnit.SECONDS ); // 10 seconds
EventFactHandle handle6 = (EventFactHandle) wm.insert( new OrderEvent( "6",
"customer A",
115 ) );
@@ -522,7 +523,4 @@
//
// }
- public void testDummy() {
- }
-
}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SerializationHelper.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SerializationHelper.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SerializationHelper.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -1,16 +1,15 @@
package org.drools.integrationtests;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
import org.drools.RuleBase;
import org.drools.StatefulSession;
import org.drools.marshalling.DefaultMarshaller;
import org.drools.marshalling.Marshaller;
-import org.drools.reteoo.ReteooRuleBase;
import org.drools.util.DroolsStreamUtils;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
/**
* Marshalling helper class to perform serialize/de-serialize a given object
*/
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -50,7 +50,6 @@
import org.drools.RuleBaseConfiguration.AssertBehaviour;
import org.drools.RuleBaseConfiguration.LogicalOverride;
import org.drools.base.MapGlobalResolver;
-import org.drools.base.ShadowProxy;
import org.drools.concurrent.ExecutorService;
import org.drools.event.AgendaEventListener;
import org.drools.event.AgendaEventSupport;
@@ -68,7 +67,6 @@
import org.drools.process.instance.ProcessInstanceManager;
import org.drools.process.instance.WorkItemManager;
import org.drools.process.instance.context.variable.VariableScopeInstance;
-import org.drools.process.instance.impl.DefaultProcessInstanceManager;
import org.drools.process.instance.timer.TimerManager;
import org.drools.reteoo.EntryPointNode;
import org.drools.reteoo.InitialFactHandle;
@@ -89,6 +87,7 @@
import org.drools.spi.PropagationContext;
import org.drools.time.SessionClock;
import org.drools.time.TimerService;
+import org.drools.time.TimerServiceFactory;
/**
* Implementation of <code>WorkingMemory</code>.
@@ -250,6 +249,9 @@
this.liaPropagations = Collections.EMPTY_LIST;
this.processInstanceManager = conf.getProcessInstanceManager();
this.timeMachine = new TimeMachine();
+
+ TimerService timerService = TimerServiceFactory.getTimerService( this.config.getClockType() );
+ this.timerManager = new TimerManager(this, timerService);
this.nodeMemories = new ConcurrentNodeMemories( this.ruleBase );
@@ -1523,9 +1525,6 @@
}
public TimerManager getTimerManager() {
- if ( timerManager == null ) {
- timerManager = new TimerManager( this );
- }
return timerManager;
}
@@ -1624,11 +1623,11 @@
}
public TimerService getTimerService() {
- return this.timerManager.getTimerService();
+ return this.getTimerManager().getTimerService();
}
public SessionClock getSessionClock() {
- return (SessionClock) this.timerManager.getTimerService();
+ return (SessionClock) this.getTimerManager().getTimerService();
}
// public static class FactHandleInvalidation implements WorkingMemoryAction {
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/Scheduler.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/Scheduler.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/Scheduler.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -17,13 +17,13 @@
*/
import org.drools.Agenda;
+import org.drools.ClockType;
import org.drools.process.instance.timer.TimerManager.TimerTrigger;
import org.drools.time.Job;
import org.drools.time.JobContext;
import org.drools.time.JobHandle;
import org.drools.time.TimerService;
import org.drools.time.TimerServiceFactory;
-import org.drools.time.impl.JDKTimerService;
/**
* Scheduler for rules requiring truth duration.
@@ -66,7 +66,8 @@
* Construct.
*/
private Scheduler() {
- this.timerService = TimerServiceFactory.getTimerService();
+ // FIXME: must use the session timer service
+ this.timerService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME );
}
/**
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -32,14 +32,11 @@
import org.drools.reteoo.BetaNode;
import org.drools.reteoo.EntryPointNode;
import org.drools.reteoo.EvalConditionNode;
-import org.drools.reteoo.ExistsNode;
import org.drools.reteoo.InitialFactHandle;
import org.drools.reteoo.InitialFactHandleDummyObject;
-import org.drools.reteoo.JoinNode;
import org.drools.reteoo.LeftTuple;
import org.drools.reteoo.LeftTupleSink;
import org.drools.reteoo.NodeTypeEnums;
-import org.drools.reteoo.NotNode;
import org.drools.reteoo.ObjectTypeNode;
import org.drools.reteoo.ReteooStatefulSession;
import org.drools.reteoo.ReteooWorkingMemory;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/MarshallerWriteContext.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/MarshallerWriteContext.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/MarshallerWriteContext.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -7,8 +7,6 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -1,7 +1,9 @@
package org.drools.marshalling;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
+import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
@@ -14,7 +16,6 @@
import org.drools.InitialFact;
import org.drools.base.ClassObjectType;
-import org.drools.base.ShadowProxy;
import org.drools.common.AgendaItem;
import org.drools.common.DefaultAgenda;
import org.drools.common.EqualityKey;
@@ -29,13 +30,9 @@
import org.drools.process.instance.ProcessInstance;
import org.drools.process.instance.WorkItem;
import org.drools.process.instance.context.variable.VariableScopeInstance;
-import org.drools.reteoo.EvalConditionNode;
-import org.drools.reteoo.ExistsNode;
-import org.drools.reteoo.JoinNode;
import org.drools.reteoo.LeftTuple;
import org.drools.reteoo.LeftTupleSink;
import org.drools.reteoo.NodeTypeEnums;
-import org.drools.reteoo.NotNode;
import org.drools.reteoo.ObjectTypeNode;
import org.drools.reteoo.ReteooWorkingMemory;
import org.drools.reteoo.RightTuple;
@@ -59,11 +56,13 @@
public class OutputMarshaller {
public static void writeSession(MarshallerWriteContext context) throws IOException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ PrintWriter out = new PrintWriter( buffer );
ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;
context.writeInt( wm.getFactHandleFactory().getId() );
context.writeLong( wm.getFactHandleFactory().getRecency() );
- System.out.println( "FactHandleFactory int:" + wm.getFactHandleFactory().getId() + " long:" + wm.getFactHandleFactory().getRecency() );
+ out.println( "FactHandleFactory int:" + wm.getFactHandleFactory().getId() + " long:" + wm.getFactHandleFactory().getRecency() );
InternalFactHandle handle = context.wm.getInitialFactHandle();
context.writeInt( handle.getId() );
@@ -71,7 +70,7 @@
context.out.println( "InitialFact int:" + handle.getId() + " long:" + handle.getRecency() );
context.writeLong( wm.getPropagationIdCounter() );
- System.out.println( "PropagationCounter long:" + wm.getPropagationIdCounter() );
+ out.println( "PropagationCounter long:" + wm.getPropagationIdCounter() );
writeAgenda( context );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/process/instance/timer/TimerManager.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/process/instance/timer/TimerManager.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/process/instance/timer/TimerManager.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -9,7 +9,6 @@
import org.drools.time.JobContext;
import org.drools.time.JobHandle;
import org.drools.time.TimerService;
-import org.drools.time.TimerServiceFactory;
import org.drools.time.Trigger;
public class TimerManager {
@@ -18,9 +17,9 @@
private WorkingMemory workingMemory;
private TimerService timerService;
- public TimerManager(WorkingMemory workingMemory) {
+ public TimerManager(WorkingMemory workingMemory, TimerService timerService) {
this.workingMemory = workingMemory;
- this.timerService = TimerServiceFactory.getTimerService();
+ this.timerService = timerService;
}
public void registerTimer(final Timer timer,
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -236,7 +236,8 @@
ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.config.getExecutorService() );;
session = new ReteooStatefulSession( nextWorkingMemoryCounter(),
this,
- executor );
+ executor,
+ sessionConfig );
executor.setCommandExecutor( new CommandExecutor( session ) );
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/SessionPseudoClock.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/SessionPseudoClock.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/SessionPseudoClock.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2007 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Oct 17, 2007
+ */
+package org.drools.time;
+
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * A clock interface for the implementation of pseudo clocks,
+ * that are clocks where the user have control over the actual
+ * clock working.
+ *
+ * Pseudo clocks are particularly useful for simulations,
+ * "what if" scenario runs, and for tests.
+ *
+ * @author etirelli
+ */
+public interface SessionPseudoClock extends SessionClock {
+
+ /**
+ * Advances the clock time in the specified unit amount.
+ *
+ * @param amount the amount of units to advance in the clock
+ * @param unit the used time unit
+ * @return the current absolute timestamp
+ */
+ public long advanceTime( long amount, TimeUnit unit );
+
+}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimerServiceFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimerServiceFactory.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimerServiceFactory.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -1,11 +1,18 @@
package org.drools.time;
+import org.drools.ClockType;
import org.drools.time.impl.JDKTimerService;
+import org.drools.time.impl.PseudoClockScheduler;
public class TimerServiceFactory {
- private static TimerService timerService = new JDKTimerService();
- public static TimerService getTimerService() {
- return timerService;
+ public static TimerService getTimerService( ClockType type ) {
+ switch( type ) {
+ case REAL_TIME:
+ return new JDKTimerService();
+ case PSEUDO_CLOCK:
+ return new PseudoClockScheduler();
+ }
+ return null;
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/impl/PseudoClockScheduler.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/impl/PseudoClockScheduler.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/impl/PseudoClockScheduler.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -24,13 +24,14 @@
import java.util.Date;
import java.util.PriorityQueue;
import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
import org.drools.common.DroolsObjectInputStream;
import org.drools.common.InternalWorkingMemory;
import org.drools.time.Job;
import org.drools.time.JobContext;
import org.drools.time.JobHandle;
-import org.drools.time.SessionClock;
+import org.drools.time.SessionPseudoClock;
import org.drools.time.TimerService;
import org.drools.time.Trigger;
@@ -44,7 +45,7 @@
public class PseudoClockScheduler
implements
TimerService,
- SessionClock {
+ SessionPseudoClock {
private volatile long timer;
private PriorityQueue<ScheduledJob> queue;
@@ -117,8 +118,12 @@
return this.queue.remove( ((DefaultJobHandle) jobHandle).getJob() );
}
- public synchronized long advanceTime(long millisecs) {
- this.timer += millisecs;
+ /**
+ * @inheritDoc
+ */
+ public long advanceTime(long amount,
+ TimeUnit unit) {
+ this.timer += unit.toMillis( amount );
this.runCallBacks();
return this.timer;
}
Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/impl/JDKTimerServiceTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/impl/JDKTimerServiceTest.java 2008-06-05 17:09:22 UTC (rev 20342)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/impl/JDKTimerServiceTest.java 2008-06-05 19:43:41 UTC (rev 20343)
@@ -7,6 +7,7 @@
import junit.framework.TestCase;
+import org.drools.ClockType;
import org.drools.time.Job;
import org.drools.time.JobContext;
import org.drools.time.JobHandle;
@@ -17,7 +18,7 @@
public class JDKTimerServiceTest extends TestCase {
public void testSingleExecutionJob() throws Exception {
- TimerService timeService = TimerServiceFactory.getTimerService();
+ TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME );
Trigger trigger = new DelayedTrigger( 100 );
HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
timeService.scheduleJob( new HelloWorldJob(), ctx, trigger);
@@ -26,7 +27,7 @@
}
public void testRepeatedExecutionJob() throws Exception {
- TimerService timeService = TimerServiceFactory.getTimerService();
+ TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME );
Trigger trigger = new DelayedTrigger( new long[] { 100, 100, 100} );
HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
timeService.scheduleJob( new HelloWorldJob(), ctx, trigger);
@@ -37,7 +38,7 @@
public void testRepeatedExecutionJobWithRemove() throws Exception {
- TimerService timeService = TimerServiceFactory.getTimerService();
+ TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME );
Trigger trigger = new DelayedTrigger( new long[] { 100, 100, 100, 100, 100 } );
HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
ctx.setLimit( 3 );
More information about the jboss-svn-commits
mailing list