[jboss-svn-commits] JBL Code SVN: r24517 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Dec 31 13:45:31 EST 2008


Author: mark.proctor at jboss.com
Date: 2008-12-31 13:45:31 -0500 (Wed, 31 Dec 2008)
New Revision: 24517

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java
Log:
-fixed interrupt for interval change.

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java	2008-12-31 17:54:51 UTC (rev 24516)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java	2008-12-31 18:45:31 UTC (rev 24517)
@@ -213,7 +213,7 @@
 
     public void stop() {
         this.processChangeSet.setNotify( false );
-        this.thread.notify();
+        this.thread.interrupt();
     }
 
     private Thread           thread;

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java	2008-12-31 17:54:51 UTC (rev 24516)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java	2008-12-31 18:45:31 UTC (rev 24517)
@@ -42,8 +42,8 @@
     }    
 
     public void configure(ResourceChangeScannerConfiguration configuration) {
-        this.scannerScheduler.setInterval( ((ResourceChangeScannerConfigurationImpl) configuration).getInterval() );
-        this.listener.info( "ResourceChangeScanner reconfigured with interval=" + getInterval() );
+        setInterval( ((ResourceChangeScannerConfigurationImpl) configuration).getInterval() );
+        this.listener.info( "ResourceChangeScanner reconfigured with interval=" + ( getInterval() / 1000 ) );
         synchronized ( this.resources ) {
             this.resources.notify(); // notify wait, so that it will wait again
         }
@@ -191,7 +191,11 @@
     }
 
     public void setInterval(int interval) {
-        this.scannerScheduler.setInterval( interval * 1000 );
+        this.scannerScheduler.setInterval( interval );
+        if ( this.scannerScheduler.isRunning() ) {
+            // need to interrupt so it will iterate the run() and the new interval will take effect
+            this.thread.interrupt();            
+        }
     }
 
     public int getInterval() {
@@ -258,10 +262,13 @@
                     this.listener.info( "ResourceChangeNotification scanner has started" );
                 }
                 while ( this.scan ) {
+                    System.out.println( "BEFORE : sync this.resources" );
                     synchronized ( this.resources ) {      
+                        System.out.println( "DURING : sync this.resources" );
                         // lock the resources, as we don't want this modified while processing
                         this.scanner.scan();
                     }
+                    System.out.println( "AFTER : SCAN" );
                     try {
                         this.listener.debug( "ResourceChangeNotification scanner thread is waiting for " + ( this.interval / 1000 ) );
                         wait( this.interval );




More information about the jboss-svn-commits mailing list