felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1597712 - in /felix/trunk/eventadmin/impl: ./ src/main/appended-resources/META-INF/ src/main/java/org/apache/felix/eventadmin/impl/ src/main/java/org/apache/felix/eventadmin/impl/adapter/ src/main/java/org/apache/felix/eventadmin/impl/hand...
Date Tue, 27 May 2014 06:59:41 GMT
Author: cziegeler
Date: Tue May 27 06:59:41 2014
New Revision: 1597712

URL: http://svn.apache.org/r1597712
Log:
FELIX-3511 - Use java.concurrent from Java 6

Removed:
    felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/LICENSE
    felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/NOTICE
Modified:
    felix/trunk/eventadmin/impl/changelog.txt
    felix/trunk/eventadmin/impl/pom.xml
    felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/DEPENDENCIES
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/MetaTypeProviderImpl.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerProxy.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerTracker.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/AsyncDeliverTasks.java
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.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
    felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/util/LogWrapper.java

Modified: felix/trunk/eventadmin/impl/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/changelog.txt?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/changelog.txt (original)
+++ felix/trunk/eventadmin/impl/changelog.txt Tue May 27 06:59:41 2014
@@ -1,6 +1,18 @@
+Changes from 1.3.2 to 1.3.4
+---------------------------
+** Improvement
+    * [FELIX-3511] - Use java.concurrent from Java 6
+    * [FELIX-4316] - Packages imported dynamically should also be imported statically with an optional flag
+
+
+Changes from 1.3.0 to 1.3.2
+---------------------------
+** Bug
+    * [FELIX-3689] - Event admin requires org.osgi.util.tracker in version 1.5
+    
+
 Changes from 1.2.14 to 1.3.0
 ----------------------------
-
 ** Bug
     * [FELIX-3121] - Add back the manifest header indicating the provided service
     * [FELIX-3451] - EventAdmin ignoring filters for handler which are registered for all (*) topics 
@@ -13,7 +25,6 @@ Changes from 1.2.14 to 1.3.0
     
 Changes from 1.2.12 to 1.2.14
 -----------------------------
-
 ** Bug
     * [FELIX-2997] - java.lang.NullPointerException during shutdown while sending events
     * [FELIX-3002] - Embed the OBR specific information for the EventAdmin bundle in the manifest
@@ -26,14 +37,12 @@ Changes from 1.2.12 to 1.2.14
 
 Changes from 1.2.10 to 1.2.12
 -----------------------------
-
 ** Bug
     * [FELIX-2915] - Potential deadlock on shutdown
 
 
 Changes from 1.2.8 to 1.2.10
 ----------------------------
-
 ** Bug
     * [FELIX-2836] - Async threads should be daemon threads
 
@@ -43,21 +52,18 @@ Changes from 1.2.8 to 1.2.10
 
 Changes from 1.2.6 to 1.2.8
 ---------------------------
-
 ** Improvement
     * [FELIX-2655] - allow event admin log level to be configurable
 
 
 Changes from 1.2.4 to 1.2.6
 ---------------------------
-
 ** Bug
     * [FELIX-2608] - Threads should be daemon threads
 
 
 Changes from 1.2.2 to 1.2.4
 ---------------------------
-
 ** Bug
     * [FELIX-2582] - Event admin requires config admin packages
     * [FELIX-2431] - EventAdmin service unregistered but not registered again on ConfigAdmin startup
@@ -69,7 +75,6 @@ Changes from 1.2.2 to 1.2.4
 
 Changes from 1.0.0 to 1.2.2
 ---------------------------
-
 ** Bug
     * [FELIX-2089] - IllegalStateException thrown by LogWrapper if logging after bundle stop
 

Modified: felix/trunk/eventadmin/impl/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/pom.xml?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/pom.xml (original)
+++ felix/trunk/eventadmin/impl/pom.xml Tue May 27 06:59:41 2014
@@ -40,19 +40,13 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
-            <version>4.0.0</version>
+            <version>5.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.compendium</artifactId>
-            <version>4.3.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>concurrent</groupId>
-            <artifactId>concurrent</artifactId>
-            <version>1.3.4</version>
+            <version>5.0.0</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
@@ -64,9 +58,17 @@
         </resources>
         <plugins>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.3.7</version>
+                <version>2.4.0</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
@@ -81,6 +83,7 @@
                             org.osgi.service.log;version="[1.3,2)"
                         </DynamicImport-Package>
                         <Import-Package>
+                            org.osgi.framework;version="[1.3,2)",
                             <!--
                                 Configuration Admin is optional and if it is
                                 present, version 1.2 (from R4.0) is enough  
@@ -111,10 +114,8 @@
                         <Export-Service>
                             org.osgi.service.event.EventAdmin
                         </Export-Service>
-                        <!-- Include concurrent lib but not sub packages -->
                         <Embed-Dependency>
-                            concurrent;inline="EDU/oswego/cs/dl/util/concurrent/[A-Z]*",
-                            org.osgi.compendium;inline="org/osgi/util/tracker/*"
+                            org.osgi.core;inline="org/osgi/util/tracker/*"
                         </Embed-Dependency>
                     </instructions>
                 </configuration>

Modified: felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/DEPENDENCIES
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/DEPENDENCIES?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/DEPENDENCIES (original)
+++ felix/trunk/eventadmin/impl/src/main/appended-resources/META-INF/DEPENDENCIES Tue May 27 06:59:41 2014
@@ -5,11 +5,6 @@ The OSGi Alliance (http://www.osgi.org/)
 Copyright (c) OSGi Alliance (2000, 2012).
 Licensed under the Apache License 2.0. 
 
-This product includes software developed at
-Sun Microsystems, Inc.
-Copyright (c) 1994-2000.
-Licensed under a BSD license.
-
 II. Used Third-Party Software
 
 This product uses software developed at
@@ -19,4 +14,3 @@ Licensed under the Apache License 2.0. 
 
 III. License Summary
 - Apache License 2.0
-- BSD License

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java Tue May 27 06:59:41 2014
@@ -19,14 +19,22 @@
 package org.apache.felix.eventadmin.impl;
 
 
-import java.util.*;
-
-import org.apache.felix.eventadmin.impl.adapter.*;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import org.apache.felix.eventadmin.impl.adapter.AbstractAdapter;
+import org.apache.felix.eventadmin.impl.adapter.BundleEventAdapter;
+import org.apache.felix.eventadmin.impl.adapter.FrameworkEventAdapter;
+import org.apache.felix.eventadmin.impl.adapter.LogEventAdapter;
+import org.apache.felix.eventadmin.impl.adapter.ServiceEventAdapter;
 import org.apache.felix.eventadmin.impl.handler.EventAdminImpl;
 import org.apache.felix.eventadmin.impl.security.SecureEventAdminFactory;
 import org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool;
 import org.apache.felix.eventadmin.impl.util.LogWrapper;
-import org.osgi.framework.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 import org.osgi.service.event.EventAdmin;
@@ -159,7 +167,7 @@ public class Configuration
                     interfaceNames = new String[] {ManagedService.class.getName(), MetaTypeProvider.class.getName()};
                     service = enhancedService;
                 }
-                Dictionary props = new Hashtable();
+                Dictionary<String, Object> props = new Hashtable<String, Object>();
                 props.put( Constants.SERVICE_PID, PID );
                 m_managedServiceReg = m_bundleContext.registerService( interfaceNames, service, props );
             }
@@ -170,13 +178,14 @@ public class Configuration
         }
     }
 
-    void updateFromConfigAdmin(final Dictionary config)
+    void updateFromConfigAdmin(final Dictionary<String, ?> config)
     {
         // do this in the background as we don't want to stop
         // the config admin
         new Thread()
         {
 
+            @Override
             public void run()
             {
                 synchronized ( Configuration.this )
@@ -193,7 +202,7 @@ public class Configuration
     /**
      * Configures this instance.
      */
-    void configure( Dictionary config )
+    void configure( Dictionary<String, ?> config )
     {
         if ( config == null )
         {
@@ -412,7 +421,8 @@ public class Configuration
         {
             return new ManagedService()
             {
-                public void updated( Dictionary properties ) throws ConfigurationException
+                @Override
+                public void updated( Dictionary<String, ?> properties ) throws ConfigurationException
                 {
                     updateFromConfigAdmin(properties);
                 }

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/MetaTypeProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/MetaTypeProviderImpl.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/MetaTypeProviderImpl.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/MetaTypeProviderImpl.java Tue May 27 06:59:41 2014
@@ -24,7 +24,9 @@ import java.util.Dictionary;
 
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
-import org.osgi.service.metatype.*;
+import org.osgi.service.metatype.AttributeDefinition;
+import org.osgi.service.metatype.MetaTypeProvider;
+import org.osgi.service.metatype.ObjectClassDefinition;
 
 /**
  * The optional meta type provider for the event admin config.
@@ -58,7 +60,8 @@ public class MetaTypeProviderImpl
     /**
      * @see org.osgi.service.cm.ManagedService#updated(java.util.Dictionary)
      */
-    public void updated(Dictionary properties) throws ConfigurationException
+    @Override
+    public void updated(Dictionary<String, ?> properties) throws ConfigurationException
     {
         m_delegatee.updated(properties);
     }
@@ -66,6 +69,7 @@ public class MetaTypeProviderImpl
     /**
      * @see org.osgi.service.metatype.MetaTypeProvider#getLocales()
      */
+    @Override
     public String[] getLocales()
     {
         return null;
@@ -74,6 +78,7 @@ public class MetaTypeProviderImpl
     /**
      * @see org.osgi.service.metatype.MetaTypeProvider#getObjectClassDefinition(java.lang.String, java.lang.String)
      */
+    @Override
     public ObjectClassDefinition getObjectClassDefinition( String id, String locale )
     {
         if ( !Configuration.PID.equals( id ) )
@@ -83,7 +88,7 @@ public class MetaTypeProviderImpl
 
         if ( ocd == null )
         {
-            final ArrayList adList = new ArrayList();
+            final ArrayList<AttributeDefinition> adList = new ArrayList<AttributeDefinition>();
 
             adList.add( new AttributeDefinitionImpl( Configuration.PROP_THREAD_POOL_SIZE, "Thread Pool Size",
                 "The size of the thread pool. The default value is 10. Increase in case of a large amount " +
@@ -119,28 +124,32 @@ public class MetaTypeProviderImpl
             ocd = new ObjectClassDefinition()
             {
 
-                private final AttributeDefinition[] attrs = ( AttributeDefinition[] ) adList
+                private final AttributeDefinition[] attrs = adList
                     .toArray( new AttributeDefinition[adList.size()] );
 
 
+                @Override
                 public String getName()
                 {
                     return "Apache Felix Event Admin Implementation";
                 }
 
 
+                @Override
                 public InputStream getIcon( int arg0 )
                 {
                     return null;
                 }
 
 
+                @Override
                 public String getID()
                 {
                     return Configuration.PID;
                 }
 
 
+                @Override
                 public String getDescription()
                 {
                     return "Configuration for the Apache Felix Event Admin Implementation." +
@@ -148,6 +157,7 @@ public class MetaTypeProviderImpl
                 }
 
 
+                @Override
                 public AttributeDefinition[] getAttributeDefinitions( int filter )
                 {
                     return ( filter == OPTIONAL ) ? null : attrs;
@@ -198,54 +208,63 @@ public class MetaTypeProviderImpl
         }
 
 
+        @Override
         public int getCardinality()
         {
             return cardinality;
         }
 
 
+        @Override
         public String[] getDefaultValue()
         {
             return defaultValues;
         }
 
 
+        @Override
         public String getDescription()
         {
             return description;
         }
 
 
+        @Override
         public String getID()
         {
             return id;
         }
 
 
+        @Override
         public String getName()
         {
             return name;
         }
 
 
+        @Override
         public String[] getOptionLabels()
         {
             return optionLabels;
         }
 
 
+        @Override
         public String[] getOptionValues()
         {
             return optionValues;
         }
 
 
+        @Override
         public int getType()
         {
             return type;
         }
 
 
+        @Override
         public String validate( String arg0 )
         {
             return null;

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java Tue May 27 06:59:41 2014
@@ -50,6 +50,7 @@ public class BundleEventAdapter extends 
         context.addBundleListener(this);
     }
 
+    @Override
     public void destroy(BundleContext context) {
         context.removeBundleListener(this);
     }
@@ -60,9 +61,10 @@ public class BundleEventAdapter extends 
      *
      * @param event The event to adapt.
      */
+    @Override
     public void bundleChanged(final BundleEvent event)
     {
-        final Dictionary properties = new Hashtable();
+        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
 
         properties.put(EventConstants.EVENT, event);
 

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java Tue May 27 06:59:41 2014
@@ -52,6 +52,7 @@ public class FrameworkEventAdapter exten
         context.addFrameworkListener(this);
     }
 
+    @Override
     public void destroy(BundleContext context) {
         context.removeFrameworkListener(this);
     }
@@ -62,9 +63,10 @@ public class FrameworkEventAdapter exten
      *
      * @param event The event to adapt.
      */
+    @Override
     public void frameworkEvent(final FrameworkEvent event)
     {
-        final Dictionary properties = new Hashtable();
+        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
 
         properties.put(EventConstants.EVENT, event);
 

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java Tue May 27 06:59:41 2014
@@ -101,6 +101,7 @@ public class LogEventAdapter extends Abs
         }
     }
 
+    @Override
     public void destroy(BundleContext context) {
         context.removeServiceListener(this);
     }
@@ -113,6 +114,7 @@ public class LogEventAdapter extends Abs
      *
      * @param event The event to adapt.
      */
+    @Override
     public void serviceChanged(final ServiceEvent event)
     {
         if (ServiceEvent.REGISTERED == event.getType())
@@ -146,13 +148,14 @@ public class LogEventAdapter extends Abs
 
             m_logListener = new org.osgi.service.log.LogListener()
             {
+                @Override
                 public void logged(final org.osgi.service.log.LogEntry entry)
                 {
                     // This is where the assembly as specified in 133.6.6 OSGi R4
                     // compendium is taking place (i.e., the log entry is adapted to
                     // an event and posted via the EventAdmin)
 
-                    final Dictionary properties = new Hashtable();
+                    final Dictionary<String, Object> properties = new Hashtable<String, Object>();
 
                     final Bundle bundle = entry.getBundle();
 

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java Tue May 27 06:59:41 2014
@@ -53,6 +53,7 @@ public class ServiceEventAdapter extends
         context.addServiceListener(this);
     }
 
+    @Override
     public void destroy(BundleContext context) {
         context.removeServiceListener(this);
     }
@@ -63,9 +64,10 @@ public class ServiceEventAdapter extends
      *
      * @param event The event to adapt.
      */
+    @Override
     public void serviceChanged(final ServiceEvent event)
     {
-        final Dictionary properties = new Hashtable();
+        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
 
         properties.put(EventConstants.EVENT, event);
 

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerProxy.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerProxy.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerProxy.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerProxy.java Tue May 27 06:59:41 2014
@@ -123,11 +123,12 @@ public class EventHandlerProxy {
         }
         else if (topicObj instanceof Collection)
         {
-            final Collection col = (Collection)topicObj;
+            @SuppressWarnings("unchecked")
+            final Collection<Object> col = (Collection<Object>)topicObj;
             final String[] values = new String[col.size()];
             int index = 0;
             // check if one value matches '*'
-            final Iterator i = col.iterator();
+            final Iterator<Object> i = col.iterator();
             boolean matchAll = false;
             while ( i.hasNext() )
             {
@@ -212,7 +213,9 @@ public class EventHandlerProxy {
         Object delivery = reference.getProperty(EventConstants.EVENT_DELIVERY);
         if ( delivery instanceof Collection )
         {
-            delivery = ((Collection)delivery).toArray(new String[((Collection)delivery).size()]);
+            @SuppressWarnings("unchecked")
+            final Collection<String> col = (Collection<String>)delivery;
+            delivery = col.toArray(new String[col.size()]);
         }
         if ( delivery instanceof String )
         {

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerTracker.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerTracker.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerTracker.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/handler/EventHandlerTracker.java Tue May 27 06:59:41 2014
@@ -18,7 +18,14 @@
  */
 package org.apache.felix.eventadmin.impl.handler;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -31,20 +38,20 @@ import org.osgi.util.tracker.ServiceTrac
  *
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class EventHandlerTracker extends ServiceTracker {
+public class EventHandlerTracker extends ServiceTracker<EventHandler, EventHandlerProxy> {
 
     /** The proxies in this list match all events. */
-	private volatile List matchingAllEvents;
+	private volatile List<EventHandlerProxy> matchingAllEvents;
 
     /** This is a map for exact topic matches. The key is the topic,
      * the value is a list of proxies.
      */
-    private volatile Map matchingTopic;
+    private volatile Map<String, List<EventHandlerProxy>> matchingTopic;
 
 	/** This is a map for wildcard topics. The key is the prefix of the topic,
 	 * the value is a list of proxies
 	 */
-	private volatile Map matchingPrefixTopic;
+	private volatile Map<String, List<EventHandlerProxy>> matchingPrefixTopic;
 
 
 	/** The context for the proxies. */
@@ -54,9 +61,9 @@ public class EventHandlerTracker extends
 		super(context, EventHandler.class.getName(), null);
 
 		// we start with empty collections
-		this.matchingAllEvents = new ArrayList();
-		this.matchingTopic = new HashMap();
-		this.matchingPrefixTopic = new HashMap();
+		this.matchingAllEvents = new ArrayList<EventHandlerProxy>();
+		this.matchingTopic = new HashMap<String, List<EventHandlerProxy>>();
+		this.matchingPrefixTopic = new HashMap<String, List<EventHandlerProxy>>();
 	}
 
     /**
@@ -102,7 +109,8 @@ public class EventHandlerTracker extends
     /**
 	 * @see org.osgi.util.tracker.ServiceTracker#addingService(org.osgi.framework.ServiceReference)
 	 */
-	public Object addingService(final ServiceReference reference) {
+	@Override
+    public EventHandlerProxy addingService(final ServiceReference reference) {
 		final EventHandlerProxy proxy = new EventHandlerProxy(this.handlerContext, reference);
 		if ( proxy.update() ) {
 			this.put(proxy);
@@ -113,8 +121,8 @@ public class EventHandlerTracker extends
 	/**
 	 * @see org.osgi.util.tracker.ServiceTracker#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
 	 */
-	public void modifiedService(final ServiceReference reference, final Object service) {
-	    final EventHandlerProxy proxy = (EventHandlerProxy)service;
+	@Override
+    public void modifiedService(final ServiceReference reference, final EventHandlerProxy proxy) {
 	    this.remove(proxy);
 	    if ( proxy.update() ) {
             this.put(proxy);
@@ -124,22 +132,22 @@ public class EventHandlerTracker extends
 	/**
 	 * @see org.osgi.util.tracker.ServiceTracker#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
 	 */
-	public void removedService(ServiceReference reference, Object service) {
-        final EventHandlerProxy proxy = (EventHandlerProxy)service;
+	@Override
+    public void removedService(final ServiceReference reference, final EventHandlerProxy proxy) {
         this.remove(proxy);
         proxy.dispose();
 	}
 
-	private void updateMap(final Map proxyListMap, final String key, final EventHandlerProxy proxy, final boolean add) {
-        List proxies = (List)proxyListMap.get(key);
+	private void updateMap(final Map<String, List<EventHandlerProxy>> proxyListMap, final String key, final EventHandlerProxy proxy, final boolean add) {
+        List<EventHandlerProxy> proxies = proxyListMap.get(key);
         if (proxies == null) {
             if ( !add )
             {
                 return;
             }
-            proxies = new ArrayList();
+            proxies = new ArrayList<EventHandlerProxy>();
         } else {
-            proxies = new ArrayList(proxies);
+            proxies = new ArrayList<EventHandlerProxy>(proxies);
         }
         if ( add )
         {
@@ -169,14 +177,14 @@ public class EventHandlerTracker extends
 		final String[] topics = proxy.getTopics();
 		if ( topics == null )
 		{
-		    final List newMatchingAllEvents = new ArrayList(this.matchingAllEvents);
+		    final List<EventHandlerProxy> newMatchingAllEvents = new ArrayList<EventHandlerProxy>(this.matchingAllEvents);
 		    newMatchingAllEvents.add(proxy);
 		    this.matchingAllEvents = newMatchingAllEvents;
 		}
 		else
 		{
-		    Map newMatchingTopic = null;
-		    Map newMatchingPrefixTopic = null;
+		    Map<String, List<EventHandlerProxy>> newMatchingTopic = null;
+		    Map<String, List<EventHandlerProxy>> newMatchingPrefixTopic = null;
     		for(int i = 0; i < topics.length; i++) {
     			final String topic = topics[i];
 
@@ -185,7 +193,7 @@ public class EventHandlerTracker extends
                     // prefix topic: we remove the /*
     			    if ( newMatchingPrefixTopic == null )
     			    {
-    			        newMatchingPrefixTopic = new HashMap(this.matchingPrefixTopic);
+    			        newMatchingPrefixTopic = new HashMap<String, List<EventHandlerProxy>>(this.matchingPrefixTopic);
     			    }
 
     				final String prefix = topic.substring(0, topic.length() - 2);
@@ -196,7 +204,7 @@ public class EventHandlerTracker extends
     			    // exact match
                     if ( newMatchingTopic == null )
                     {
-                        newMatchingTopic = new HashMap(this.matchingTopic);
+                        newMatchingTopic = new HashMap<String, List<EventHandlerProxy>>(this.matchingTopic);
                     }
 
                     this.updateMap(newMatchingTopic, topic, proxy, true);
@@ -223,12 +231,12 @@ public class EventHandlerTracker extends
         final String[] topics = proxy.getTopics();
         if ( topics == null )
         {
-            final List newMatchingAllEvents = new ArrayList(this.matchingAllEvents);
+            final List<EventHandlerProxy> newMatchingAllEvents = new ArrayList<EventHandlerProxy>(this.matchingAllEvents);
             newMatchingAllEvents.remove(proxy);
             this.matchingAllEvents = newMatchingAllEvents;
         } else {
-            Map newMatchingTopic = null;
-            Map newMatchingPrefixTopic = null;
+            Map<String, List<EventHandlerProxy>> newMatchingTopic = null;
+            Map<String, List<EventHandlerProxy>> newMatchingPrefixTopic = null;
             for(int i = 0; i < topics.length; i++) {
                 final String topic = topics[i];
 
@@ -237,7 +245,7 @@ public class EventHandlerTracker extends
                     // prefix topic: we remove the /*
                     if ( newMatchingPrefixTopic == null )
                     {
-                        newMatchingPrefixTopic = new HashMap(this.matchingPrefixTopic);
+                        newMatchingPrefixTopic = new HashMap<String, List<EventHandlerProxy>>(this.matchingPrefixTopic);
                     }
 
                     final String prefix = topic.substring(0, topic.length() - 2);
@@ -248,7 +256,7 @@ public class EventHandlerTracker extends
                     // exact match
                     if ( newMatchingTopic == null )
                     {
-                        newMatchingTopic = new HashMap(this.matchingTopic);
+                        newMatchingTopic = new HashMap<String, List<EventHandlerProxy>>(this.matchingTopic);
                     }
 
                     this.updateMap(newMatchingTopic, topic, proxy, false);
@@ -271,10 +279,10 @@ public class EventHandlerTracker extends
 	 * @param event The event topic
 	 * @return All handlers for the event
 	 */
-	public Collection getHandlers(final Event event) {
+	public Collection<EventHandlerProxy> getHandlers(final Event event) {
 	    final String topic = event.getTopic();
 
-		final Set handlers = new HashSet();
+		final Set<EventHandlerProxy> handlers = new HashSet<EventHandlerProxy>();
 
 		// Add all handlers matching everything
 		handlers.addAll(this.matchingAllEvents);
@@ -286,7 +294,7 @@ public class EventHandlerTracker extends
 			while (pos != -1)
 			{
 			    final String prefix = topic.substring(0, pos);
-				List proxies = (List)this.matchingPrefixTopic.get(prefix);
+				List<EventHandlerProxy> proxies = this.matchingPrefixTopic.get(prefix);
 				if (proxies != null)
 				{
 					handlers.addAll(proxies);
@@ -297,15 +305,15 @@ public class EventHandlerTracker extends
 		}
 
 		// Add the handlers for matching topic names
-		List proxies = (List)this.matchingTopic.get(topic);
+		List<EventHandlerProxy> proxies = this.matchingTopic.get(topic);
 		if (proxies != null) {
 			handlers.addAll(proxies);
 		}
 
 		// now check permission and filters
-		final Iterator i = handlers.iterator();
+		final Iterator<EventHandlerProxy> i = handlers.iterator();
 		while ( i.hasNext() ) {
-		    final EventHandlerProxy proxy = (EventHandlerProxy) i.next();
+		    final EventHandlerProxy proxy = i.next();
 		    if ( !proxy.canDeliver(event) ) {
 		        i.remove();
 		    }
@@ -332,6 +340,7 @@ public class EventHandlerTracker extends
         {
             m_packageName = name;
         }
+        @Override
         public boolean match(String className)
         {
             final int pos = className.lastIndexOf('.');
@@ -348,6 +357,7 @@ public class EventHandlerTracker extends
         {
             m_packageName = name + '.';
         }
+        @Override
         public boolean match(String className)
         {
             final int pos = className.lastIndexOf('.');
@@ -364,6 +374,7 @@ public class EventHandlerTracker extends
         {
             m_className = name;
         }
+        @Override
         public boolean match(String className)
         {
             return m_className.equals(className);

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/AsyncDeliverTasks.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/AsyncDeliverTasks.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/AsyncDeliverTasks.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/AsyncDeliverTasks.java Tue May 27 06:59:41 2014
@@ -19,11 +19,10 @@
 package org.apache.felix.eventadmin.impl.tasks;
 
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.felix.eventadmin.impl.handler.EventHandlerProxy;
 import org.osgi.service.event.Event;
 
 /**
@@ -43,7 +42,7 @@ public class AsyncDeliverTasks
     private final SyncDeliverTasks m_deliver_task;
 
     /** A map of running threads currently delivering async events. */
-    private final Map m_running_threads = new HashMap();
+    private final Map<Long, TaskExecuter> m_running_threads = new ConcurrentHashMap<Long, TaskExecuter>();
 
     /**
      * The constructor of the class that will use the asynchronous.
@@ -65,7 +64,7 @@ public class AsyncDeliverTasks
      * @param tasks The event handler dispatch tasks to execute
      *
      */
-    public void execute(final Collection tasks, final Event event)
+    public void execute(final Collection<EventHandlerProxy> tasks, final Event event)
     {
         /*
         final Iterator i = tasks.iterator();
@@ -85,67 +84,94 @@ public class AsyncDeliverTasks
         }
         if ( hasOrdered )
         {*/
-            final Thread currentThread = Thread.currentThread();
-            TaskExecuter executer = null;
-            synchronized (m_running_threads )
+            final TaskInfo info = new TaskInfo(tasks, event);
+            final Long currentThreadId = Thread.currentThread().getId();
+            TaskExecuter executer = m_running_threads.get(currentThreadId);
+            if ( executer == null )
             {
-                final TaskExecuter runningExecutor = (TaskExecuter)m_running_threads.get(currentThread);
-                if ( runningExecutor != null )
-                {
-                    runningExecutor.add(tasks, event);
-                }
-                else
-                {
-                    executer = new TaskExecuter( tasks, event, currentThread );
-                    m_running_threads.put(currentThread, executer);
-                }
+                executer = new TaskExecuter();
+                m_running_threads.put(currentThreadId, executer);
             }
-            if ( executer != null )
+            synchronized ( executer )
             {
-                m_pool.executeTask(executer);
+                executer.add(info);
+                if ( !executer.isActive() )
+                {
+                    executer.setSyncDeliverTasks(m_deliver_task);
+                    m_pool.executeTask(executer);
+                }
             }
         //}
     }
 
-    private final class TaskExecuter implements Runnable
+    private final static class TaskInfo {
+        public final Collection<EventHandlerProxy> tasks;
+        public final Event event;
+
+        public TaskInfo next;
+
+        public TaskInfo(final Collection<EventHandlerProxy> tasks, final Event event) {
+            this.tasks = tasks;
+            this.event = event;
+        }
+    }
+
+    private final static class TaskExecuter implements Runnable
     {
-        private final List m_tasks = new LinkedList();
+        private volatile TaskInfo first;
+        private volatile TaskInfo last;
 
-        private final Object m_key;
+        private volatile SyncDeliverTasks m_deliver_task;
 
-        public TaskExecuter(final Collection tasks, final Event event, final Object key)
+        public boolean isActive()
         {
-            m_key = key;
-            m_tasks.add(new Object[] {tasks, event});
+            return this.m_deliver_task != null;
         }
 
+        public void setSyncDeliverTasks(final SyncDeliverTasks syncDeliverTasks)
+        {
+            this.m_deliver_task = syncDeliverTasks;
+        }
+
+        @Override
         public void run()
         {
             boolean running;
             do
             {
-                Object[] tasks = null;
-                synchronized ( m_tasks )
+                TaskInfo info = null;
+                synchronized ( this )
                 {
-                    tasks = (Object[]) m_tasks.remove(0);
+                    info = first;
+                    first = info.next;
+                    if ( first == null )
+                    {
+                        last = null;
+                    }
                 }
-                m_deliver_task.execute((Collection)tasks[0], (Event)tasks[1], true);
-                synchronized ( m_running_threads )
+                m_deliver_task.execute(info.tasks, info.event, true);
+                synchronized ( this )
                 {
-                    running = m_tasks.size() > 0;
+                    running = first != null;
                     if ( !running )
                     {
-                        m_running_threads.remove(m_key);
+                        this.m_deliver_task = null;
                     }
                 }
             } while ( running );
         }
 
-        public void add(final Collection tasks, final Event event)
+        public void add(final TaskInfo info)
         {
-            synchronized ( m_tasks )
+            if ( first == null )
+            {
+                first = info;
+                last = info;
+            }
+            else
             {
-                m_tasks.add(new Object[] {tasks, event});
+                last.next = info;
+                last = info;
             }
         }
     }

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/tasks/DefaultThreadPool.java Tue May 27 06:59:41 2014
@@ -16,9 +16,12 @@
  */
 package org.apache.felix.eventadmin.impl.tasks;
 
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
 import org.apache.felix.eventadmin.impl.util.LogWrapper;
 
-import EDU.oswego.cs.dl.util.concurrent.*;
 
 /**
  * A thread pool that allows to execute tasks using pooled threads in order
@@ -27,20 +30,25 @@ import EDU.oswego.cs.dl.util.concurrent.
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class DefaultThreadPool
-    extends PooledExecutor
 {
 
+    private ExecutorService executor;
+
+    private final ThreadFactory threadFactory;
+
+    private int oldSize = -1;
+
     /**
      * Create a new pool.
      */
     public DefaultThreadPool(final int poolSize, final boolean syncThreads)
     {
-   	    super(new LinkedQueue());
-   	    if ( syncThreads )
-   	    {
-            this.setThreadFactory(new ThreadFactory()
+        if ( syncThreads )
+        {
+            threadFactory = new ThreadFactory()
             {
 
+                @Override
                 public Thread newThread( final Runnable command )
                 {
                     final Thread thread = new SyncThread( command );
@@ -49,13 +57,14 @@ public class DefaultThreadPool
 
                     return thread;
                 }
-            });
-   	    }
-   	    else
-   	    {
-            this.setThreadFactory(new ThreadFactory()
+            };
+        }
+        else
+        {
+            threadFactory = new ThreadFactory()
             {
 
+                @Override
                 public Thread newThread( final Runnable command )
                 {
                     final Thread thread = new Thread( command );
@@ -64,20 +73,26 @@ public class DefaultThreadPool
 
                     return thread;
                 }
-            });
-   	    }
+            };
+        }
    	    configure(poolSize);
-        setKeepAliveTime(60000);
-        runWhenBlocked();
     }
 
     /**
      * Configure a new pool size.
      */
-    public void configure(final int poolSize)
+    public synchronized void configure(final int poolSize)
     {
-        setMinimumPoolSize(poolSize);
-        setMaximumPoolSize(poolSize + 10);
+        if ( oldSize != poolSize)
+        {
+            oldSize = poolSize;
+            final ExecutorService oldService = this.executor;
+            this.executor = Executors.newFixedThreadPool(poolSize, threadFactory);
+            if ( oldService != null )
+            {
+                oldService.shutdown();
+            }
+        }
     }
 
     /**
@@ -86,8 +101,7 @@ public class DefaultThreadPool
      */
     public void close()
     {
-        shutdownNow();
-
+        this.executor.shutdownNow();
     }
 
     /**
@@ -98,7 +112,7 @@ public class DefaultThreadPool
     {
         try
         {
-            super.execute(task);
+            this.executor.submit(task);
         }
         catch (final Throwable t)
         {

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=1597712&r1=1597711&r2=1597712&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 Tue May 27 06:59:41 2014
@@ -18,7 +18,11 @@
  */
 package org.apache.felix.eventadmin.impl.tasks;
 
-import EDU.oswego.cs.dl.util.concurrent.*;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
 
 /**
  * This is a simplified version of the CyclicBarrier implementation.
@@ -52,7 +56,7 @@ public class Rendezvous extends CyclicBa
         }
         try
         {
-            this.barrier();
+            this.await();
         }
         catch (BrokenBarrierException ignore1)
         {
@@ -70,8 +74,8 @@ public class Rendezvous extends CyclicBa
     {
         try
         {
-            this.attemptBarrier(timeout);
-            this.restart();
+            this.await(timeout, TimeUnit.MILLISECONDS);
+            this.reset();
         }
         catch (BrokenBarrierException ignore1)
         {

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=1597712&r1=1597711&r2=1597712&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 Tue May 27 06:59:41 2014
@@ -20,11 +20,11 @@ package org.apache.felix.eventadmin.impl
 
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.concurrent.TimeoutException;
 
 import org.apache.felix.eventadmin.impl.handler.EventHandlerProxy;
 import org.osgi.service.event.Event;
 
-import EDU.oswego.cs.dl.util.concurrent.TimeoutException;
 
 /**
  * This class does the actual work of the synchronous event delivery.
@@ -101,15 +101,15 @@ public class SyncDeliverTasks
      * @param tasks The event handler dispatch tasks to execute
      *
      */
-    public void execute(final Collection tasks, final Event event, final boolean filterAsyncUnordered)
+    public void execute(final Collection<EventHandlerProxy> tasks, final Event event, final boolean filterAsyncUnordered)
     {
         final Thread sleepingThread = Thread.currentThread();
         final SyncThread syncThread = sleepingThread instanceof SyncThread ? (SyncThread)sleepingThread : null;
 
-        final Iterator i = tasks.iterator();
+        final Iterator<EventHandlerProxy> i = tasks.iterator();
         while ( i.hasNext() )
         {
-            final EventHandlerProxy task = (EventHandlerProxy)i.next();
+            final EventHandlerProxy task = i.next();
 //            if ( !filterAsyncUnordered || task.isAsyncOrderedDelivery() )
 //            {
                 if ( !useTimeout(task) )
@@ -134,6 +134,7 @@ public class SyncDeliverTasks
                     final Rendezvous timerBarrier = new Rendezvous();
                     this.pool.executeTask(new Runnable()
                     {
+                        @Override
                         public void run()
                         {
                             try

Modified: felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/util/LogWrapper.java
URL: http://svn.apache.org/viewvc/felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/util/LogWrapper.java?rev=1597712&r1=1597711&r2=1597712&view=diff
==============================================================================
--- felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/util/LogWrapper.java (original)
+++ felix/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/util/LogWrapper.java Tue May 27 06:59:41 2014
@@ -85,7 +85,7 @@ public class LogWrapper
     public static final int LOG_DEBUG = 4;
 
     // A set containing the currently available LogServices. Furthermore used as lock
-    private final Set m_loggerRefs = new HashSet();
+    private final Set<ServiceReference> m_loggerRefs = new HashSet<ServiceReference>();
 
     // Only null while not set and m_loggerRefs is empty hence, only needs to be
     // checked in case m_loggerRefs is empty otherwise it will not be null.
@@ -158,6 +158,7 @@ public class LogWrapper
                 ServiceListener listener = new ServiceListener()
                 {
                     // Add a newly available LogService reference to the singleton.
+                    @Override
                     public void serviceChanged( final ServiceEvent event )
                     {
                         if ( ServiceEvent.REGISTERED == event.getType() )
@@ -254,9 +255,9 @@ public class LogWrapper
             {
                 // There is at least one LogService available hence, we can use the
                 // class as well.
-                for (Iterator iter = m_loggerRefs.iterator(); iter.hasNext();)
+                for (Iterator<ServiceReference> iter = m_loggerRefs.iterator(); iter.hasNext();)
                 {
-                    final ServiceReference next = (ServiceReference) iter.next();
+                    final ServiceReference next = iter.next();
 
                     org.osgi.service.log.LogService logger =
                         (org.osgi.service.log.LogService) m_context.getService(next);
@@ -306,9 +307,9 @@ public class LogWrapper
             {
                 // There is at least one LogService available hence, we can use the
                 // class as well.
-                for (Iterator iter = m_loggerRefs.iterator(); iter.hasNext();)
+                for (Iterator<ServiceReference> iter = m_loggerRefs.iterator(); iter.hasNext();)
                 {
-                    final ServiceReference next = (ServiceReference) iter.next();
+                    final ServiceReference next = iter.next();
 
                     org.osgi.service.log.LogService logger =
                         (org.osgi.service.log.LogService) m_context.getService(next);
@@ -358,9 +359,9 @@ public class LogWrapper
             {
                 // There is at least one LogService available hence, we can use the
                 // class as well.
-                for (Iterator iter = m_loggerRefs.iterator(); iter.hasNext();)
+                for (Iterator<ServiceReference> iter = m_loggerRefs.iterator(); iter.hasNext();)
                 {
-                    final ServiceReference next = (ServiceReference) iter.next();
+                    final ServiceReference next = iter.next();
 
                     org.osgi.service.log.LogService logger =
                         (org.osgi.service.log.LogService) m_context.getService(next);
@@ -405,16 +406,16 @@ public class LogWrapper
             {
                 return; // don't log
             }
-            
+
             final String logMsg = "EventAdmin: " + msg;
 
             if (!m_loggerRefs.isEmpty())
             {
                 // There is at least one LogService available hence, we can use the
                 // class as well.
-                for (Iterator iter = m_loggerRefs.iterator(); iter.hasNext();)
+                for (Iterator<ServiceReference> iter = m_loggerRefs.iterator(); iter.hasNext();)
                 {
-                       final ServiceReference next = (ServiceReference) iter.next();
+                       final ServiceReference next = iter.next();
 
                     org.osgi.service.log.LogService logger =
                         (org.osgi.service.log.LogService) m_context.getService(next);



Mime
View raw message