[jboss-svn-commits] JBL Code SVN: r23430 - in labs/jbossrules/trunk/drools-core/src: main/java/org/drools/common and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Oct 12 18:38:02 EDT 2008


Author: tirelli
Date: 2008-10-12 18:38:01 -0400 (Sun, 12 Oct 2008)
New Revision: 23430

Added:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/Interval.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimeUtils.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/TemporalDistanceTest.java
Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ClockType.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/Scheduler.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimerServiceFactory.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/impl/JDKTimerServiceTest.java
Log:
Adding algorithm for temporal distance calculation

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ClockType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ClockType.java	2008-10-12 15:29:56 UTC (rev 23429)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/ClockType.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -28,32 +28,44 @@
  */
 public enum ClockType {
 
-    REAL_TIME {
-        public SessionClock createInstance() {
+    REALTIME_CLOCK("realtime") {
+        public JDKTimerService createInstance() {
             return new JDKTimerService();
         }
     },
 
     /**
-     * A Pseudo clock is a clock that is completely controled by the
+     * A Pseudo clock is a clock that is completely controlled by the
      * client application. It is usually used during simulations or tests
      */
-    PSEUDO_CLOCK {
-        public SessionClock createInstance() {
+    PSEUDO_CLOCK("pseudo") {
+        public PseudoClockScheduler createInstance() {
             return new PseudoClockScheduler();
         }
     };
 
     public abstract SessionClock createInstance();
     
+    private String string;
+    ClockType( String string ) {
+        this.string = string;
+    }
+    
+    public String toString() {
+        return this.string;
+    }
+    
+    public String getId() {
+        return this.string;
+    }
+    
     public static ClockType resolveClockType( String id ) {
-        ClockType clock = REAL_TIME;
-        if( "pseudo".equalsIgnoreCase( id ) ) {
-            clock = PSEUDO_CLOCK;
-        } else if( "realtime".equalsIgnoreCase( id ) ) {
-            clock = REAL_TIME;
+        if( PSEUDO_CLOCK.getId().equalsIgnoreCase( id ) ) {
+            return PSEUDO_CLOCK;
+        } else if( REALTIME_CLOCK.getId().equalsIgnoreCase( id ) ) {
+            return REALTIME_CLOCK;
         }
-        return clock;
+        throw new IllegalArgumentException( "Illegal enum value '" + id + "' for ClockType" );
     }
 
 }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java	2008-10-12 15:29:56 UTC (rev 23429)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -118,11 +118,13 @@
     private ConsequenceExceptionHandler    consequenceExceptionHandler;
     private String                         ruleBaseUpdateHandler;
 
+    private EventProcessingMode            eventProcessingMode;
+
     // if "true", rulebase builder will try to split 
     // the rulebase into multiple partitions that can be evaluated
     // in parallel by using multiple internal threads
     private boolean                        multithread;
-    private int  	                       maxThreads;
+    private int                            maxThreads;
 
     private ConflictResolver               conflictResolver;
 
@@ -163,6 +165,7 @@
         out.writeBoolean( advancedProcessRuleIntegration );
         out.writeBoolean( multithread );
         out.writeInt( maxThreads );
+        out.writeObject( eventProcessingMode );
     }
 
     public void readExternal(ObjectInput in) throws IOException,
@@ -189,6 +192,7 @@
         advancedProcessRuleIntegration = in.readBoolean();
         multithread = in.readBoolean();
         maxThreads = in.readInt();
+        eventProcessingMode = (EventProcessingMode) in.readObject();
     }
 
     /**
@@ -315,8 +319,10 @@
         setMultithreadEvaluation( Boolean.valueOf( this.chainedProperties.getProperty( "drools.multithreadEvaluation",
                                                                                        "false" ) ).booleanValue() );
 
-         setMaxThreads( Integer.parseInt( this.chainedProperties.getProperty( "drools.maxThreads",
-                                                                              "-1" ) ) );
+        setMaxThreads( Integer.parseInt( this.chainedProperties.getProperty( "drools.maxThreads",
+                                                                             "-1" ) ) );
+        setEventProcessingMode( EventProcessingMode.determineAssertBehaviour( this.chainedProperties.getProperty( "drools.eventProcessingMode",
+                                                                                                                  "cloud" ) ) );
     }
 
     /**
@@ -404,6 +410,15 @@
         this.assertBehaviour = assertBehaviour;
     }
 
+    public EventProcessingMode getEventProcessingMode() {
+        return this.eventProcessingMode;
+    }
+
+    public void setEventProcessingMode(final EventProcessingMode mode) {
+        checkCanChange(); // throws an exception if a change isn't possible;
+        this.eventProcessingMode = mode;
+    }
+
     public int getCompositeKeyDepth() {
         return this.compositeKeyDepth;
     }
@@ -514,7 +529,7 @@
         checkCanChange();
         this.multithread = enableMultithread;
     }
-    
+
     /**
      * Returns true if the partitioning of the rulebase is enabled
      * and false otherwise. Default is false.
@@ -524,7 +539,7 @@
     public boolean isMultithreadEvaluation() {
         return this.multithread;
     }
-    
+
     /**
      * If multi-thread evaluation is enabled, this parameter configures the 
      * maximum number of threads each session can use for concurrent Rete
@@ -535,10 +550,10 @@
      *                   of threads equal to the number of partitions in the
      *                   rule base. Default number of threads is 0. 
      */
-    public void setMaxThreads( final int maxThreads ) {
-    	this.maxThreads = maxThreads;
+    public void setMaxThreads(final int maxThreads) {
+        this.maxThreads = maxThreads;
     }
-    
+
     /**
      * Returns the configured number of maximum threads to use for concurrent
      * propagation when multi-thread evaluation is enabled. Default is zero.
@@ -546,7 +561,7 @@
      * @return
      */
     public int getMaxThreads() {
-    	return this.maxThreads;
+        return this.maxThreads;
     }
 
     private void initProcessNodeInstanceFactoryRegistry() {
@@ -745,12 +760,13 @@
     }
 
     @SuppressWarnings("unchecked")
-	private void loadWorkItemHandlers(String location) {
+    private void loadWorkItemHandlers(String location) {
         String content = ConfFileUtils.URLContentsToString( ConfFileUtils.getURL( location,
                                                                                   null,
                                                                                   RuleBaseConfiguration.class ) );
-        Map<String, WorkItemHandler> workItemHandlers = (Map<String, WorkItemHandler>) MVEL.eval( content, new HashMap() );
-        this.workItemHandlers.putAll(workItemHandlers);
+        Map<String, WorkItemHandler> workItemHandlers = (Map<String, WorkItemHandler>) MVEL.eval( content,
+                                                                                                  new HashMap() );
+        this.workItemHandlers.putAll( workItemHandlers );
     }
 
     public ContextInstanceFactoryRegistry getProcessContextInstanceFactoryRegistry() {
@@ -810,20 +826,18 @@
     }
 
     @SuppressWarnings("unchecked")
-	private void initProcessInstanceManagerFactory() {
+    private void initProcessInstanceManagerFactory() {
         String className = this.chainedProperties.getProperty( "processInstanceManagerFactory",
                                                                "org.drools.process.instance.impl.DefaultProcessInstanceManagerFactory" );
         Class<ProcessInstanceManagerFactory> clazz = null;
         try {
-            clazz = (Class<ProcessInstanceManagerFactory>)
-            	Thread.currentThread().getContextClassLoader().loadClass( className );
+            clazz = (Class<ProcessInstanceManagerFactory>) Thread.currentThread().getContextClassLoader().loadClass( className );
         } catch ( ClassNotFoundException e ) {
         }
 
         if ( clazz == null ) {
             try {
-                clazz = (Class<ProcessInstanceManagerFactory>)
-                	RuleBaseConfiguration.class.getClassLoader().loadClass( className );
+                clazz = (Class<ProcessInstanceManagerFactory>) RuleBaseConfiguration.class.getClassLoader().loadClass( className );
             } catch ( ClassNotFoundException e ) {
             }
         }
@@ -847,20 +861,18 @@
     }
 
     @SuppressWarnings("unchecked")
-	private void initSignalManagerFactory() {
+    private void initSignalManagerFactory() {
         String className = this.chainedProperties.getProperty( "processSignalManagerFactory",
                                                                "org.drools.process.instance.event.DefaultSignalManagerFactory" );
         Class<SignalManagerFactory> clazz = null;
         try {
-            clazz = (Class<SignalManagerFactory>)
-            	Thread.currentThread().getContextClassLoader().loadClass( className );
+            clazz = (Class<SignalManagerFactory>) Thread.currentThread().getContextClassLoader().loadClass( className );
         } catch ( ClassNotFoundException e ) {
         }
 
         if ( clazz == null ) {
             try {
-                clazz = (Class<SignalManagerFactory>)
-                	RuleBaseConfiguration.class.getClassLoader().loadClass( className );
+                clazz = (Class<SignalManagerFactory>) RuleBaseConfiguration.class.getClassLoader().loadClass( className );
             } catch ( ClassNotFoundException e ) {
             }
         }
@@ -884,20 +896,18 @@
     }
 
     @SuppressWarnings("unchecked")
-	private void initWorkItemManagerFactory() {
+    private void initWorkItemManagerFactory() {
         String className = this.chainedProperties.getProperty( "workItemManagerFactory",
                                                                "org.drools.process.instance.impl.DefaultWorkItemManagerFactory" );
         Class<WorkItemManagerFactory> clazz = null;
         try {
-            clazz = (Class<WorkItemManagerFactory>)
-            	Thread.currentThread().getContextClassLoader().loadClass( className );
+            clazz = (Class<WorkItemManagerFactory>) Thread.currentThread().getContextClassLoader().loadClass( className );
         } catch ( ClassNotFoundException e ) {
         }
 
         if ( clazz == null ) {
             try {
-                clazz = (Class<WorkItemManagerFactory>)
-                	RuleBaseConfiguration.class.getClassLoader().loadClass( className );
+                clazz = (Class<WorkItemManagerFactory>) RuleBaseConfiguration.class.getClassLoader().loadClass( className );
             } catch ( ClassNotFoundException e ) {
             }
         }
@@ -906,7 +916,8 @@
             try {
                 this.workItemManagerFactory = clazz.newInstance();
             } catch ( Exception e ) {
-                throw new IllegalArgumentException( "Unable to instantiate work item manager factory '" + className + "'", e );
+                throw new IllegalArgumentException( "Unable to instantiate work item manager factory '" + className + "'",
+                                                    e );
             }
         } else {
             throw new IllegalArgumentException( "Work item manager factory '" + className + "' not found" );
@@ -1187,4 +1198,49 @@
         }
     }
 
+    /**
+     * An enum for the valid event processing modes.
+     * 
+     * When the rulebase is compiled in the CLOUD (default) event processing mode,
+     * it behaves just like a regular rulebase.
+     * 
+     * When the rulebase is compiled in the STREAM event processing mode, additional
+     * assumptions are made. These assumptions allow the engine to perform a few optimisations
+     * like:
+     * 
+     * <li> reasoning over absence of events (NOT CE), automatically adds an appropriate duration attribute
+     * to the rule in order to avoid early rule firing. </li>
+     * <li> memory management techniques may be employed when an event no longer can match other events
+     * due to session clock continuous increment. </li>
+     * 
+     * @author etirelli
+     *
+     */
+    public static enum EventProcessingMode {
+
+        CLOUD("cloud"), STREAM("stream");
+
+        private String string;
+        EventProcessingMode( String mode ) {
+            this.string = mode;
+        }
+        
+        public String getId() {
+            return string;
+        }
+        
+        public String toString() {
+            return string;
+        }
+        
+        public static EventProcessingMode determineAssertBehaviour(String mode) {
+            if( STREAM.getId().equalsIgnoreCase( mode ) ) {
+                return STREAM;
+            } else if( CLOUD.getId().equalsIgnoreCase( mode ) ) {
+                return CLOUD;
+            }
+            throw new IllegalArgumentException( "Illegal enum value '" + mode + "' for EventProcessingMode" );
+        }
+    }
+
 }

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-10-12 15:29:56 UTC (rev 23429)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/Scheduler.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -67,7 +67,7 @@
      */
     private Scheduler() {
         // FIXME: must use the session timer service
-        this.timerService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME );
+        this.timerService = TimerServiceFactory.getTimerService( ClockType.REALTIME_CLOCK );
     }
 
     /**

Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/Interval.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/Interval.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/Interval.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -0,0 +1,113 @@
+/**
+ * 
+ */
+package org.drools.time;
+
+/**
+ * A class to represent a time interval. Specially useful to 
+ * calculate time distance between events constrained by
+ * temporal constraints.
+ * 
+ * If the interval is open, i.e., from -infinitum to +infinitum,
+ * the representation is created by using lowerBound = Long.MIN_VALUE
+ * and upperBound = Long.MAX_VALUE.
+ *  
+ * @author etirelli
+ */
+public class Interval implements Cloneable {
+    private static final long MIN = Long.MIN_VALUE;
+    private static final long MAX = Long.MAX_VALUE;
+    
+    private long lowerBound;
+    private long upperBound;
+
+    public Interval() {
+        this.lowerBound = MIN;
+        this.upperBound = MAX;
+    }
+    
+    public Interval(long lowerBound, long upperBound) {
+        this.lowerBound = lowerBound;
+        this.upperBound = upperBound;
+    }
+
+    /**
+     * Calculates the value of the intersection between
+     * this Interval and another interval.
+     * This is given by the following rule:
+     * 
+     * lowerBound = max( this.lowerBound, another.lowerBound )
+     * upperBound = min( this.upperBound, another.upperBound )
+     * 
+     * @param another the other interval to calculate the intersection with.
+     */
+    public void intersect( Interval another ) {
+        this.lowerBound = Math.max( this.lowerBound, another.lowerBound );
+        this.upperBound = Math.min( this.upperBound, another.upperBound );
+    }
+
+    /**
+     * Calculates the path addition of this interval with another interval.
+     * This is given by the following rule:
+     * 
+     * lowerBound = ( this.lowerBound == MIN || another.lowerBound == MIN ) ? MIN : this.lowerBound+another.lowerBound;
+     * upperBound = ( this.upperBound == MAX || another.upperBound == MAX ) ? MAX : this.upperBound+another.upperBound;
+     * 
+     * @param another the other interval to add into this interval
+     */
+    public void add( Interval another ) {
+        this.lowerBound = ( this.lowerBound == MIN || another.lowerBound == MIN ) ? MIN : this.lowerBound+another.lowerBound;
+        this.upperBound = ( this.upperBound == MAX || another.upperBound == MAX ) ? MAX : this.upperBound+another.upperBound;
+    }
+
+    public long getLowerBound() {
+        return lowerBound;
+    }
+
+    public void setLowerBound(long lowerBound) {
+        this.lowerBound = lowerBound;
+    }
+
+    public long getUpperBound() {
+        return upperBound;
+    }
+
+    public void setUpperBound(long upperBound) {
+        this.upperBound = upperBound;
+    }
+    
+    public Interval clone() {
+        return new Interval( this.lowerBound, this.upperBound );
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public String toString() {
+        String result = "[ " + (( this.lowerBound == MIN ) ? "-NA" : this.lowerBound ) + ", "+
+                (( this.upperBound == MAX ) ? " NA" : this.upperBound ) + " ]";
+        return result;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (lowerBound ^ (lowerBound >>> 32));
+        result = prime * result + (int) (upperBound ^ (upperBound >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        Interval other = (Interval) obj;
+        if ( lowerBound != other.lowerBound ) return false;
+        if ( upperBound != other.upperBound ) return false;
+        return true;
+    }
+    
+    
+}

Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimeUtils.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimeUtils.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimeUtils.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -0,0 +1,58 @@
+/**
+ * 
+ */
+package org.drools.time;
+
+/**
+ * A helper class with utility methods for
+ * time related operations.
+ * 
+ * @author etirelli
+ */
+public class TimeUtils {
+
+    /**
+     * This method calculates the transitive closure of the given adjacency matrix
+     * in order to find the temporal distance between each event represented in the
+     * adjacency matrix.
+     * 
+     * For more information on the calculation of the temporal distance, please refer
+     * to the paper:
+     * 
+     * "Discarding Unused Temporal Information in a Production System", by Dan Teodosiu
+     * and Gunter Pollak.
+     * 
+     * This method also uses an adaptation of the Floyd-Warshall algorithm to calculate 
+     * the transitive closure of the interval matrix. More information can be found here:
+     * 
+     * http://en.wikipedia.org/wiki/Floyd-Warshall_algorithm
+     * 
+     * The adaptation of the algorithm follows the definition of the path addition and
+     * path intersection operations as defined in the paper previously mentioned. The
+     * algorithm runs in O(n^3).
+     *  
+     * @param constraintMatrix the starting adjacency matrix
+     * 
+     * @return the resulting temporal distance matrix
+     */
+    public static Interval[][] calculateTemporalDistance( Interval[][] constraintMatrix ) {
+        Interval[][] result = new Interval[constraintMatrix.length][];
+        for( int i = 0; i < result.length; i++ ) {
+            result[i] = new Interval[constraintMatrix[i].length];
+            for( int j = 0; j < result[i].length; j++ ) {
+                result[i][j] = constraintMatrix[i][j].clone();
+            }
+        }
+        for( int k = 0; k < result.length; k++ ) {
+            for( int i = 0; i < result.length; i++ ) {
+                for( int j = 0; j < result.length; j++ ) {
+                    Interval interval = result[i][k].clone();
+                    interval.add( result[k][j] );
+                    result[i][j].intersect( interval);
+                }
+            }
+        }
+        return result;
+    }
+
+}

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-10-12 15:29:56 UTC (rev 23429)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/time/TimerServiceFactory.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -8,7 +8,7 @@
     
     public static TimerService getTimerService( ClockType type ) {
         switch( type ) {
-            case REAL_TIME:
+            case REALTIME_CLOCK:
                 return new JDKTimerService();
             case PSEUDO_CLOCK:
                 return new PseudoClockScheduler();

Added: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/TemporalDistanceTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/TemporalDistanceTest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/TemporalDistanceTest.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -0,0 +1,51 @@
+package org.drools.time;
+
+import junit.framework.TestCase;
+
+/**
+ * Test class for the time distance calculation algorithm
+ */
+public class TemporalDistanceTest  extends TestCase {
+    public static final long MIN = Long.MIN_VALUE;
+    public static final long MAX = Long.MAX_VALUE;
+
+    public void testTemporalDistance() {
+        Interval[][] matrix = new Interval[][] {
+                { new Interval(0,0), new Interval(-2,2), new Interval(-3, 4), new Interval(MIN, MAX), new Interval(MIN, MAX) },
+                { new Interval(-2,2), new Interval(0,0), new Interval(MIN, MAX), new Interval(1,2), new Interval(MIN, MAX) },
+                { new Interval(-4,3), new Interval(MIN,MAX), new Interval(0, 0), new Interval(2, 3), new Interval(MIN, MAX) },
+                { new Interval(MIN,MAX), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(-2, -1) },
+                { new Interval(MIN,MAX), new Interval(MIN,MAX), new Interval(MIN,MAX), new Interval(1, 2), new Interval(0,0) }
+        };
+        Interval[][] expected = new Interval[][] {
+                { new Interval(0,0), new Interval(-2,2), new Interval(-3, 2), new Interval(-1, 4), new Interval(-3, 3) },
+                { new Interval(-2,2), new Interval(0,0), new Interval(-2, 0), new Interval(1,2), new Interval(-1, 1) },
+                { new Interval(-2,3), new Interval(0,2), new Interval(0, 0), new Interval(2, 3), new Interval(0,2) },
+                { new Interval(-4,1), new Interval(-2,-1), new Interval(-3, -2), new Interval(0, 0), new Interval(-2, -1) },
+                { new Interval(-3,3), new Interval(-1,1), new Interval(-2,0), new Interval(1, 2), new Interval(0,0) }
+        };
+        Interval[][] result = TimeUtils.calculateTemporalDistance( matrix );
+        assertEqualsMatrix( expected, result );
+    }
+
+    public void assertEqualsMatrix( Interval[][] expected, Interval[][] matrix ) {
+        for( int i = 0; i < matrix.length; i++ ) {
+            for( int j = 0; j < matrix[i].length; j++ ) {
+                assertEquals( "Wrong value at ("+i+", "+j, expected[i][j], matrix[i][j] );
+            }
+        }
+    }
+
+    public void printMatrix( Interval[][] matrix ) {
+        System.out.println("------------------------------------------------------------------");
+        for( int i = 0; i < matrix.length; i++ ) {
+            System.out.print("|  ");
+            for( int j = 0; j < matrix[i].length; j++ ) {
+                System.out.print( matrix[i][j] + "  ");
+            }
+            System.out.println("|");
+        }
+        System.out.println("------------------------------------------------------------------");
+    }
+
+}

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-10-12 15:29:56 UTC (rev 23429)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/time/impl/JDKTimerServiceTest.java	2008-10-12 22:38:01 UTC (rev 23430)
@@ -21,7 +21,7 @@
 public class JDKTimerServiceTest extends TestCase {
     
     public void testSingleExecutionJob() throws Exception {
-        TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME ); 
+        TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REALTIME_CLOCK ); 
         Trigger trigger = new DelayedTrigger( 100 );
         HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
         timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);        
@@ -30,7 +30,7 @@
     }    
     
     public void testRepeatedExecutionJob() throws Exception {
-        TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME ); 
+        TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REALTIME_CLOCK ); 
         Trigger trigger = new DelayedTrigger(  new long[] { 100, 100, 100} );
         HelloWorldJobContext ctx = new HelloWorldJobContext( "hello world", timeService);
         timeService.scheduleJob( new HelloWorldJob(), ctx,  trigger);        
@@ -41,7 +41,7 @@
         
     
 	public void testRepeatedExecutionJobWithRemove() throws Exception {
-	    TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REAL_TIME );
+	    TimerService timeService = TimerServiceFactory.getTimerService( ClockType.REALTIME_CLOCK );
 		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