felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1151763 - in /felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks: HandlerTask.java HandlerTaskImpl.java Rendezvous.java SyncDeliverTasks.java
Date Thu, 28 Jul 2011 08:42:55 GMT
Author: cziegeler
Date: Thu Jul 28 08:42:54 2011
New Revision: 1151763

URL: http://svn.apache.org/viewvc?rev=1151763&view=rev
Log:
Code cleanup

Modified:
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTask.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTaskImpl.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/Rendezvous.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/SyncDeliverTasks.java

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTask.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTask.java?rev=1151763&r1=1151762&r2=1151763&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTask.java
(original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTask.java
Thu Jul 28 08:42:54 2011
@@ -40,9 +40,4 @@ public interface HandlerTask
      * Blacklist the handler.
      */
     void blackListHandler();
-
-    /**
-     * Is the delivery finished
-     */
-    boolean finished();
 }

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTaskImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTaskImpl.java?rev=1151763&r1=1151762&r2=1151763&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTaskImpl.java
(original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/HandlerTaskImpl.java
Thu Jul 28 08:42:54 2011
@@ -40,9 +40,6 @@ public class HandlerTaskImpl implements 
     // Used to blacklist the service or get the service object for the reference
     private final BlacklistingHandlerTasks m_handlerTasks;
 
-    // Is this handler finished
-    private volatile boolean m_finished = false;
-
     /**
      * Construct a delivery task for the given service and event.
      *
@@ -89,7 +86,8 @@ public class HandlerTaskImpl implements 
         try
         {
             handler.handleEvent(m_event);
-        } catch (Throwable e)
+        }
+        catch (final Throwable e)
         {
             // The spec says that we must catch exceptions and log them:
             LogWrapper.getLogger().log(
@@ -99,8 +97,10 @@ public class HandlerTaskImpl implements 
                     + m_eventHandlerRef + " | Bundle("
                     + m_eventHandlerRef.getBundle() + ")]", e);
         }
-        m_finished = true;
-        m_handlerTasks.ungetEventHandler(handler, m_eventHandlerRef);
+        finally
+        {
+            m_handlerTasks.ungetEventHandler(handler, m_eventHandlerRef);
+        }
     }
 
     /**
@@ -110,13 +110,4 @@ public class HandlerTaskImpl implements 
     {
         m_handlerTasks.blackList(m_eventHandlerRef);
     }
-
-    /**
-     * @see org.apache.felix.eventadmin.impl.tasks.HandlerTask#finished()
-     */
-    public boolean finished()
-    {
-        return m_finished;
-    }
-
 }

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/Rendezvous.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/Rendezvous.java?rev=1151763&r1=1151762&r2=1151763&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/Rendezvous.java
(original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/Rendezvous.java
Thu Jul 28 08:42:54 2011
@@ -28,7 +28,7 @@ import EDU.oswego.cs.dl.util.concurrent.
  */
 public class Rendezvous extends CyclicBarrier
 {
-    /** Flag for timedout handling. */
+    /** Flag for timeout handling. */
     private volatile boolean timedout = false;
 
     /**
@@ -85,9 +85,4 @@ public class Rendezvous extends CyclicBa
         {
         }
     }
-
-    public boolean isTimedOut()
-    {
-        return timedout;
-    }
 }

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/SyncDeliverTasks.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/SyncDeliverTasks.java?rev=1151763&r1=1151762&r2=1151763&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/SyncDeliverTasks.java
(original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/SyncDeliverTasks.java
Thu Jul 28 08:42:54 2011
@@ -60,10 +60,17 @@ public class SyncDeliverTasks implements
     /** The timeout for event handlers, 0 = disabled. */
     long m_timeout;
 
+    /**
+     * The matcher interface for checking if timeout handling
+     * is disabled for the handler.
+     * Matching is based on the class name of the event handler.
+     */
     private static interface Matcher
     {
         boolean match(String className);
     }
+
+    /** Match a package. */
     private static final class PackageMatcher implements Matcher
     {
         private final String m_packageName;
@@ -78,6 +85,8 @@ public class SyncDeliverTasks implements
             return pos > -1 && className.substring(0, pos).equals(m_packageName);
         }
     }
+
+    /** Match a package or sub package. */
     private static final class SubPackageMatcher implements Matcher
     {
         private final String m_packageName;
@@ -92,6 +101,8 @@ public class SyncDeliverTasks implements
             return pos > -1 && className.substring(0, pos + 1).startsWith(m_packageName);
         }
     }
+
+    /** Match a class name. */
     private static final class ClassMatcher implements Matcher
     {
         private final String m_className;
@@ -237,7 +248,7 @@ public class SyncDeliverTasks implements
                             // stop the timer
                             timerBarrier.waitForRendezvous();
                         }
-                        catch (IllegalStateException ise)
+                        catch (final IllegalStateException ise)
                         {
                             // this can happen on shutdown, so we ignore it
                         }
@@ -247,14 +258,13 @@ public class SyncDeliverTasks implements
                 startBarrier.waitForRendezvous();
 
                 // timeout handling
-                final long sleepTime = m_timeout;
                 // we sleep for the sleep time
                 // if someone wakes us up it's the finished inner task
                 try
                 {
-                    timerBarrier.waitAttemptForRendezvous(sleepTime);
+                    timerBarrier.waitAttemptForRendezvous(m_timeout);
                 }
-                catch (TimeoutException ie)
+                catch (final TimeoutException ie)
                 {
                     // if we timed out, we have to blacklist the handler
                     task.blackListHandler();



Mime
View raw message