activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r564814 [5/8] - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/ activemq-core/src/main/java/org/apache/activemq/advisory/ activemq-core/src/main/java/org/apache/activemq/broker/ activemq-core/src/main/java/org/apache/ac...
Date Sat, 11 Aug 2007 00:49:31 GMT
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportSupport.java Fri Aug 10 17:49:19 2007
@@ -54,10 +54,10 @@
      * @param target
      * @return 'this' if assignable
      */
-    public Object narrow(Class target) {
+    public <T> T narrow(Class<T> target) {
         boolean assignableFrom = target.isAssignableFrom(getClass());
         if (assignableFrom) {
-            return this;
+            return target.cast(this);
         }
         return null;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportThreadSupport.java Fri Aug 10 17:49:19 2007
@@ -24,10 +24,10 @@
  */
 public abstract class TransportThreadSupport extends TransportSupport implements Runnable {
 
-    private boolean daemon = false;
+    private boolean daemon;
     private Thread runner;
     // should be a multiple of 128k
-    private long stackSize = 0;
+    private long stackSize;
 
     public boolean isDaemon() {
         return daemon;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgentFactory.java Fri Aug 10 17:49:19 2007
@@ -26,7 +26,7 @@
 public abstract class DiscoveryAgentFactory {
 
     private static final FactoryFinder DISCOVERY_AGENT_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/transport/discoveryagent/");
-    private static final ConcurrentHashMap DISCOVERY_AGENT_FACTORYS = new ConcurrentHashMap();
+    private static final ConcurrentHashMap<String, DiscoveryAgentFactory> DISCOVERY_AGENT_FACTORYS = new ConcurrentHashMap<String, DiscoveryAgentFactory>();
 
     /**
      * @param uri
@@ -38,7 +38,7 @@
         if (scheme == null) {
             throw new IOException("DiscoveryAgent scheme not specified: [" + uri + "]");
         }
-        DiscoveryAgentFactory daf = (DiscoveryAgentFactory)DISCOVERY_AGENT_FACTORYS.get(scheme);
+        DiscoveryAgentFactory daf = DISCOVERY_AGENT_FACTORYS.get(scheme);
         if (daf == null) {
             // Try to load if from a META-INF property.
             try {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransport.java Fri Aug 10 17:49:19 2007
@@ -39,7 +39,7 @@
 
     private final CompositeTransport next;
     private DiscoveryAgent discoveryAgent;
-    private final ConcurrentHashMap serviceURIs = new ConcurrentHashMap();
+    private final ConcurrentHashMap<String, URI> serviceURIs = new ConcurrentHashMap<String, URI>();
 
     public DiscoveryTransport(CompositeTransport next) {
         super(next);
@@ -79,7 +79,7 @@
     }
 
     public void onServiceRemove(DiscoveryEvent event) {
-        URI uri = (URI)serviceURIs.get(event.getServiceName());
+        URI uri = serviceURIs.get(event.getServiceName());
         if (uri != null) {
             next.remove(new URI[] {uri});
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -33,7 +33,7 @@
 public class DiscoveryTransportFactory extends FailoverTransportFactory {
         
     public Transport createTransport(CompositeData compositData) throws IOException {
-        Map parameters = new HashMap(compositData.getParameters());
+        Map<String, String> parameters = new HashMap<String, String>(compositData.getParameters());
         DiscoveryTransport transport = new DiscoveryTransport(createTransport(parameters));
 
         DiscoveryAgent discoveryAgent = DiscoveryAgentFactory.createDiscoveryAgent(compositData.getComponents()[0]);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java Fri Aug 10 17:49:19 2007
@@ -47,8 +47,9 @@
  * @version $Revision$
  */
 public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable {
-    private static final Log LOG = LogFactory.getLog(MulticastDiscoveryAgent.class);
+
     public static final String DEFAULT_DISCOVERY_URI_STRING = "multicast://239.255.2.3:6155";
+    private static final Log LOG = LogFactory.getLog(MulticastDiscoveryAgent.class);
     private static final String TYPE_SUFFIX = "ActiveMQ-4.";
     private static final String ALIVE = "alive.";
     private static final String DEAD = "dead.";
@@ -60,7 +61,7 @@
     private long initialReconnectDelay = 1000 * 5;
     private long maxReconnectDelay = 1000 * 30;
     private long backOffMultiplier = 2;
-    private boolean useExponentialBackOff = false;
+    private boolean useExponentialBackOff;
     private int maxReconnectAttempts;
 
     class RemoteBrokerData {
@@ -156,8 +157,8 @@
     }
 
     private int timeToLive = 1;
-    private boolean loopBackMode = false;
-    private Map brokersByService = new ConcurrentHashMap();
+    private boolean loopBackMode;
+    private Map<String, RemoteBrokerData> brokersByService = new ConcurrentHashMap<String, RemoteBrokerData>();
     private String group = "default";
     private String brokerName;
     private URI discoveryURI;
@@ -168,11 +169,11 @@
     private MulticastSocket mcast;
     private Thread runner;
     private long keepAliveInterval = DEFAULT_IDLE_TIME;
-    private long lastAdvertizeTime = 0;
+    private long lastAdvertizeTime;
     private AtomicBoolean started = new AtomicBoolean(false);
     private boolean reportAdvertizeFailed = true;
 
-    private final Executor executor = new ThreadPoolExecutor(1, 1, 30, TimeUnit.SECONDS, new LinkedBlockingQueue(), new ThreadFactory() {
+    private final Executor executor = new ThreadPoolExecutor(1, 1, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {
         public Thread newThread(Runnable runable) {
             Thread t = new Thread(runable, "Multicast Discovery Agent Notifier");
             t.setDaemon(true);
@@ -421,7 +422,7 @@
 
     private void processAlive(String brokerName, String service) {
         if (selfService == null || !service.equals(selfService)) {
-            RemoteBrokerData data = (RemoteBrokerData)brokersByService.get(service);
+            RemoteBrokerData data = brokersByService.get(service);
             if (data == null) {
                 data = new RemoteBrokerData(brokerName, service);
                 brokersByService.put(service, data);
@@ -440,7 +441,7 @@
 
     private void processDead(String brokerName, String service) {
         if (!service.equals(selfService)) {
-            RemoteBrokerData data = (RemoteBrokerData)brokersByService.remove(service);
+            RemoteBrokerData data = brokersByService.remove(service);
             if (data != null && !data.isFailed()) {
                 fireServiceRemovedEvent(data);
             }
@@ -449,8 +450,8 @@
 
     private void doExpireOldServices() {
         long expireTime = System.currentTimeMillis() - (keepAliveInterval * HEARTBEAT_MISS_BEFORE_DEATH);
-        for (Iterator i = brokersByService.values().iterator(); i.hasNext();) {
-            RemoteBrokerData data = (RemoteBrokerData)i.next();
+        for (Iterator<RemoteBrokerData> i = brokersByService.values().iterator(); i.hasNext();) {
+            RemoteBrokerData data = i.next();
             if (data.getLastHeartBeat() < expireTime) {
                 processDead(brokerName, data.service);
             }
@@ -468,7 +469,7 @@
     }
 
     public void serviceFailed(DiscoveryEvent event) throws IOException {
-        RemoteBrokerData data = (RemoteBrokerData)brokersByService.get(event.getServiceName());
+        RemoteBrokerData data = brokersByService.get(event.getServiceName());
         if (data != null && data.markFailed()) {
             fireServiceRemovedEvent(data);
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/JmDNSFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/JmDNSFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/JmDNSFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/JmDNSFactory.java Fri Aug 10 17:49:19 2007
@@ -24,7 +24,7 @@
 
 import javax.jmdns.JmDNS;
 
-public class JmDNSFactory {
+public final class JmDNSFactory {
 
     static Map<InetAddress, UsageTracker> registry = new HashMap<InetAddress, UsageTracker>();
 
@@ -33,6 +33,9 @@
         JmDNS jmDNS;
     }
 
+    private JmDNSFactory() {        
+    }
+    
     static synchronized JmDNS create(final InetAddress address) throws IOException {
         UsageTracker tracker = registry.get(address);
         if (tracker == null) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java Fri Aug 10 17:49:19 2007
@@ -51,12 +51,12 @@
     private JmDNS jmdns;
     private InetAddress localAddress;
     private String localhost;
-    private int weight = 0;
-    private int priority = 0;
+    private int weight;
+    private int priority;
 
     private DiscoveryListener listener;
     private String group = "default";
-    private final CopyOnWriteArrayList serviceInfos = new CopyOnWriteArrayList();
+    private final CopyOnWriteArrayList<ServiceInfo> serviceInfos = new CopyOnWriteArrayList<ServiceInfo>();
 
     // DiscoveryAgent interface
     // -------------------------------------------------------------------------
@@ -83,8 +83,8 @@
 
     public void stop() {
         if (jmdns != null) {
-            for (Iterator iter = serviceInfos.iterator(); iter.hasNext();) {
-                ServiceInfo si = (ServiceInfo)iter.next();
+            for (Iterator<ServiceInfo> iter = serviceInfos.iterator(); iter.hasNext();) {
+                ServiceInfo si = iter.next();
                 jmdns.unregisterService(si);
             }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java Fri Aug 10 17:49:19 2007
@@ -35,14 +35,13 @@
     private long initialReconnectDelay = 1000;
     private long maxReconnectDelay = 1000 * 30;
     private long backOffMultiplier = 2;
-    private boolean useExponentialBackOff = false;
+    private boolean useExponentialBackOff;
     private int maxReconnectAttempts;
     private final Object sleepMutex = new Object();
     private long minConnectTime = 500;
-
     private DiscoveryListener listener;
-    String services[] = new String[] {};
-    String group = "DEFAULT";
+    private String services[] = new String[] {};
+    private String group = "DEFAULT";
     private final AtomicBoolean running = new AtomicBoolean(false);
 
     class SimpleDiscoveryEvent extends DiscoveryEvent {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java Fri Aug 10 17:49:19 2007
@@ -56,12 +56,12 @@
 
     private TransportListener transportListener;
     private boolean disposed;
-    private final CopyOnWriteArrayList uris = new CopyOnWriteArrayList();
+    private final CopyOnWriteArrayList<URI> uris = new CopyOnWriteArrayList<URI>();
 
     private final Object reconnectMutex = new Object();
     private final Object sleepMutex = new Object();
     private final ConnectionStateTracker stateTracker = new ConnectionStateTracker();
-    private final ConcurrentHashMap requestMap = new ConcurrentHashMap();
+    private final ConcurrentHashMap<Integer, Command> requestMap = new ConcurrentHashMap<Integer, Command>();
 
     private URI connectedTransportURI;
     private Transport connectedTransport;
@@ -81,61 +81,6 @@
 
     private final TransportListener myTransportListener = createTransportListener();
 
-    TransportListener createTransportListener() {
-        return new TransportListener() {
-            public void onCommand(Object o) {
-                Command command = (Command)o;
-                if (command == null) {
-                    return;
-                }
-                if (command.isResponse()) {
-                    Object object = requestMap.remove(Integer.valueOf(((Response)command).getCorrelationId()));
-                    if (object != null && object.getClass() == Tracked.class) {
-                        ((Tracked)object).onResponses();
-                    }
-                }
-                if (!initialized) {
-                    if (command.isBrokerInfo()) {
-                        BrokerInfo info = (BrokerInfo)command;
-                        BrokerInfo[] peers = info.getPeerBrokerInfos();
-                        if (peers != null) {
-                            for (int i = 0; i < peers.length; i++) {
-                                String brokerString = peers[i].getBrokerURL();
-                                add(brokerString);
-                            }
-                        }
-                        initialized = true;
-                    }
-
-                }
-                if (transportListener != null) {
-                    transportListener.onCommand(command);
-                }
-            }
-
-            public void onException(IOException error) {
-                try {
-                    handleTransportFailure(error);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                    transportListener.onException(new InterruptedIOException());
-                }
-            }
-
-            public void transportInterupted() {
-                if (transportListener != null) {
-                    transportListener.transportInterupted();
-                }
-            }
-
-            public void transportResumed() {
-                if (transportListener != null) {
-                    transportListener.transportResumed();
-                }
-            }
-        };
-    }
-
     public FailoverTransport() throws InterruptedIOException {
 
         stateTracker.setTrackTransactions(true);
@@ -155,14 +100,14 @@
                     if (connectedTransport != null || disposed || connectionFailure != null) {
                         return false;
                     } else {
-                        ArrayList connectList = getConnectList();
+                        ArrayList<Object> connectList = getConnectList();
                         if (connectList.isEmpty()) {
                             failure = new IOException("No uris available to connect to.");
                         } else {
                             if (!useExponentialBackOff) {
                                 reconnectDelay = initialReconnectDelay;
                             }
-                            Iterator iter = connectList.iterator();
+                            Iterator<Object> iter = connectList.iterator();
                             for (int i = 0; iter.hasNext() && connectedTransport == null && !disposed; i++) {
                                 URI uri = (URI)iter.next();
                                 try {
@@ -227,6 +172,62 @@
         }, "ActiveMQ Failover Worker: " + System.identityHashCode(this));
     }
 
+    TransportListener createTransportListener() {
+        return new TransportListener() {
+            public void onCommand(Object o) {
+                Command command = (Command)o;
+                if (command == null) {
+                    return;
+                }
+                if (command.isResponse()) {
+                    Object object = requestMap.remove(Integer.valueOf(((Response)command).getCorrelationId()));
+                    if (object != null && object.getClass() == Tracked.class) {
+                        ((Tracked)object).onResponses();
+                    }
+                }
+                if (!initialized) {
+                    if (command.isBrokerInfo()) {
+                        BrokerInfo info = (BrokerInfo)command;
+                        BrokerInfo[] peers = info.getPeerBrokerInfos();
+                        if (peers != null) {
+                            for (int i = 0; i < peers.length; i++) {
+                                String brokerString = peers[i].getBrokerURL();
+                                add(brokerString);
+                            }
+                        }
+                        initialized = true;
+                    }
+
+                }
+                if (transportListener != null) {
+                    transportListener.onCommand(command);
+                }
+            }
+
+            public void onException(IOException error) {
+                try {
+                    handleTransportFailure(error);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    transportListener.onException(new InterruptedIOException());
+                }
+            }
+
+            public void transportInterupted() {
+                if (transportListener != null) {
+                    transportListener.transportInterupted();
+                }
+            }
+
+            public void transportResumed() {
+                if (transportListener != null) {
+                    transportListener.transportResumed();
+                }
+            }
+        };
+    }
+
+
     final void handleTransportFailure(IOException e) throws InterruptedException {
         if (transportListener != null) {
             transportListener.transportInterupted();
@@ -481,8 +482,8 @@
         }
     }
 
-    private ArrayList getConnectList() {
-        ArrayList l = new ArrayList(uris);
+    private ArrayList<Object> getConnectList() {
+        ArrayList<Object> l = new ArrayList<Object>(uris);
         if (randomize) {
             // Randomly, reorder the list by random swapping
             Random r = new Random();
@@ -505,10 +506,10 @@
         this.transportListener = commandListener;
     }
 
-    public Object narrow(Class target) {
+    public <T> T narrow(Class<T> target) {
 
         if (target.isAssignableFrom(getClass())) {
-            return this;
+            return target.cast(this);
         }
         synchronized (reconnectMutex) {
             if (connectedTransport != null) {
@@ -522,8 +523,8 @@
     protected void restoreTransport(Transport t) throws Exception, IOException {
         t.start();
         stateTracker.restore(t);
-        for (Iterator iter2 = requestMap.values().iterator(); iter2.hasNext();) {
-            Command command = (Command)iter2.next();
+        for (Iterator<Command> iter2 = requestMap.values().iterator(); iter2.hasNext();) {
+            Command command = iter2.next();
             t.oneway(command);
         }
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java Fri Aug 10 17:49:19 2007
@@ -59,13 +59,13 @@
 
     private final Object reconnectMutex = new Object();
     private final ConnectionStateTracker stateTracker = new ConnectionStateTracker();
-    private final ConcurrentHashMap requestMap = new ConcurrentHashMap();
+    private final ConcurrentHashMap<Integer, RequestCounter> requestMap = new ConcurrentHashMap<Integer, RequestCounter>();
 
     private final TaskRunner reconnectTask;
     private boolean started;
 
-    private ArrayList transports = new ArrayList();
-    private int connectedCount = 0;
+    private ArrayList<FanoutTransportHandler> transports = new ArrayList<FanoutTransportHandler>();
+    private int connectedCount;
 
     private int minAckCount = 2;
 
@@ -109,7 +109,7 @@
             Command command = (Command)o;
             if (command.isResponse()) {
                 Integer id = new Integer(((Response)command).getCorrelationId());
-                RequestCounter rc = (RequestCounter)requestMap.get(id);
+                RequestCounter rc = requestMap.get(id);
                 if (rc != null) {
                     if (rc.ackCount.decrementAndGet() <= 0) {
                         requestMap.remove(id);
@@ -179,12 +179,12 @@
                 } else {
 
                     // Try to connect them up.
-                    Iterator iter = transports.iterator();
+                    Iterator<FanoutTransportHandler> iter = transports.iterator();
                     for (int i = 0; iter.hasNext() && !disposed; i++) {
 
                         long now = System.currentTimeMillis();
 
-                        FanoutTransportHandler fanoutHandler = (FanoutTransportHandler)iter.next();
+                        FanoutTransportHandler fanoutHandler = iter.next();
                         if (fanoutHandler.transport != null) {
                             continue;
                         }
@@ -269,8 +269,8 @@
                 return;
             }
             started = true;
-            for (Iterator iter = transports.iterator(); iter.hasNext();) {
-                FanoutTransportHandler th = (FanoutTransportHandler)iter.next();
+            for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {
+                FanoutTransportHandler th = iter.next();
                 if (th.transport != null) {
                     restoreTransport(th);
                 }
@@ -288,8 +288,8 @@
             started = false;
             disposed = true;
 
-            for (Iterator iter = transports.iterator(); iter.hasNext();) {
-                FanoutTransportHandler th = (FanoutTransportHandler)iter.next();
+            for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {
+                FanoutTransportHandler th = iter.next();
                 if (th.transport != null) {
                     ss.stop(th.transport);
                 }
@@ -376,8 +376,8 @@
 
                 // Send the message.
                 if (fanout) {
-                    for (Iterator iter = transports.iterator(); iter.hasNext();) {
-                        FanoutTransportHandler th = (FanoutTransportHandler)iter.next();
+                    for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {
+                        FanoutTransportHandler th = iter.next();
                         if (th.transport != null) {
                             try {
                                 th.transport.oneway(command);
@@ -447,17 +447,17 @@
         this.transportListener = commandListener;
     }
 
-    public Object narrow(Class target) {
+    public <T> T narrow(Class<T> target) {
 
         if (target.isAssignableFrom(getClass())) {
-            return this;
+            return target.cast(this);
         }
 
         synchronized (reconnectMutex) {
-            for (Iterator iter = transports.iterator(); iter.hasNext();) {
-                FanoutTransportHandler th = (FanoutTransportHandler)iter.next();
+            for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {
+                FanoutTransportHandler th = iter.next();
                 if (th.transport != null) {
-                    Object rc = th.transport.narrow(target);
+                    T rc = th.transport.narrow(target);
                     if (rc != null) {
                         return rc;
                     }
@@ -473,8 +473,8 @@
         th.transport.start();
         stateTracker.setRestoreConsumers(th.transport == primary);
         stateTracker.restore(th.transport);
-        for (Iterator iter2 = requestMap.values().iterator(); iter2.hasNext();) {
-            RequestCounter rc = (RequestCounter)iter2.next();
+        for (Iterator<RequestCounter> iter2 = requestMap.values().iterator(); iter2.hasNext();) {
+            RequestCounter rc = iter2.next();
             th.transport.oneway(rc.command);
         }
     }
@@ -486,8 +486,8 @@
                 URI uri = uris[i];
 
                 boolean match = false;
-                for (Iterator iter = transports.iterator(); iter.hasNext();) {
-                    FanoutTransportHandler th = (FanoutTransportHandler)iter.next();
+                for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {
+                    FanoutTransportHandler th = iter.next();
                     if (th.uri.equals(uri)) {
                         match = true;
                         break;
@@ -509,9 +509,8 @@
             for (int i = 0; i < uris.length; i++) {
                 URI uri = uris[i];
 
-                boolean match = false;
-                for (Iterator iter = transports.iterator(); iter.hasNext();) {
-                    FanoutTransportHandler th = (FanoutTransportHandler)iter.next();
+                for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) {
+                    FanoutTransportHandler th = iter.next();
                     if (th.uri.equals(uri)) {
                         if (th.transport != null) {
                             ServiceSupport.dispose(th.transport);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -64,7 +64,7 @@
     public Transport createTransport(URI location) throws IOException, URISyntaxException {
 
         CompositeData compositData = URISupport.parseComposite(location);
-        Map parameters = new HashMap(compositData.getParameters());
+        Map<String, String> parameters = new HashMap<String, String>(compositData.getParameters());
         DiscoveryTransport transport = new DiscoveryTransport(createTransport(parameters));
 
         DiscoveryAgent discoveryAgent = DiscoveryAgentFactory.createDiscoveryAgent(compositData.getComponents()[0]);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java Fri Aug 10 17:49:19 2007
@@ -111,9 +111,9 @@
         getTransportListener().onException(error);
     }
 
-    public Object narrow(Class target) {
+    public <T> T narrow(Class<T> target) {
         if (target.isAssignableFrom(getClass())) {
-            return this;
+            return target.cast(this);
         }
         return getNext().narrow(target);
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastDatagramHeaderMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastDatagramHeaderMarshaller.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastDatagramHeaderMarshaller.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastDatagramHeaderMarshaller.java Fri Aug 10 17:49:19 2007
@@ -30,11 +30,9 @@
  */
 public class MulticastDatagramHeaderMarshaller extends DatagramHeaderMarshaller {
 
-    private final String localUri;
     private final byte[] localUriAsBytes;
 
     public MulticastDatagramHeaderMarshaller(String localUri) {
-        this.localUri = localUri;
         this.localUriAsBytes = localUri.getBytes();
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/multicast/MulticastTransport.java Fri Aug 10 17:49:19 2007
@@ -50,7 +50,7 @@
     private InetAddress mcastAddress;
     private int mcastPort;
     private int timeToLive = 1;
-    private boolean loopBackMode = false;
+    private boolean loopBackMode;
     private long keepAliveInterval = DEFAULT_IDLE_TIME;
 
     public MulticastTransport(OpenWireFormat wireFormat, URI remoteLocation) throws UnknownHostException, IOException {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -69,7 +69,7 @@
                 broker = ID_GENERATOR.generateSanitizedId();
             }
 
-            final Map brokerOptions = new HashMap(URISupport.parseParamters(location));
+            final Map<String, String> brokerOptions = new HashMap<String, String>(URISupport.parseParamters(location));
             if (!brokerOptions.containsKey("persistent")) {
                 brokerOptions.put("persistent", "false");
             }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/DefaultReplayBuffer.java Fri Aug 10 17:49:19 2007
@@ -33,7 +33,7 @@
 
     private final int size;
     private ReplayBufferListener listener;
-    private Map map;
+    private Map<Integer, Object> map;
     private int lowestCommandId = 1;
     private Object lock = new Object();
 
@@ -77,8 +77,8 @@
         }
     }
 
-    protected Map createMap(int maximumSize) {
-        return new HashMap(maximumSize);
+    protected Map<Integer, Object> createMap(int maximumSize) {
+        return new HashMap<Integer, Object>(maximumSize);
     }
 
     protected void onEvictedBuffer(int commandId, Object buffer) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/reliable/ReliableTransport.java Fri Aug 10 17:49:19 2007
@@ -41,7 +41,7 @@
     private static final Log LOG = LogFactory.getLog(ReliableTransport.class);
 
     private ReplayStrategy replayStrategy;
-    private SortedSet commands = new TreeSet(new CommandIdComparator());
+    private SortedSet<Command> commands = new TreeSet<Command>(new CommandIdComparator());
     private int expectedCounter = 1;
     private int replayBufferCommandCount = 50;
     private int requestTimeout = 2000;
@@ -123,7 +123,7 @@
                 int nextCounter = actualCounter;
                 boolean empty = commands.isEmpty();
                 if (!empty) {
-                    Command nextAvailable = (Command)commands.first();
+                    Command nextAvailable = commands.first();
                     nextCounter = nextAvailable.getCommandId();
                 }
 
@@ -144,7 +144,7 @@
                 if (!empty) {
                     // lets see if the first item in the set is the next
                     // expected
-                    command = (Command)commands.first();
+                    command = commands.first();
                     valid = expectedCounter == command.getCommandId();
                     if (valid) {
                         commands.remove(command);
@@ -165,7 +165,7 @@
                 if (valid) {
                     // lets see if the first item in the set is the next
                     // expected
-                    command = (Command)commands.first();
+                    command = commands.first();
                     valid = expectedCounter == command.getCommandId();
                     if (valid) {
                         commands.remove(command);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java Fri Aug 10 17:49:19 2007
@@ -75,9 +75,11 @@
             }
 
             // now lets add all the message headers
-            final Map properties = message.getProperties();
+            final Map<String, Object> properties = message.getProperties();
             if (properties != null) {
-                headers.putAll(properties);
+                for (Map.Entry<String, Object> prop : properties.entrySet()) {
+                    headers.put(prop.getKey(), "" + prop.getValue());
+                }
             }
         }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java Fri Aug 10 17:49:19 2007
@@ -56,7 +56,7 @@
     public StompFrame convertMessage(ActiveMQMessage message) throws IOException, JMSException {
         StompFrame command = new StompFrame();
         command.setAction(Stomp.Responses.MESSAGE);
-        Map headers = new HashMap(25);
+        Map<String, String> headers = new HashMap<String, String>(25);
         command.setHeaders(headers);
 
         FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame(message, command, this);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java Fri Aug 10 17:49:19 2007
@@ -37,10 +37,10 @@
     private static final byte[] NO_DATA = new byte[] {};
 
     private String action;
-    private Map<String,String> headers = new HashMap<String,String>();
+    private Map<String, String> headers = new HashMap<String, String>();
     private byte[] content = NO_DATA;
 
-    public StompFrame(String command, Map<String,String> headers, byte[] data) {
+    public StompFrame(String command, Map<String, String> headers, byte[] data) {
         this.action = command;
         this.headers = headers;
         this.content = data;
@@ -65,11 +65,11 @@
         this.content = data;
     }
 
-    public Map<String,String> getHeaders() {
+    public Map<String, String> getHeaders() {
         return headers;
     }
 
-    public void setHeaders(Map<String,String> headers) {
+    public void setHeaders(Map<String, String> headers) {
         this.headers = headers;
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java Fri Aug 10 17:49:19 2007
@@ -45,7 +45,7 @@
     private final String subscriptionId;
     private final ConsumerInfo consumerInfo;
 
-    private final LinkedHashMap dispatchedMessage = new LinkedHashMap();
+    private final LinkedHashMap<String, MessageId> dispatchedMessage = new LinkedHashMap<String, MessageId>();
 
     private String ackMode = AUTO_ACK;
     private ActiveMQDestination destination;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java Fri Aug 10 17:49:19 2007
@@ -103,7 +103,7 @@
             }
 
             // Parse the headers
-            HashMap headers = new HashMap(25);
+            HashMap<String, String> headers = new HashMap<String, String>(25);
             while (true) {
                 String line = readLine(in, MAX_HEADER_LENGTH, "The maximum header length was exceeded");
                 if (line != null && line.trim().length() > 0) {
@@ -127,7 +127,7 @@
 
             // Read in the data part.
             byte[] data = NO_DATA;
-            String contentLength = (String)headers.get(Stomp.Headers.CONTENT_LENGTH);
+            String contentLength = headers.get(Stomp.Headers.CONTENT_LENGTH);
             if (contentLength != null) {
 
                 // Bless the client, he's telling us how much data to read in.

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -75,13 +75,13 @@
      */
     public TransportServer doBind(String brokerId, final URI location) throws IOException {
         try {
-            Map options = new HashMap(URISupport.parseParamters(location));
+            Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(location));
 
             ServerSocketFactory serverSocketFactory = createServerSocketFactory();
             SslTransportServer server = new SslTransportServer(this, location, (SSLServerSocketFactory)serverSocketFactory);
             server.setWireFormatFactory(createWireFormatFactory(options));
             IntrospectionSupport.setProperties(server, options);
-            Map transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
+            Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
             server.setTransportOption(transportOptions);
             server.bind();
 
@@ -99,7 +99,7 @@
         SslTransport sslTransport = (SslTransport)transport.narrow(SslTransport.class);
         IntrospectionSupport.setProperties(sslTransport, options);
 
-        Map socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
+        Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
 
         sslTransport.setSocketOptions(socketOptions);
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportServer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportServer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportServer.java Fri Aug 10 17:49:19 2007
@@ -40,10 +40,10 @@
 public class SslTransportServer extends TcpTransportServer {
     
     // Specifies if sockets created from this server should needClientAuth.
-    private boolean needClientAuth = false;
+    private boolean needClientAuth;
     
     // Specifies if sockets created from this server should wantClientAuth.
-    private boolean wantClientAuth = false;
+    private boolean wantClientAuth;
     
     
     /**

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpBufferedOutputStream.java Fri Aug 10 17:49:19 2007
@@ -33,7 +33,6 @@
     private byte[] buffer;
     private int bufferlen;
     private int count;
-    private boolean closed;
 
     /**
      * Constructor
@@ -115,18 +114,6 @@
      */
     public void close() throws IOException {
         super.close();
-        closed = true;
-    }
-
-    /**
-     * Checks that the stream has not been closed
-     * 
-     * @throws IOException
-     */
-    private void checkClosed() throws IOException {
-        if (closed) {
-            throw new EOFException("Cannot write to the stream any more it has already been closed");
-        }
     }
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java Fri Aug 10 17:49:19 2007
@@ -56,7 +56,7 @@
     protected final WireFormat wireFormat;
 
     protected int connectionTimeout = 30000;
-    protected int soTimeout = 0;
+    protected int soTimeout;
     protected int socketBufferSize = 64 * 1024;
     protected int ioBufferSize = 8 * 1024;
     protected Socket socket;
@@ -68,7 +68,7 @@
     protected SocketFactory socketFactory;
     protected final AtomicReference<CountDownLatch> stoppedLatch = new AtomicReference<CountDownLatch>();
 
-    private Map socketOptions;
+    private Map<String, Object> socketOptions;
     private Boolean keepAlive;
     private Boolean tcpNoDelay;
 
@@ -82,7 +82,8 @@
      * @throws IOException
      * @throws UnknownHostException
      */
-    public TcpTransport(WireFormat wireFormat, SocketFactory socketFactory, URI remoteLocation, URI localLocation) throws UnknownHostException, IOException {
+    public TcpTransport(WireFormat wireFormat, SocketFactory socketFactory, URI remoteLocation,
+                        URI localLocation) throws UnknownHostException, IOException {
         this.wireFormat = wireFormat;
         this.socketFactory = socketFactory;
         try {
@@ -313,7 +314,8 @@
         InetSocketAddress remoteAddress = null;
 
         if (localLocation != null) {
-            localAddress = new InetSocketAddress(InetAddress.getByName(localLocation.getHost()), localLocation.getPort());
+            localAddress = new InetSocketAddress(InetAddress.getByName(localLocation.getHost()),
+                                                 localLocation.getPort());
         }
 
         if (remoteLocation != null) {
@@ -341,7 +343,8 @@
             // For SSL sockets.. you can't create an unconnected socket :(
             // This means the timout option are not supported either.
             if (localAddress != null) {
-                socket = socketFactory.createSocket(remoteAddress.getAddress(), remoteAddress.getPort(), localAddress.getAddress(), localAddress.getPort());
+                socket = socketFactory.createSocket(remoteAddress.getAddress(), remoteAddress.getPort(),
+                                                    localAddress.getAddress(), localAddress.getPort());
             } else {
                 socket = socketFactory.createSocket(remoteAddress.getAddress(), remoteAddress.getPort());
             }
@@ -392,8 +395,8 @@
         }
     }
 
-    public void setSocketOptions(Map socketOptions) {
-        this.socketOptions = new HashMap(socketOptions);
+    public void setSocketOptions(Map<String, Object> socketOptions) {
+        this.socketOptions = new HashMap<String, Object>(socketOptions);
     }
 
     public String getRemoteAddress() {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -45,13 +45,13 @@
 
     public TransportServer doBind(String brokerId, final URI location) throws IOException {
         try {
-            Map options = new HashMap(URISupport.parseParamters(location));
+            Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(location));
 
             ServerSocketFactory serverSocketFactory = createServerSocketFactory();
             TcpTransportServer server = createTcpTransportServer(location, serverSocketFactory);
             server.setWireFormatFactory(createWireFormatFactory(options));
             IntrospectionSupport.setProperties(server, options);
-            Map transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
+            Map<String, Object> transportOptions = IntrospectionSupport.extractProperties(options, "transport.");
             server.setTransportOption(transportOptions);
             server.bind();
 
@@ -80,7 +80,7 @@
         TcpTransport tcpTransport = (TcpTransport)transport.narrow(TcpTransport.class);
         IntrospectionSupport.setProperties(tcpTransport, options);
 
-        Map socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
+        Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(options, "socket.");
         tcpTransport.setSocketOptions(socketOptions);
 
         if (tcpTransport.isTrace()) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java Fri Aug 10 17:49:19 2007
@@ -58,7 +58,7 @@
     protected long maxInactivityDuration = 30000;
     protected int minmumWireFormatVersion;
     protected boolean trace;
-    protected Map transportOptions;
+    protected Map<String, Object> transportOptions;
     protected final ServerSocketFactory serverSocketFactory;
 
     public TcpTransportServer(TcpTransportFactory transportFactory, URI location, ServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException {
@@ -159,7 +159,7 @@
                     if (isStopped() || getAcceptListener() == null) {
                         socket.close();
                     } else {
-                        HashMap options = new HashMap();
+                        HashMap<String, Object> options = new HashMap<String, Object>();
                         options.put("maxInactivityDuration", Long.valueOf(maxInactivityDuration));
                         options.put("minmumWireFormatVersion", Integer.valueOf(minmumWireFormatVersion));
                         options.put("trace", Boolean.valueOf(trace));
@@ -228,7 +228,7 @@
         return (InetSocketAddress)serverSocket.getLocalSocketAddress();
     }
 
-    public void setTransportOption(Map transportOptions) {
+    public void setTransportOption(Map<String, Object> transportOptions) {
         this.transportOptions = transportOptions;
     }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramChannel.java Fri Aug 10 17:49:19 2007
@@ -126,7 +126,8 @@
                 // lets split the command up into chunks
                 int offset = 0;
                 boolean lastFragment = false;
-                for (int fragment = 0, length = data.length; !lastFragment; fragment++) {
+                int length = data.length;
+                for (int fragment = 0; !lastFragment; fragment++) {
                     // write the header
                     if (fragment > 0) {
                         writeBuffer = bufferPool.borrowBuffer();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandDatagramSocket.java Fri Aug 10 17:49:19 2007
@@ -104,7 +104,8 @@
                 // lets split the command up into chunks
                 byte[] data = writeBuffer.toByteArray();
                 boolean lastFragment = false;
-                for (int fragment = 0, length = data.length; !lastFragment; fragment++) {
+                int length = data.length;
+                for (int fragment = 0; !lastFragment; fragment++) {
                     writeBuffer = createByteArrayOutputStream();
                     headerMarshaller.writeHeader(command, dataOut);
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DatagramHeaderMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DatagramHeaderMarshaller.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DatagramHeaderMarshaller.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DatagramHeaderMarshaller.java Fri Aug 10 17:49:19 2007
@@ -37,7 +37,7 @@
     // TODO for large dynamic networks
     // we may want to evict endpoints that disconnect
     // from a transport - e.g. for multicast
-    private Map endpoints = new HashMap();
+    private Map<SocketAddress, Endpoint> endpoints = new HashMap<SocketAddress, Endpoint>();
     
     /**
      * Reads any header if applicable and then creates an endpoint object
@@ -71,7 +71,7 @@
      * 
      */
     protected Endpoint getEndpoint(SocketAddress address) {
-        Endpoint endpoint = (Endpoint) endpoints.get(address);
+        Endpoint endpoint = endpoints.get(address);
         if (endpoint == null) {
             endpoint = createEndpoint(address);
             endpoints.put(address, endpoint);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/DefaultBufferPool.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
  */
 public class DefaultBufferPool extends SimpleBufferPool implements ByteBufferPool {
 
-    private List buffers = new ArrayList();
+    private List<ByteBuffer> buffers = new ArrayList<ByteBuffer>();
     private Object lock = new Object();
 
     public DefaultBufferPool() {
@@ -43,7 +43,7 @@
         synchronized (lock) {
             int size = buffers.size();
             if (size > 0) {
-                return (ByteBuffer) buffers.remove(size - 1);
+                return buffers.remove(size - 1);
             }
         }
         return createBuffer();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java Fri Aug 10 17:49:19 2007
@@ -64,11 +64,11 @@
     private SocketAddress targetAddress;
     private SocketAddress originalTargetAddress;
     private DatagramChannel channel;
-    private boolean trace = false;
+    private boolean trace;
     private boolean useLocalHost = true;
     private int port;
     private int minmumWireFormatVersion;
-    private String description = null;
+    private String description;
     private IntSequenceGenerator sequenceGenerator;
     private boolean replayEnabled = true;
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -44,7 +44,7 @@
 
     public TransportServer doBind(String brokerId, final URI location) throws IOException {
         try {
-            Map options = new HashMap(URISupport.parseParamters(location));
+            Map<String, String> options = new HashMap<String, String>(URISupport.parseParamters(location));
             if (options.containsKey("port")) {
                 throw new IllegalArgumentException("The port property cannot be specified on a UDP server transport - please use the port in the URI syntax");
             }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java Fri Aug 10 17:49:19 2007
@@ -52,7 +52,7 @@
     private ReplayStrategy replayStrategy;
     private Transport configuredTransport;
     private boolean usingWireFormatNegotiation;
-    private Map transports = new HashMap();
+    private Map<DatagramEndpoint, Transport> transports = new HashMap<DatagramEndpoint, Transport>();
 
     public UdpTransportServer(URI connectURI, UdpTransport serverTransport, Transport configuredTransport, ReplayStrategy replayStrategy) {
         super(connectURI);
@@ -108,7 +108,7 @@
         }
         Transport transport = null;
         synchronized (transports) {
-            transport = (Transport)transports.get(endpoint);
+            transport = transports.get(endpoint);
             if (transport == null) {
                 if (usingWireFormatNegotiation && !command.isWireFormatInfo()) {
                     LOG.error("Received inbound server communication from: " + command.getFrom() + " expecting WireFormatInfo but was command: " + command);
@@ -146,7 +146,7 @@
         final UdpTransport transport = new UdpTransport(connectionWireFormat, address);
 
         final ReliableTransport reliableTransport = new ReliableTransport(transport, transport);
-        Replayer replayer = reliableTransport.getReplayer();
+        reliableTransport.getReplayer();
         reliableTransport.setReplayStrategy(replayStrategy);
 
         // Joiner must be on outside as the inbound messages must be processed

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java Fri Aug 10 17:49:19 2007
@@ -41,7 +41,6 @@
  */
 public class VMTransport implements Transport, Task {
 
-    private static final Log LOG = LogFactory.getLog(VMTransport.class);
     private static final AtomicLong NEXT_ID = new AtomicLong(0);
     private static final TaskRunnerFactory TASK_RUNNER_FACTORY = new TaskRunnerFactory("VMTransport", Thread.NORM_PRIORITY, true, 1000);
     protected VMTransport peer;
@@ -51,7 +50,7 @@
     protected boolean network;
     protected boolean async = true;
     protected int asyncQueueDepth = 2000;
-    protected LinkedBlockingQueue messageQueue;
+    protected LinkedBlockingQueue<Object> messageQueue;
     protected boolean started;
     protected final URI location;
     protected final long id;
@@ -139,10 +138,10 @@
         }
     }
 
-    private LinkedBlockingQueue getMessageQueue() {
+    private LinkedBlockingQueue<Object> getMessageQueue() {
         synchronized (mutex) {
             if (messageQueue == null) {
-                messageQueue = new LinkedBlockingQueue(this.asyncQueueDepth);
+                messageQueue = new LinkedBlockingQueue<Object>(this.asyncQueueDepth);
             }
             return messageQueue;
         }
@@ -182,9 +181,9 @@
         }
     }
 
-    public Object narrow(Class target) {
+    public <T> T narrow(Class<T> target) {
         if (target.isAssignableFrom(getClass())) {
-            return this;
+            return target.cast(this);
         }
         return null;
     }
@@ -228,7 +227,7 @@
             }
         }
 
-        LinkedBlockingQueue mq = getMessageQueue();
+        LinkedBlockingQueue<Object> mq = getMessageQueue();
         final Command command = (Command)mq.poll();
         if (command != null) {
             tl.onCommand(command);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java Fri Aug 10 17:49:19 2007
@@ -42,9 +42,9 @@
 
 public class VMTransportFactory extends TransportFactory {
     
-    public static final ConcurrentHashMap BROKERS = new ConcurrentHashMap();
-    public static final ConcurrentHashMap CONNECTORS = new ConcurrentHashMap();
-    public static final ConcurrentHashMap SERVERS = new ConcurrentHashMap();
+    public static final ConcurrentHashMap<String, BrokerService> BROKERS = new ConcurrentHashMap<String, BrokerService>();
+    public static final ConcurrentHashMap<String, TransportConnector> CONNECTORS = new ConcurrentHashMap<String, TransportConnector>();
+    public static final ConcurrentHashMap<String, VMTransportServer> SERVERS = new ConcurrentHashMap<String, VMTransportServer>();
     private static final Log LOG = LogFactory.getLog(VMTransportFactory.class);
     
     BrokerFactoryHandler brokerFactoryHandler;
@@ -56,7 +56,7 @@
     public Transport doCompositeConnect(URI location) throws Exception {
         URI brokerURI;
         String host;
-        Map options;
+        Map<String, String> options;
         boolean create = true;
         CompositeData data = URISupport.parseComposite(location);
         if (data.getComponents().length == 1 && "broker".equals(data.getComponents()[0].getScheme())) {
@@ -96,7 +96,7 @@
         if (host == null) {
             host = "localhost";
         }
-        VMTransportServer server = (VMTransportServer)SERVERS.get(host);
+        VMTransportServer server = SERVERS.get(host);
         // validate the broker is still active
         if (!validateBroker(host) || server == null) {
             BrokerService broker = null;
@@ -123,7 +123,7 @@
                     BROKERS.put(host, broker);
                 }
 
-                server = (VMTransportServer)SERVERS.get(host);
+                server = SERVERS.get(host);
                 if (server == null) {
                     server = (VMTransportServer)bind(location, true);
                     TransportConnector connector = new TransportConnector(broker.getBroker(), server);
@@ -140,7 +140,7 @@
         IntrospectionSupport.setProperties(vmtransport, options);
         Transport transport = vmtransport;
         if (vmtransport.isMarshal()) {
-            HashMap optionsCopy = new HashMap(options);
+            Map<String, String> optionsCopy = new HashMap<String, String>(options);
             transport = new MarshallingTransportFilter(transport, createWireFormat(options),
                                                        createWireFormat(optionsCopy));
         }
@@ -174,11 +174,11 @@
     public static void stopped(VMTransportServer server) {
         String host = server.getBindURI().getHost();
         SERVERS.remove(host);
-        TransportConnector connector = (TransportConnector)CONNECTORS.remove(host);
+        TransportConnector connector = CONNECTORS.remove(host);
         if (connector != null) {
             LOG.debug("Shutting down VM connectors for broker: " + host);
             ServiceSupport.dispose(connector);
-            BrokerService broker = (BrokerService)BROKERS.remove(host);
+            BrokerService broker = BROKERS.remove(host);
             if (broker != null) {
                 ServiceSupport.dispose(broker);
             }
@@ -187,11 +187,11 @@
 
     public static void stopped(String host) {
         SERVERS.remove(host);
-        TransportConnector connector = (TransportConnector)CONNECTORS.remove(host);
+        TransportConnector connector = CONNECTORS.remove(host);
         if (connector != null) {
             LOG.debug("Shutting down VM connectors for broker: " + host);
             ServiceSupport.dispose(connector);
-            BrokerService broker = (BrokerService)BROKERS.remove(host);
+            BrokerService broker = BROKERS.remove(host);
             if (broker != null) {
                 ServiceSupport.dispose(broker);
             }
@@ -210,7 +210,7 @@
         boolean result = true;
         if (BROKERS.containsKey(host) || SERVERS.containsKey(host) || CONNECTORS.containsKey(host)) {
             // check the broker is still in the BrokerRegistry
-            TransportConnector connector = (TransportConnector)CONNECTORS.get(host);
+            TransportConnector connector = CONNECTORS.get(host);
             if (BrokerRegistry.getInstance().lookup(host) == null
                 || (connector != null && connector.getBroker().isStopped())) {
                 result = false;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/BrokerSupport.java Fri Aug 10 17:49:19 2007
@@ -23,8 +23,11 @@
 import org.apache.activemq.command.ProducerInfo;
 import org.apache.activemq.state.ProducerState;
 
-public class BrokerSupport {
+public final class BrokerSupport {
 
+    private BrokerSupport() {        
+    }
+    
     /**
      * @param context
      * @param message

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/ByteSequenceData.java Fri Aug 10 17:49:19 2007
@@ -23,6 +23,9 @@
  */
 public final class ByteSequenceData {
 
+    private ByteSequenceData() {    
+    }
+    
     public static byte[] toByteArray(ByteSequence packet) {
         if (packet.offset == 0 && packet.length == packet.data.length) {
             return packet.data;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayInputStream.java Fri Aug 10 17:49:19 2007
@@ -252,7 +252,9 @@
     public String readUTF() throws IOException {
         int length = readUnsignedShort();
         char[] characters = new char[length];
-        int c, c2, c3;
+        int c;
+        int c2;
+        int c3;
         int count = 0;
         int total = pos + length;
         while (pos < total) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java Fri Aug 10 17:49:19 2007
@@ -216,7 +216,7 @@
                 encodedsize += 2;
             }
         }
-        if (encodedsize > 65535){
+        if (encodedsize > 65535) {
             throw new UTFDataFormatException("encoded string too long: " + encodedsize + " bytes");
         }
         ensureEnoughBuffer(pos + encodedsize + 2);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/FactoryFinder.java Fri Aug 10 17:49:19 2007
@@ -25,7 +25,7 @@
 public class FactoryFinder {
 
     private final String path;
-    private final ConcurrentHashMap classMap = new ConcurrentHashMap();
+    private final ConcurrentHashMap<String, Class> classMap = new ConcurrentHashMap<String, Class>();
 
     public FactoryFinder(String path) {
         this.path = path;
@@ -47,7 +47,7 @@
             propertyPrefix = "";
         }
 
-        Class clazz = (Class)classMap.get(propertyPrefix + key);
+        Class clazz = classMap.get(propertyPrefix + key);
         if (clazz == null) {
             clazz = newInstance(doFindFactoryProperies(key), propertyPrefix);
             classMap.put(propertyPrefix + key, clazz);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/HexSupport.java Fri Aug 10 17:49:19 2007
@@ -21,7 +21,7 @@
  * 
  * @version $Revision: 1.2 $
  */
-public class HexSupport {
+public final class HexSupport {
     
     private static final String[] HEX_TABLE = new String[]{
         "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
@@ -41,6 +41,9 @@
         "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef",
         "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff",
     };
+    
+    private HexSupport() {
+    }
     
     /**
      * @param hex

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOExceptionSupport.java Fri Aug 10 17:49:19 2007
@@ -20,6 +20,9 @@
 
 public final class IOExceptionSupport {
 
+    private IOExceptionSupport() {
+    }
+
     public static IOException create(String msg, Throwable cause) {
         IOException exception = new IOException(msg);
         exception.initCause(cause);
@@ -31,7 +34,7 @@
         exception.initCause(cause);
         return exception;
     }
-    
+
     public static IOException create(Throwable cause) {
         IOException exception = new IOException(cause.getMessage());
         exception.initCause(cause);
@@ -43,5 +46,5 @@
         exception.initCause(cause);
         return exception;
     }
-    
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOHelper.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOHelper.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOHelper.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IOHelper.java Fri Aug 10 17:49:19 2007
@@ -19,7 +19,10 @@
 /**
  * @version $Revision$
  */
-public class IOHelper {
+public final class IOHelper {
+
+    private IOHelper() {
+    }
 
     public static String getDefaultDataDirectory() {
         return getDefaultDirectoryPrefix() + "activemq-data";

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IdGenerator.java Fri Aug 10 17:49:19 2007
@@ -64,20 +64,8 @@
     }
 
     /**
-     * As we have to find the hostname as a side-affect of generating a unique
-     * stub, we allow it's easy retrevial here
-     * 
-     * @return the local host name
-     */
-
-    public static String getHostName() {
-        return hostName;
-    }
-
-    /**
      * Construct an IdGenerator
      */
-
     public IdGenerator(String prefix) {
         synchronized (UNIQUE_STUB) {
             this.seed = prefix + UNIQUE_STUB + (instanceCount++) + ":";
@@ -87,6 +75,18 @@
     public IdGenerator() {
         this("ID:" + hostName);
     }
+
+    /**
+     * As we have to find the hostname as a side-affect of generating a unique
+     * stub, we allow it's easy retrevial here
+     * 
+     * @return the local host name
+     */
+
+    public static String getHostName() {
+        return hostName;
+    }
+
 
     /**
      * Generate a unqiue id

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java Fri Aug 10 17:49:19 2007
@@ -33,7 +33,10 @@
 
 import org.apache.activemq.command.ActiveMQDestination;
 
-public class IntrospectionSupport {
+public final class IntrospectionSupport {
+    
+    private IntrospectionSupport() {
+    }
 
     public static boolean getProperties(Object target, Map props, String optionPrefix) {
 
@@ -92,8 +95,8 @@
             throw new IllegalArgumentException("props was null.");
         }
 
-        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
-            String name = (String)iter.next();
+        for (Iterator<String> iter = props.keySet().iterator(); iter.hasNext();) {
+            String name = iter.next();
             if (name.startsWith(optionPrefix)) {
                 Object value = props.get(name);
                 name = name.substring(optionPrefix.length());
@@ -106,12 +109,12 @@
         return rc;
     }
 
-    public static Map extractProperties(Map props, String optionPrefix) {
+    public static Map<String, Object> extractProperties(Map props, String optionPrefix) {
         if (props == null) {
             throw new IllegalArgumentException("props was null.");
         }
 
-        HashMap rc = new HashMap(props.size());
+        HashMap<String, Object> rc = new HashMap<String, Object>(props.size());
 
         for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
             String name = (String)iter.next();
@@ -225,7 +228,7 @@
     }
 
     public static String toString(Object target, Class stopClass) {
-        LinkedHashMap map = new LinkedHashMap();
+        LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
         addFields(target, target.getClass(), stopClass, map);
         StringBuffer buffer = new StringBuffer(simpleName(target.getClass()));
         buffer.append(" {");
@@ -264,7 +267,7 @@
         return name;
     }
 
-    private static void addFields(Object target, Class startClass, Class stopClass, LinkedHashMap map) {
+    private static void addFields(Object target, Class startClass, Class<Object> stopClass, LinkedHashMap<String, Object> map) {
 
         if (startClass != stopClass) {
             addFields(target, startClass.getSuperclass(), stopClass, map);
@@ -273,7 +276,8 @@
         Field[] fields = startClass.getDeclaredFields();
         for (int i = 0; i < fields.length; i++) {
             Field field = fields[i];
-            if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers()) || Modifier.isPrivate(field.getModifiers())) {
+            if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers())
+                || Modifier.isPrivate(field.getModifiers())) {
                 continue;
             }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMSExceptionSupport.java Fri Aug 10 17:49:19 2007
@@ -22,6 +22,9 @@
 
 public final class JMSExceptionSupport {
 
+    private JMSExceptionSupport() {
+    }
+
     public static JMSException create(String msg, Throwable cause) {
         JMSException exception = new JMSException(msg);
         exception.initCause(cause);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/JMXSupport.java Fri Aug 10 17:49:19 2007
@@ -16,9 +16,13 @@
  */
 package org.apache.activemq.util;
 
-public class JMXSupport {
+public final class JMXSupport {
+
+    private JMXSupport() {
+    }
+
     public static String encodeObjectNamePart(String part) {
-        //return ObjectName.quote(part);
+        // return ObjectName.quote(part);
         String answer = part.replaceAll("[\\:\\,\\'\\\"]", "_");
         answer = answer.replaceAll("\\?", "&qe;");
         answer = answer.replaceAll("=", "&amp;");

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MapHelper.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MapHelper.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MapHelper.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MapHelper.java Fri Aug 10 17:49:19 2007
@@ -23,7 +23,11 @@
  * 
  * @version $Revision$
  */
-public class MapHelper {
+public final class MapHelper {
+
+    private MapHelper() {
+    }
+
     /**
      * Extracts the value from the map and coerces to a String
      */



Mime
View raw message