felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1776641 - in /felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm: DependencyManager.java impl/ComponentImpl.java impl/InvocationUtil.java
Date Fri, 30 Dec 2016 21:43:09 GMT
Author: pderop
Date: Fri Dec 30 21:43:09 2016
New Revision: 1776641

URL: http://svn.apache.org/viewvc?rev=1776641&view=rev
Log:
FELIX-5471: Fixed typo. No need to wait for execution of stop task in Component.stop() method.

Modified:
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/InvocationUtil.java

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java?rev=1776641&r1=1776640&r2=1776641&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/DependencyManager.java
Fri Dec 30 21:43:09 2016
@@ -81,7 +81,7 @@ public class DependencyManager {
     /**
      * Default value for the SCHEDULE_TIMEOUT parameter, in millis.
      */
-    public static volatile long SCHEDUME_TIMEOUT_VAL = 30000;
+    public static volatile long SCHEDULE_TIMEOUT_VAL = 30000;
 
     private final BundleContext m_context;
     private final Logger m_logger;
@@ -119,7 +119,7 @@ public class DependencyManager {
 	            String scheduleTimeout = bundleContext.getProperty(SCHEDULE_TIMEOUT);
 	            if (scheduleTimeout != null) {
 	            	try {
-	            		SCHEDUME_TIMEOUT_VAL = Long.valueOf(scheduleTimeout);
+	            		SCHEDULE_TIMEOUT_VAL = Long.valueOf(scheduleTimeout);
 	            	} catch (NumberFormatException e) {	            		
 	            	}
 	            }	            

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java?rev=1776641&r1=1776640&r2=1776641&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
Fri Dec 30 21:43:09 2016
@@ -425,12 +425,19 @@ public class ComponentImpl implements Co
 	@Override
 	public void stop() {           
 	    if (m_active.compareAndSet(true, false)) {
-            // Now, we have to schedule our stopTask in our component executor. If the executor
is a parallel 
-	        // dispatcher, then try to invoke our stop task synchronously (it does not make
sense to try to stop a component asynchronously).
-            schedule(true /* synchronously */, () -> {
+	    	Runnable task = () -> {
 	            m_isStarted = false;
 	            handleChange();
-	        });
+	    	};
+	    	
+    		Executor exec = getExecutor();
+    		if (exec instanceof DispatchExecutor) {
+                // Now, we have to schedule our stopTask in our component executor. If the
executor is a parallel 
+    	        // dispatcher, then try to invoke our stop task synchronously (it does not make
sense to try to stop a component asynchronously).
+    			((DispatchExecutor) exec).execute(task, false);
+    		} else {
+    			exec.execute(task);
+    		}
 	    }
 	}
 
@@ -1690,12 +1697,12 @@ public class ComponentImpl implements Co
     			exec.execute(future);
     		}
     		try {
-				future.get(DependencyManager.SCHEDUME_TIMEOUT_VAL, TimeUnit.MILLISECONDS);
+				future.get(DependencyManager.SCHEDULE_TIMEOUT_VAL, TimeUnit.MILLISECONDS);
 			} catch (InterruptedException | ExecutionException | TimeoutException e) {
-				m_logger.warn("task could not be scheduled timely in component %s (exception:%s)", this,
e.toString());
+				m_logger.warn("task could not be scheduled timely in component %s (exception: %s)", this,
e.toString());
 			}
     	} else {
     		getExecutor().execute(task);
     	}
-    }
+    }    
 }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/InvocationUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/InvocationUtil.java?rev=1776641&r1=1776640&r2=1776641&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/InvocationUtil.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/InvocationUtil.java
Fri Dec 30 21:43:09 2016
@@ -234,7 +234,7 @@ public class InvocationUtil {
         queue.execute(ft);
                 
         try {
-            Exception err = ft.get(DependencyManager.SCHEDUME_TIMEOUT_VAL, TimeUnit.MILLISECONDS);
+            Exception err = ft.get(DependencyManager.SCHEDULE_TIMEOUT_VAL, TimeUnit.MILLISECONDS);
             if (err != null) {
                 throw err;
             }



Mime
View raw message