activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r564814 [3/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/management/JMSStatsImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/JMSStatsImpl.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/JMSStatsImpl.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/JMSStatsImpl.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
  * @version $Revision: 1.2 $
  */
 public class JMSStatsImpl extends StatsImpl {
-    private List connections = new CopyOnWriteArrayList();
+    private List<ActiveMQConnection> connections = new CopyOnWriteArrayList<ActiveMQConnection>();
 
     public JMSStatsImpl() {
     }
@@ -73,7 +73,8 @@
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
         JMSConnectionStatsImpl[] stats = getConnections();
-        for (int i = 0, size = stats.length; i < size; i++) {
+        int size = stats.length;
+        for (int i = 0; i < size; i++) {
             stats[i].setEnabled(enabled);
         }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatisticImpl.java Fri Aug 10 17:49:19 2007
@@ -24,12 +24,14 @@
  * @version $Revision: 1.2 $
  */
 public class StatisticImpl implements Statistic, Resettable {
+
+    protected boolean enabled;
+
     private String name;
     private String unit;
     private String description;
     private long startTime;
     private long lastSampleTime;
-    protected boolean enabled;
 
     public StatisticImpl(String name, String unit, String description) {
         this.name = name;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatsImpl.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatsImpl.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatsImpl.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/management/StatsImpl.java Fri Aug 10 17:49:19 2007
@@ -29,7 +29,7 @@
     private Map<String, StatisticImpl> map;
 
     public StatsImpl() {
-        this(new HashMap());
+        this(new HashMap<String, StatisticImpl>());
     }
 
     public StatsImpl(Map<String, StatisticImpl> map) {
@@ -39,7 +39,8 @@
 
     public void reset() {
         Statistic[] stats = getStatistics();
-        for (int i = 0, size = stats.length; i < size; i++) {
+        int size = stats.length;
+        for (int i = 0; i < size; i++) {
             Statistic stat = stats[i];
             if (stat instanceof Resettable) {
                 Resettable r = (Resettable)stat;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/LRUMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/LRUMap.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/LRUMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/LRUMap.java Fri Aug 10 17:49:19 2007
@@ -25,10 +25,10 @@
  * @version $Revision:$
  */
 public class LRUMap extends LinkedHashMap {
-    private static final long serialVersionUID = -9179676638408888162L;
 
     protected static final float DEFAULT_LOAD_FACTOR = (float) 0.75;
     protected static final int DEFAULT_INITIAL_CAPACITY = 5000;
+    private static final long serialVersionUID = -9179676638408888162L;
 
     private int maximumSize;
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/MapCache.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/MapCache.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/MapCache.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/MapCache.java Fri Aug 10 17:49:19 2007
@@ -31,7 +31,7 @@
     protected final Map<Object, Object> map;
     
     public MapCache() {
-        this(new ConcurrentHashMap());
+        this(new ConcurrentHashMap<Object, Object>());
     }
     
     public MapCache(Map<Object, Object> map) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageQueue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageQueue.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageQueue.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/MessageQueue.java Fri Aug 10 17:49:19 2007
@@ -34,7 +34,7 @@
 public class MessageQueue {
 
     private MessageBuffer buffer;
-    private LinkedList list = new LinkedList();
+    private LinkedList<MessageReference> list = new LinkedList<MessageReference>();
     private int size;
     private Object lock = new Object();
     private int position;
@@ -81,15 +81,15 @@
     /**
      * Returns a copy of the list
      */
-    public List getList() {
+    public List<MessageReference> getList() {
         synchronized (lock) {
-            return new ArrayList(list);
+            return new ArrayList<MessageReference>(list);
         }
     }
 
-    public void appendMessages(List answer) {
+    public void appendMessages(List<MessageReference> answer) {
         synchronized (lock) {
-            for (Iterator iter = list.iterator(); iter.hasNext();) {
+            for (Iterator<MessageReference> iter = list.iterator(); iter.hasNext();) {
                 answer.add(iter.next());
             }
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/OrderBasedMessageBuffer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/OrderBasedMessageBuffer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/OrderBasedMessageBuffer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/OrderBasedMessageBuffer.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
 public class OrderBasedMessageBuffer implements MessageBuffer {
 
     private int limit = 100 * 64 * 1024;
-    private LinkedList list = new LinkedList();
+    private LinkedList<MessageQueue> list = new LinkedList<MessageQueue>();
     private int size;
     private Object lock = new Object();
 
@@ -63,7 +63,7 @@
             list.addLast(queue);
             size += delta;
             while (size > limit) {
-                MessageQueue biggest = (MessageQueue) list.removeFirst();
+                MessageQueue biggest = list.removeFirst();
                 size -= biggest.evictMessage();
             }
         }
@@ -71,8 +71,8 @@
 
     public void clear() {
         synchronized (lock) {
-            for (Iterator iter = list.iterator(); iter.hasNext();) {
-                MessageQueue queue = (MessageQueue) iter.next();
+            for (Iterator<MessageQueue> iter = list.iterator(); iter.hasNext();) {
+                MessageQueue queue = iter.next();
                 queue.clear();
             }
             size = 0;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/SizeBasedMessageBuffer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/SizeBasedMessageBuffer.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/SizeBasedMessageBuffer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/buffer/SizeBasedMessageBuffer.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
 public class SizeBasedMessageBuffer implements MessageBuffer {
 
     private int limit = 100 * 64 * 1024;
-    private List bubbleList = new ArrayList();
+    private List<MessageQueue> bubbleList = new ArrayList<MessageQueue>();
     private int size;
     private Object lock = new Object();
 
@@ -69,7 +69,7 @@
 
             size += delta;
             while (size > limit) {
-                MessageQueue biggest = (MessageQueue)bubbleList.get(0);
+                MessageQueue biggest = bubbleList.get(0);
                 size -= biggest.evictMessage();
 
                 bubbleDown(biggest, 0);
@@ -79,8 +79,8 @@
 
     public void clear() {
         synchronized (lock) {
-            for (Iterator iter = bubbleList.iterator(); iter.hasNext();) {
-                MessageQueue queue = (MessageQueue)iter.next();
+            for (Iterator<MessageQueue> iter = bubbleList.iterator(); iter.hasNext();) {
+                MessageQueue queue = iter.next();
                 queue.clear();
             }
             size = 0;
@@ -91,7 +91,7 @@
         // lets bubble up to head of queueif we need to
         int position = queue.getPosition();
         while (--position >= 0) {
-            MessageQueue pivot = (MessageQueue)bubbleList.get(position);
+            MessageQueue pivot = bubbleList.get(position);
             if (pivot.getSize() < queueSize) {
                 swap(position, pivot, position + 1, queue);
             } else {
@@ -102,8 +102,9 @@
 
     protected void bubbleDown(MessageQueue biggest, int position) {
         int queueSize = biggest.getSize();
-        for (int second = position + 1, end = bubbleList.size(); second < end; second++) {
-            MessageQueue pivot = (MessageQueue)bubbleList.get(second);
+        int end = bubbleList.size();
+        for (int second = position + 1; second < end; second++) {
+            MessageQueue pivot = bubbleList.get(second);
             if (pivot.getSize() > queueSize) {
                 swap(position, biggest, second, pivot);
             } else {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/DestinationBasedMessageList.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/DestinationBasedMessageList.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/DestinationBasedMessageList.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/DestinationBasedMessageList.java Fri Aug 10 17:49:19 2007
@@ -69,16 +69,16 @@
         queue.add(node);
     }
 
-    public List getMessages(Subscription sub) {
+    public List<MessageReference> getMessages(Subscription sub) {
         return getMessages(sub.getConsumerInfo().getDestination());
     }
     
-    public  List getMessages(ActiveMQDestination destination) {
+    public  List<MessageReference> getMessages(ActiveMQDestination destination) {
         Set set = null;
         synchronized (lock) {
             set = subscriptionIndex.get(destination);
         }
-        List answer = new ArrayList();
+        List<MessageReference> answer = new ArrayList<MessageReference>();
         for (Iterator iter = set.iterator(); iter.hasNext();) {
             MessageQueue queue = (MessageQueue) iter.next();
             queue.appendMessages(answer);
@@ -87,8 +87,8 @@
     }
     
     public Message[] browse(ActiveMQDestination destination) {
-        List result = getMessages(destination);
-        return (Message[])result.toArray(new Message[result.size()]);
+        List<MessageReference> result = getMessages(destination);
+        return result.toArray(new Message[result.size()]);
     }
 
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/memory/list/SimpleMessageList.java Fri Aug 10 17:49:19 2007
@@ -38,7 +38,7 @@
  */
 public class SimpleMessageList implements MessageList {
     private static final Log LOG = LogFactory.getLog(SimpleMessageList.class);
-    private LinkedList list = new LinkedList();
+    private LinkedList<MessageReference> list = new LinkedList<MessageReference>();
     private int maximumSize = 100 * 64 * 1024;
     private int size;
     private Object lock = new Object();
@@ -56,22 +56,22 @@
             list.add(node);
             size += delta;
             while (size > maximumSize) {
-                MessageReference evicted = (MessageReference)list.removeFirst();
+                MessageReference evicted = list.removeFirst();
                 size -= evicted.getMessageHardRef().getSize();
             }
         }
     }
 
-    public List getMessages(ActiveMQDestination destination) {
+    public List<MessageReference> getMessages(ActiveMQDestination destination) {
         return getList();
     }
 
     public Message[] browse(ActiveMQDestination destination) {
-        List result = new ArrayList();
+        List<Message> result = new ArrayList<Message>();
         DestinationFilter filter = DestinationFilter.parseFilter(destination);
         synchronized (lock) {
-            for (Iterator i = list.iterator(); i.hasNext();) {
-                MessageReference ref = (MessageReference)i.next();
+            for (Iterator<MessageReference> i = list.iterator(); i.hasNext();) {
+                MessageReference ref = i.next();
                 Message msg;
                 try {
                     msg = ref.getMessage();
@@ -84,15 +84,15 @@
 
             }
         }
-        return (Message[])result.toArray(new Message[result.size()]);
+        return result.toArray(new Message[result.size()]);
     }
 
     /**
      * Returns a copy of the list
      */
-    public List getList() {
+    public List<MessageReference> getList() {
         synchronized (lock) {
-            return new ArrayList(list);
+            return new ArrayList<MessageReference>(list);
         }
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandSubscription.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandSubscription.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandSubscription.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandSubscription.java Fri Aug 10 17:49:19 2007
@@ -31,7 +31,7 @@
 public class DemandSubscription {
     private ConsumerInfo remoteInfo;
     private ConsumerInfo localInfo;
-    private Set remoteSubsIds = new CopyOnWriteArraySet();
+    private Set<ConsumerId> remoteSubsIds = new CopyOnWriteArraySet<ConsumerId>();
     private AtomicInteger dispatched = new AtomicInteger(0);
 
     DemandSubscription(ConsumerInfo info) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/NetworkBridgeFactory.java Fri Aug 10 17:49:19 2007
@@ -23,8 +23,11 @@
  * 
  * @version $Revision: 1.1 $
  */
-public class NetworkBridgeFactory {
+public final class NetworkBridgeFactory {
 
+    private NetworkBridgeFactory() {
+    }
+    
     /**
      * Create a network bridge
      * 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/CommandIdComparator.java Fri Aug 10 17:49:19 2007
@@ -25,14 +25,9 @@
  * 
  * @version $Revision$
  */
-public class CommandIdComparator implements Comparator {
+public class CommandIdComparator implements Comparator<Command> {
 
-    public int compare(Object o1, Object o2) {
-        assert o1 instanceof Command;
-        assert o2 instanceof Command;
-        
-        Command c1 = (Command) o1;
-        Command c2 = (Command) o2;
+    public int compare(Command c1, Command c2) {        
         return c1.getCommandId() - c2.getCommandId();
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java Fri Aug 10 17:49:19 2007
@@ -35,7 +35,7 @@
     private boolean tcpNoDelayEnabled = true;
     private boolean cacheEnabled = true;
     private boolean tightEncodingEnabled = true;
-    private boolean sizePrefixDisabled = false;
+    private boolean sizePrefixDisabled;
     private long maxInactivityDuration = 30 * 1000;
     private int cacheSize = 1024;
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java Fri Aug 10 17:49:19 2007
@@ -282,14 +282,16 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException {
         if (bs.readBoolean()) {
             if (bs.readBoolean()) {
                 int size = dataIn.readShort();
                 byte data[] = new byte[size];
                 dataIn.readFully(data);
-                return new String(data, 0); // Yes deprecated, but we know what
-                                            // we are doing.
+                // Yes deprecated, but we know what we are doing.
+                // This allows us to create a String from a ASCII byte array. (no UTF-8 decoding)
+                return new String(data, 0);
             } else {
                 return dataIn.readUTF();
             }
@@ -305,7 +307,7 @@
             int strlen = value.length();
             int utflen = 0;
             char[] charr = new char[strlen];
-            int c, count = 0;
+            int c = 0;
             boolean isOnlyAscii = true;
 
             value.getChars(0, strlen, charr, 0);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v1/MarshallerFactory.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
  * 
  * @version $Revision$
  */
-public class MarshallerFactory {
+public final class MarshallerFactory {
 
     /**
      * Creates a Map of command type -> Marshallers
@@ -90,6 +90,9 @@
         add(new RemoveInfoMarshaller());
         add(new ExceptionResponseMarshaller());
 
+    }
+
+    private MarshallerFactory() {        
     }
 
     private static void add(DataStreamMarshaller dsm) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java Fri Aug 10 17:49:19 2007
@@ -282,14 +282,16 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException {
         if (bs.readBoolean()) {
             if (bs.readBoolean()) {
                 int size = dataIn.readShort();
                 byte data[] = new byte[size];
                 dataIn.readFully(data);
-                return new String(data, 0); // Yes deprecated, but we know what
-                                            // we are doing.
+                // Yes deprecated, but we know what we are doing.
+                // This allows us to create a String from a ASCII byte array. (no UTF-8 decoding)
+                return new String(data, 0);
             } else {
                 return dataIn.readUTF();
             }
@@ -305,7 +307,7 @@
             int strlen = value.length();
             int utflen = 0;
             char[] charr = new char[strlen];
-            int c, count = 0;
+            int c = 0;
             boolean isOnlyAscii = true;
 
             value.getChars(0, strlen, charr, 0);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v2/MarshallerFactory.java Fri Aug 10 17:49:19 2007
@@ -31,7 +31,7 @@
  *
  * @version $Revision$
  */
-public class MarshallerFactory {
+public final class MarshallerFactory {
 
     /**
      * Creates a Map of command type -> Marshallers
@@ -94,6 +94,9 @@
         add(new WireFormatInfoMarshaller());
         add(new XATransactionIdMarshaller());
 
+    }
+
+    private MarshallerFactory() {        
     }
 
     private static void add(DataStreamMarshaller dsm) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java Fri Aug 10 17:49:19 2007
@@ -35,7 +35,8 @@
     static {
         Constructor constructor = null;
         try {
-            constructor = StackTraceElement.class.getConstructor(new Class[] {String.class, String.class, String.class, int.class});
+            constructor = StackTraceElement.class.getConstructor(new Class[] {String.class, String.class,
+                                                                              String.class, int.class});
         } catch (Throwable e) {
         }
         STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor;
@@ -49,10 +50,12 @@
         return 0;
     }
 
-    public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
+    public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
+        throws IOException {
     }
 
-    public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
+    public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
+        throws IOException {
     }
 
     public int tightMarshalLong1(OpenWireFormat wireFormat, long o, BooleanStream bs) throws IOException {
@@ -75,7 +78,8 @@
         }
     }
 
-    public void tightMarshalLong2(OpenWireFormat wireFormat, long o, DataOutput dataOut, BooleanStream bs) throws IOException {
+    public void tightMarshalLong2(OpenWireFormat wireFormat, long o, DataOutput dataOut, BooleanStream bs)
+        throws IOException {
         if (bs.readBoolean()) {
             if (bs.readBoolean()) {
                 dataOut.writeLong(o);
@@ -89,7 +93,8 @@
         }
     }
 
-    public long tightUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+    public long tightUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs)
+        throws IOException {
         if (bs.readBoolean()) {
             if (bs.readBoolean()) {
                 return dataIn.readLong();
@@ -117,19 +122,23 @@
         return answer & 0xffffffffL;
     }
 
-    protected DataStructure tightUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+    protected DataStructure tightUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn,
+                                                      BooleanStream bs) throws IOException {
         return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
     }
 
-    protected int tightMarshalNestedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) throws IOException {
+    protected int tightMarshalNestedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs)
+        throws IOException {
         return wireFormat.tightMarshalNestedObject1(o, bs);
     }
 
-    protected void tightMarshalNestedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, BooleanStream bs) throws IOException {
+    protected void tightMarshalNestedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut,
+                                             BooleanStream bs) throws IOException {
         wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
     }
 
-    protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+    protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn,
+                                                      BooleanStream bs) throws IOException {
         if (wireFormat.isCacheEnabled()) {
             if (bs.readBoolean()) {
                 short index = dataIn.readShort();
@@ -145,7 +154,8 @@
         }
     }
 
-    protected int tightMarshalCachedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs) throws IOException {
+    protected int tightMarshalCachedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs)
+        throws IOException {
         if (wireFormat.isCacheEnabled()) {
             Short index = wireFormat.getMarshallCacheIndex(o);
             bs.writeBoolean(index == null);
@@ -161,7 +171,8 @@
         }
     }
 
-    protected void tightMarshalCachedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut, BooleanStream bs) throws IOException {
+    protected void tightMarshalCachedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut,
+                                             BooleanStream bs) throws IOException {
         if (wireFormat.isCacheEnabled()) {
             Short index = wireFormat.getMarshallCacheIndex(o);
             if (bs.readBoolean()) {
@@ -175,7 +186,8 @@
         }
     }
 
-    protected Throwable tightUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
+    protected Throwable tightUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs)
+        throws IOException {
         if (bs.readBoolean()) {
             String clazz = tightUnmarshalString(dataIn, bs);
             String message = tightUnmarshalString(dataIn, bs);
@@ -185,10 +197,11 @@
                     StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
                     for (int i = 0; i < ss.length; i++) {
                         try {
-                            ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR.newInstance(new Object[] {tightUnmarshalString(dataIn, bs),
-                                                                                                                 tightUnmarshalString(dataIn, bs),
-                                                                                                                 tightUnmarshalString(dataIn, bs),
-                                                                                                                 Integer.valueOf(dataIn.readInt())});
+                            ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR
+                                .newInstance(new Object[] {tightUnmarshalString(dataIn, bs),
+                                                           tightUnmarshalString(dataIn, bs),
+                                                           tightUnmarshalString(dataIn, bs),
+                                                           Integer.valueOf(dataIn.readInt())});
                         } catch (IOException e) {
                             throw e;
                         } catch (Throwable e) {
@@ -223,7 +236,8 @@
         }
     }
 
-    protected int tightMarshalThrowable1(OpenWireFormat wireFormat, Throwable o, BooleanStream bs) throws IOException {
+    protected int tightMarshalThrowable1(OpenWireFormat wireFormat, Throwable o, BooleanStream bs)
+        throws IOException {
         if (o == null) {
             bs.writeBoolean(false);
             return 0;
@@ -248,7 +262,8 @@
         }
     }
 
-    protected void tightMarshalThrowable2(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut, BooleanStream bs) throws IOException {
+    protected void tightMarshalThrowable2(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut,
+                                          BooleanStream bs) throws IOException {
         if (bs.readBoolean()) {
             tightMarshalString2(o.getClass().getName(), dataOut, bs);
             tightMarshalString2(o.getMessage(), dataOut, bs);
@@ -267,14 +282,16 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException {
         if (bs.readBoolean()) {
             if (bs.readBoolean()) {
                 int size = dataIn.readShort();
                 byte data[] = new byte[size];
                 dataIn.readFully(data);
-                return new String(data, 0); // Yes deprecated, but we know what
-                // we are doing.
+                // Yes deprecated, but we know what we are doing.
+                // This allows us to create a String from a ASCII byte array. (no UTF-8 decoding)
+                return new String(data, 0); 
             } else {
                 return dataIn.readUTF();
             }
@@ -290,7 +307,7 @@
             int strlen = value.length();
             int utflen = 0;
             char[] charr = new char[strlen];
-            int c, count = 0;
+            int c = 0;
             boolean isOnlyAscii = true;
 
             value.getChars(0, strlen, charr, 0);
@@ -331,7 +348,8 @@
         }
     }
 
-    protected int tightMarshalObjectArray1(OpenWireFormat wireFormat, DataStructure[] objects, BooleanStream bs) throws IOException {
+    protected int tightMarshalObjectArray1(OpenWireFormat wireFormat, DataStructure[] objects,
+                                           BooleanStream bs) throws IOException {
         if (objects != null) {
             int rc = 0;
             bs.writeBoolean(true);
@@ -346,7 +364,8 @@
         }
     }
 
-    protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects, DataOutput dataOut, BooleanStream bs) throws IOException {
+    protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects,
+                                            DataOutput dataOut, BooleanStream bs) throws IOException {
         if (bs.readBoolean()) {
             dataOut.writeShort(objects.length);
             for (int i = 0; i < objects.length; i++) {
@@ -359,11 +378,13 @@
         return i;
     }
 
-    protected void tightMarshalConstByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs, int i) throws IOException {
+    protected void tightMarshalConstByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs, int i)
+        throws IOException {
         dataOut.write(data, 0, i);
     }
 
-    protected byte[] tightUnmarshalConstByteArray(DataInput dataIn, BooleanStream bs, int i) throws IOException {
+    protected byte[] tightUnmarshalConstByteArray(DataInput dataIn, BooleanStream bs, int i)
+        throws IOException {
         byte data[] = new byte[i];
         dataIn.readFully(data);
         return data;
@@ -378,7 +399,8 @@
         }
     }
 
-    protected void tightMarshalByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs) throws IOException {
+    protected void tightMarshalByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs)
+        throws IOException {
         if (bs.readBoolean()) {
             dataOut.writeInt(data.length);
             dataOut.write(data);
@@ -404,7 +426,8 @@
         }
     }
 
-    protected void tightMarshalByteSequence2(ByteSequence data, DataOutput dataOut, BooleanStream bs) throws IOException {
+    protected void tightMarshalByteSequence2(ByteSequence data, DataOutput dataOut, BooleanStream bs)
+        throws IOException {
         if (bs.readBoolean()) {
             dataOut.writeInt(data.getLength());
             dataOut.write(data.getData(), data.getOffset(), data.getLength());
@@ -440,15 +463,18 @@
         return dataIn.readLong();
     }
 
-    protected DataStructure looseUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+    protected DataStructure looseUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn)
+        throws IOException {
         return wireFormat.looseUnmarshalNestedObject(dataIn);
     }
 
-    protected void looseMarshalNestedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) throws IOException {
+    protected void looseMarshalNestedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut)
+        throws IOException {
         wireFormat.looseMarshalNestedObject(o, dataOut);
     }
 
-    protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+    protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn)
+        throws IOException {
         if (wireFormat.isCacheEnabled()) {
             if (dataIn.readBoolean()) {
                 short index = dataIn.readShort();
@@ -464,7 +490,8 @@
         }
     }
 
-    protected void looseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut) throws IOException {
+    protected void looseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut)
+        throws IOException {
         if (wireFormat.isCacheEnabled()) {
             Short index = wireFormat.getMarshallCacheIndex(o);
             dataOut.writeBoolean(index == null);
@@ -480,7 +507,8 @@
         }
     }
 
-    protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
+    protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn)
+        throws IOException {
         if (dataIn.readBoolean()) {
             String clazz = looseUnmarshalString(dataIn);
             String message = looseUnmarshalString(dataIn);
@@ -490,8 +518,11 @@
                     StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
                     for (int i = 0; i < ss.length; i++) {
                         try {
-                            ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR.newInstance(new Object[] {looseUnmarshalString(dataIn), looseUnmarshalString(dataIn),
-                                                                                                                 looseUnmarshalString(dataIn), Integer.valueOf(dataIn.readInt())});
+                            ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR
+                                .newInstance(new Object[] {looseUnmarshalString(dataIn),
+                                                           looseUnmarshalString(dataIn),
+                                                           looseUnmarshalString(dataIn),
+                                                           Integer.valueOf(dataIn.readInt())});
                         } catch (IOException e) {
                             throw e;
                         } catch (Throwable e) {
@@ -516,7 +547,8 @@
         }
     }
 
-    protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut) throws IOException {
+    protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut)
+        throws IOException {
         dataOut.writeBoolean(o != null);
         if (o != null) {
             looseMarshalString(o.getClass().getName(), dataOut);
@@ -551,7 +583,8 @@
         }
     }
 
-    protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects, DataOutput dataOut) throws IOException {
+    protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects,
+                                           DataOutput dataOut) throws IOException {
         dataOut.writeBoolean(objects != null);
         if (objects != null) {
             dataOut.writeShort(objects.length);
@@ -561,7 +594,8 @@
         }
     }
 
-    protected void looseMarshalConstByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut, int i) throws IOException {
+    protected void looseMarshalConstByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut,
+                                              int i) throws IOException {
         dataOut.write(data, 0, i);
     }
 
@@ -571,7 +605,8 @@
         return data;
     }
 
-    protected void looseMarshalByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut) throws IOException {
+    protected void looseMarshalByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut)
+        throws IOException {
         dataOut.writeBoolean(data != null);
         if (data != null) {
             dataOut.writeInt(data.length);
@@ -589,7 +624,8 @@
         return rc;
     }
 
-    protected void looseMarshalByteSequence(OpenWireFormat wireFormat, ByteSequence data, DataOutput dataOut) throws IOException {
+    protected void looseMarshalByteSequence(OpenWireFormat wireFormat, ByteSequence data, DataOutput dataOut)
+        throws IOException {
         dataOut.writeBoolean(data != null);
         if (data != null) {
             dataOut.writeInt(data.getLength());

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/openwire/v3/MarshallerFactory.java Fri Aug 10 17:49:19 2007
@@ -31,7 +31,7 @@
  *
  * @version $Revision$
  */
-public class MarshallerFactory {
+public final class MarshallerFactory {
 
     /**
      * Creates a Map of command type -> Marshallers
@@ -98,6 +98,9 @@
 
     }
 
+    private MarshallerFactory() {        
+    }
+    
     private static void add(DataStreamMarshaller dsm) {
         MARSHALLER[dsm.getDataStructureType()] = dsm;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/ConnectionPool.java Fri Aug 10 17:49:19 2007
@@ -43,7 +43,7 @@
 
     private TransactionManager transactionManager;
     private ActiveMQConnection connection;
-    private Map cache;
+    private Map<SessionKey, SessionPool> cache;
     private AtomicBoolean started = new AtomicBoolean(false);
     private int referenceCount;
     private ObjectPoolFactory poolFactory;
@@ -54,7 +54,7 @@
 
     public ConnectionPool(ActiveMQConnection connection, ObjectPoolFactory poolFactory,
                           TransactionManager transactionManager) {
-        this(connection, new HashMap(), poolFactory, transactionManager);
+        this(connection, new HashMap<SessionKey, SessionPool>(), poolFactory, transactionManager);
         // Add a transport Listener so that we can notice if this connection
         // should be expired due to
         // a connection failure.
@@ -76,7 +76,7 @@
         });
     }
 
-    public ConnectionPool(ActiveMQConnection connection, Map cache, ObjectPoolFactory poolFactory,
+    public ConnectionPool(ActiveMQConnection connection, Map<SessionKey, SessionPool> cache, ObjectPoolFactory poolFactory,
                           TransactionManager transactionManager) {
         this.connection = connection;
         this.cache = cache;
@@ -102,7 +102,7 @@
                 ackMode = Session.SESSION_TRANSACTED;
             }
             SessionKey key = new SessionKey(transacted, ackMode);
-            SessionPool pool = (SessionPool)cache.get(key);
+            SessionPool pool = cache.get(key);
             if (pool == null) {
                 pool = new SessionPool(this, key, poolFactory.createPool());
                 cache.put(key, pool);
@@ -129,9 +129,9 @@
     public synchronized void close() {
         if (connection != null) {
             try {
-                Iterator i = cache.values().iterator();
+                Iterator<SessionPool> i = cache.values().iterator();
                 while (i.hasNext()) {
-                    SessionPool pool = (SessionPool)i.next();
+                    SessionPool pool = i.next();
                     i.remove();
                     try {
                         pool.close();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java Fri Aug 10 17:49:19 2007
@@ -47,7 +47,7 @@
  */
 public class PooledConnectionFactory implements ConnectionFactory, Service {
     private ConnectionFactory connectionFactory;
-    private Map cache = new HashMap();
+    private Map<ConnectionKey, LinkedList<ConnectionPool>> cache = new HashMap<ConnectionKey, LinkedList<ConnectionPool>>();
     private ObjectPoolFactory poolFactory;
     private int maximumActive = 500;
     private int maxConnections = 1;
@@ -87,16 +87,16 @@
 
     public synchronized Connection createConnection(String userName, String password) throws JMSException {
         ConnectionKey key = new ConnectionKey(userName, password);
-        LinkedList pools = (LinkedList)cache.get(key);
+        LinkedList<ConnectionPool> pools = cache.get(key);
 
         if (pools == null) {
-            pools = new LinkedList();
+            pools = new LinkedList<ConnectionPool>();
             cache.put(key, pools);
         }
 
         ConnectionPool connection = null;
         if (pools.size() == maxConnections) {
-            connection = (ConnectionPool)pools.removeFirst();
+            connection = pools.removeFirst();
         }
 
         // Now.. we might get a connection, but it might be that we need to
@@ -138,8 +138,8 @@
     }
 
     public void stop() throws Exception {
-        for (Iterator iter = cache.values().iterator(); iter.hasNext();) {
-            LinkedList list = (LinkedList)iter.next();
+        for (Iterator<LinkedList<ConnectionPool>> iter = cache.values().iterator(); iter.hasNext();) {
+            LinkedList list = iter.next();
             for (Iterator i = list.iterator(); i.hasNext();) {
                 ConnectionPool connection = (ConnectionPool)i.next();
                 connection.close();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledSession.java Fri Aug 10 17:49:19 2007
@@ -63,10 +63,10 @@
     private ActiveMQQueueSender queueSender;
     private ActiveMQTopicPublisher topicPublisher;
     private boolean transactional = true;
-    private boolean ignoreClose = false;
+    private boolean ignoreClose;
 
-    private final CopyOnWriteArrayList consumers = new CopyOnWriteArrayList();
-    private final CopyOnWriteArrayList browsers = new CopyOnWriteArrayList();
+    private final CopyOnWriteArrayList<MessageConsumer> consumers = new CopyOnWriteArrayList<MessageConsumer>();
+    private final CopyOnWriteArrayList<QueueBrowser> browsers = new CopyOnWriteArrayList<QueueBrowser>();
 
     public PooledSession(ActiveMQSession aSession, SessionPool sessionPool) {
         this.session = aSession;
@@ -90,14 +90,14 @@
             getSession().setMessageListener(null);
 
             // Close any consumers and browsers that may have been created.
-            for (Iterator iter = consumers.iterator(); iter.hasNext();) {
-                MessageConsumer consumer = (MessageConsumer)iter.next();
+            for (Iterator<MessageConsumer> iter = consumers.iterator(); iter.hasNext();) {
+                MessageConsumer consumer = iter.next();
                 consumer.close();
             }
             consumers.clear();
 
-            for (Iterator iter = browsers.iterator(); iter.hasNext();) {
-                QueueBrowser browser = (QueueBrowser)iter.next();
+            for (Iterator<QueueBrowser> iter = browsers.iterator(); iter.hasNext();) {
+                QueueBrowser browser = iter.next();
                 browser.close();
             }
             browsers.clear();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java Fri Aug 10 17:49:19 2007
@@ -46,8 +46,7 @@
     private URI remote;
     private URI localUri;
     private String name;
-
-    CopyOnWriteArrayList connections = new CopyOnWriteArrayList();
+    private CopyOnWriteArrayList<ProxyConnection> connections = new CopyOnWriteArrayList<ProxyConnection>();
 
     public void start() throws Exception {
 
@@ -77,9 +76,9 @@
         if (this.server != null) {
             ss.stop(this.server);
         }
-        for (Iterator iter = connections.iterator(); iter.hasNext();) {
+        for (Iterator<ProxyConnection> iter = connections.iterator(); iter.hasNext();) {
             LOG.info("Connector stopped: Stopping proxy.");
-            ss.stop((Service)iter.next());
+            ss.stop(iter.next());
         }
         ss.throwFirstException();
         LOG.info("Proxy Connector " + getName() + " Stopped");

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java Fri Aug 10 17:49:19 2007
@@ -54,7 +54,7 @@
         // if(!((ActiveMQTempDestination)destination).getConnectionId().equals(context.getConnectionId().getValue())
         // ) {
         if (!securityContext.isBrokerContext()) {
-            Set allowedACLs = null;
+            Set<?> allowedACLs = null;
             if (!destination.isTemporary()) {
                 allowedACLs = authorizationMap.getAdminACLs(destination);
             } else {
@@ -77,7 +77,7 @@
         if (securityContext == null) {
             throw new SecurityException("User is not authenticated.");
         }
-        Set allowedACLs = null;
+        Set<?> allowedACLs = null;
         if (!destination.isTemporary()) {
             allowedACLs = authorizationMap.getAdminACLs(destination);
         } else {
@@ -96,7 +96,7 @@
         if (subject == null) {
             throw new SecurityException("User is not authenticated.");
         }
-        Set allowedACLs = null;
+        Set<?> allowedACLs = null;
         if (!info.getDestination().isTemporary()) {
             allowedACLs = authorizationMap.getReadACLs(info.getDestination());
         } else {
@@ -140,7 +140,7 @@
         }
         if (info.getDestination() != null) {
 
-            Set allowedACLs = null;
+            Set<?> allowedACLs = null;
             if (!info.getDestination().isTemporary()) {
                 allowedACLs = authorizationMap.getWriteACLs(info.getDestination());
             } else {
@@ -162,7 +162,7 @@
         }
         if (!subject.getAuthorizedWriteDests().contains(messageSend.getDestination())) {
 
-            Set allowedACLs = null;
+            Set<?> allowedACLs = null;
             if (!messageSend.getDestination().isTemporary()) {
                 allowedACLs = authorizationMap.getWriteACLs(messageSend.getDestination());
             } else {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java Fri Aug 10 17:49:19 2007
@@ -35,13 +35,13 @@
  */
 public class AuthorizationEntry extends DestinationMapEntry {
 
-    private Set readACLs = Collections.EMPTY_SET;
-    private Set writeACLs = Collections.EMPTY_SET;
-    private Set adminACLs = Collections.EMPTY_SET;
-
-    private String adminRoles = null;
-    private String readRoles = null;
-    private String writeRoles = null;
+    private Set<Object> readACLs = emptySet();
+    private Set<Object> writeACLs = emptySet();
+    private Set<Object> adminACLs = emptySet();
+
+    private String adminRoles;
+    private String readRoles;
+    private String writeRoles;
 
     private String groupClass = "org.apache.activemq.jaas.GroupPrincipal";
 
@@ -49,31 +49,36 @@
         return groupClass;
     }
 
+    @SuppressWarnings("unchecked")
+    private Set<Object> emptySet() {
+        return Collections.EMPTY_SET;
+    }
+
     public void setGroupClass(String groupClass) {
         this.groupClass = groupClass;
     }
 
-    public Set getAdminACLs() {
+    public Set<Object> getAdminACLs() {
         return adminACLs;
     }
 
-    public void setAdminACLs(Set adminACLs) {
+    public void setAdminACLs(Set<Object> adminACLs) {
         this.adminACLs = adminACLs;
     }
 
-    public Set getReadACLs() {
+    public Set<Object> getReadACLs() {
         return readACLs;
     }
 
-    public void setReadACLs(Set readACLs) {
+    public void setReadACLs(Set<Object> readACLs) {
         this.readACLs = readACLs;
     }
 
-    public Set getWriteACLs() {
+    public Set<Object> getWriteACLs() {
         return writeACLs;
     }
 
-    public void setWriteACLs(Set writeACLs) {
+    public void setWriteACLs(Set<Object> writeACLs) {
         this.writeACLs = writeACLs;
     }
 
@@ -100,8 +105,8 @@
         setWriteACLs(parseACLs(writeRoles));
     }
 
-    protected Set parseACLs(String roles) throws Exception {
-        Set answer = new HashSet();
+    protected Set<Object> parseACLs(String roles) throws Exception {
+        Set<Object> answer = new HashSet<Object>();
         StringTokenizer iter = new StringTokenizer(roles, ",");
         while (iter.hasMoreTokens()) {
             String name = iter.nextToken().trim();

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationMap.java Fri Aug 10 17:49:19 2007
@@ -28,33 +28,33 @@
     /**
      * Returns the set of all ACLs capable of administering temp destination
      */
-    Set getTempDestinationAdminACLs();
+    Set<?> getTempDestinationAdminACLs();
 
     /**
      * Returns the set of all ACLs capable of reading from temp destination
      */
-    Set getTempDestinationReadACLs();
+    Set<?> getTempDestinationReadACLs();
 
     /**
      * Returns the set of all ACLs capable of writing to temp destination
      */
-    Set getTempDestinationWriteACLs();
+    Set<?> getTempDestinationWriteACLs();
 
     /**
      * Returns the set of all ACLs capable of administering the given
      * destination
      */
-    Set getAdminACLs(ActiveMQDestination destination);
+    Set<?> getAdminACLs(ActiveMQDestination destination);
 
     /**
      * Returns the set of all ACLs capable of reading (consuming from) the given
      * destination
      */
-    Set getReadACLs(ActiveMQDestination destination);
+    Set<?> getReadACLs(ActiveMQDestination destination);
 
     /**
      * Returns the set of all ACLs capable of writing to the given destination
      */
-    Set getWriteACLs(ActiveMQDestination destination);
+    Set<?> getWriteACLs(ActiveMQDestination destination);
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java Fri Aug 10 17:49:19 2007
@@ -55,7 +55,7 @@
         return this.tempDestinationAuthorizationEntry;
     }
 
-    public Set getTempDestinationAdminACLs() {
+    public Set<Object> getTempDestinationAdminACLs() {
         if (tempDestinationAuthorizationEntry != null) {
             return tempDestinationAuthorizationEntry.getAdminACLs();
         } else {
@@ -63,7 +63,7 @@
         }
     }
 
-    public Set getTempDestinationReadACLs() {
+    public Set<Object> getTempDestinationReadACLs() {
         if (tempDestinationAuthorizationEntry != null) {
             return tempDestinationAuthorizationEntry.getReadACLs();
         } else {
@@ -71,7 +71,7 @@
         }
     }
 
-    public Set getTempDestinationWriteACLs() {
+    public Set<Object> getTempDestinationWriteACLs() {
         if (tempDestinationAuthorizationEntry != null) {
             return tempDestinationAuthorizationEntry.getWriteACLs();
         } else {
@@ -79,36 +79,36 @@
         }
     }
 
-    public Set getAdminACLs(ActiveMQDestination destination) {
-        Set entries = getAllEntries(destination);
-        Set answer = new HashSet();
+    public Set<Object> getAdminACLs(ActiveMQDestination destination) {
+        Set<AuthorizationEntry> entries = getAllEntries(destination);
+        Set<Object> answer = new HashSet<Object>();
         // now lets go through each entry adding individual
-        for (Iterator iter = entries.iterator(); iter.hasNext();) {
-            AuthorizationEntry entry = (AuthorizationEntry)iter.next();
+        for (Iterator<AuthorizationEntry> iter = entries.iterator(); iter.hasNext();) {
+            AuthorizationEntry entry = iter.next();
             answer.addAll(entry.getAdminACLs());
         }
         return answer;
     }
 
-    public Set getReadACLs(ActiveMQDestination destination) {
-        Set entries = getAllEntries(destination);
-        Set answer = new HashSet();
+    public Set<Object> getReadACLs(ActiveMQDestination destination) {
+        Set<AuthorizationEntry> entries = getAllEntries(destination);
+        Set<Object> answer = new HashSet<Object>();
 
         // now lets go through each entry adding individual
-        for (Iterator iter = entries.iterator(); iter.hasNext();) {
-            AuthorizationEntry entry = (AuthorizationEntry)iter.next();
+        for (Iterator<AuthorizationEntry> iter = entries.iterator(); iter.hasNext();) {
+            AuthorizationEntry entry = iter.next();
             answer.addAll(entry.getReadACLs());
         }
         return answer;
     }
 
-    public Set getWriteACLs(ActiveMQDestination destination) {
-        Set entries = getAllEntries(destination);
-        Set answer = new HashSet();
+    public Set<Object> getWriteACLs(ActiveMQDestination destination) {
+        Set<AuthorizationEntry> entries = getAllEntries(destination);
+        Set<Object> answer = new HashSet<Object>();
 
         // now lets go through each entry adding individual
-        for (Iterator iter = entries.iterator(); iter.hasNext();) {
-            AuthorizationEntry entry = (AuthorizationEntry)iter.next();
+        for (Iterator<AuthorizationEntry> iter = entries.iterator(); iter.hasNext();) {
+            AuthorizationEntry entry = iter.next();
             answer.addAll(entry.getWriteACLs());
         }
         return answer;
@@ -139,12 +139,12 @@
         this.defaultEntry = defaultEntry;
     }
 
-    protected Class getEntryClass() {
+    protected Class<AuthorizationEntry> getEntryClass() {
         return AuthorizationEntry.class;
     }
 
-    protected Set getAllEntries(ActiveMQDestination destination) {
-        Set entries = get(destination);
+    protected Set<AuthorizationEntry> getAllEntries(ActiveMQDestination destination) {
+        Set<AuthorizationEntry> entries = get(destination);
         if (defaultEntry != null) {
             entries.add(defaultEntry);
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java Fri Aug 10 17:49:19 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.security;
 
+import java.security.Principal;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -37,7 +38,7 @@
 public class JaasAuthenticationBroker extends BrokerFilter {
 
     private final String jassConfiguration;
-    private final CopyOnWriteArrayList securityContexts = new CopyOnWriteArrayList();
+    private final CopyOnWriteArrayList<SecurityContext> securityContexts = new CopyOnWriteArrayList<SecurityContext>();
 
     public JaasAuthenticationBroker(Broker next, String jassConfiguration) {
         super(next);
@@ -53,7 +54,7 @@
             this.subject = subject;
         }
 
-        public Set getPrincipals() {
+        public Set<Principal> getPrincipals() {
             return subject.getPrincipals();
         }
 
@@ -102,8 +103,8 @@
      * Refresh all the logged into users.
      */
     public void refresh() {
-        for (Iterator iter = securityContexts.iterator(); iter.hasNext();) {
-            SecurityContext sc = (SecurityContext)iter.next();
+        for (Iterator<SecurityContext> iter = securityContexts.iterator(); iter.hasNext();) {
+            SecurityContext sc = iter.next();
             sc.getAuthorizedReadDests().clear();
             sc.getAuthorizedWriteDests().clear();
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasCertificateSecurityContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasCertificateSecurityContext.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasCertificateSecurityContext.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasCertificateSecurityContext.java Fri Aug 10 17:49:19 2007
@@ -17,6 +17,7 @@
 
 package org.apache.activemq.security;
 
+import java.security.Principal;
 import java.security.cert.X509Certificate;
 import java.util.Set;
 
@@ -38,7 +39,7 @@
         this.certs = certs;
     }
 
-    public Set getPrincipals() {
+    public Set<Principal> getPrincipals() {
         return subject.getPrincipals();
     }
   

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/LDAPAuthorizationMap.java Fri Aug 10 17:49:19 2007
@@ -47,8 +47,6 @@
  */
 public class LDAPAuthorizationMap implements AuthorizationMap {
 
-    private static Log log = LogFactory.getLog(LDAPLoginModule.class);
-
     public static final String INITIAL_CONTEXT_FACTORY = "initialContextFactory";
     public static final String CONNECTION_URL = "connectionURL";
     public static final String CONNECTION_USERNAME = "connectionUsername";
@@ -68,6 +66,8 @@
     public static final String WRITE_BASE = "writeBAse";
     public static final String WRITE_ATTRIBUTE = "writeAttribute";
 
+    private static final Log LOG = LogFactory.getLog(LDAPLoginModule.class);
+
     private String initialContextFactory;
     private String connectionURL;
     private String connectionUsername;
@@ -135,31 +135,30 @@
         queueSearchSubtreeBool = Boolean.valueOf(queueSearchSubtree).booleanValue();
     }
 
-    public Set getTempDestinationAdminACLs() {
+    public Set<GroupPrincipal> getTempDestinationAdminACLs() {
         // TODO insert implementation
-
         return null;
     }
 
-    public Set getTempDestinationReadACLs() {
+    public Set<GroupPrincipal> getTempDestinationReadACLs() {
         // TODO insert implementation
         return null;
     }
 
-    public Set getTempDestinationWriteACLs() {
+    public Set<GroupPrincipal> getTempDestinationWriteACLs() {
         // TODO insert implementation
         return null;
     }
 
-    public Set getAdminACLs(ActiveMQDestination destination) {
+    public Set<GroupPrincipal> getAdminACLs(ActiveMQDestination destination) {
         return getACLs(destination, adminBase, adminAttribute);
     }
 
-    public Set getReadACLs(ActiveMQDestination destination) {
+    public Set<GroupPrincipal> getReadACLs(ActiveMQDestination destination) {
         return getACLs(destination, readBase, readAttribute);
     }
 
-    public Set getWriteACLs(ActiveMQDestination destination) {
+    public Set<GroupPrincipal> getWriteACLs(ActiveMQDestination destination) {
         return getACLs(destination, writeBase, writeAttribute);
     }
 
@@ -304,12 +303,12 @@
 
     // Implementation methods
     // -------------------------------------------------------------------------
-    protected Set getACLs(ActiveMQDestination destination, String roleBase, String roleAttribute) {
+    protected Set<GroupPrincipal> getACLs(ActiveMQDestination destination, String roleBase, String roleAttribute) {
         try {
             context = open();
         } catch (NamingException e) {
-            log.error(e);
-            return new HashSet();
+            LOG.error(e);
+            return new HashSet<GroupPrincipal>();
         }
 
         // if ((destination.getDestinationType() &
@@ -340,8 +339,8 @@
         constraints.setReturningAttributes(new String[] {roleAttribute});
 
         try {
-            Set roles = new HashSet();
-            Set acls = new HashSet();
+            Set<GroupPrincipal> roles = new HashSet<GroupPrincipal>();
+            Set<String> acls = new HashSet<String>();
             NamingEnumeration results = context.search(destinationBase, roleBase, constraints);
             while (results.hasMore()) {
                 SearchResult result = (SearchResult)results.next();
@@ -351,23 +350,23 @@
                 }
                 acls = addAttributeValues(roleAttribute, attrs, acls);
             }
-            for (Iterator iter = acls.iterator(); iter.hasNext();) {
-                String roleName = (String)iter.next();
+            for (Iterator<String> iter = acls.iterator(); iter.hasNext();) {
+                String roleName = iter.next();
                 roles.add(new GroupPrincipal(roleName));
             }
             return roles;
         } catch (NamingException e) {
-            log.error(e);
-            return new HashSet();
+            LOG.error(e);
+            return new HashSet<GroupPrincipal>();
         }
     }
 
-    protected Set addAttributeValues(String attrId, Attributes attrs, Set values) throws NamingException {
+    protected Set<String> addAttributeValues(String attrId, Attributes attrs, Set<String> values) throws NamingException {
         if (attrId == null || attrs == null) {
             return values;
         }
         if (values == null) {
-            values = new HashSet();
+            values = new HashSet<String>();
         }
         Attribute attr = attrs.get(attrId);
         if (attr == null) {
@@ -387,7 +386,7 @@
         }
 
         try {
-            Hashtable env = new Hashtable();
+            Hashtable<String, String> env = new Hashtable<String, String>();
             env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
             if (connectionUsername != null || !"".equals(connectionUsername)) {
                 env.put(Context.SECURITY_PRINCIPAL, connectionUsername);
@@ -401,7 +400,7 @@
             context = new InitialDirContext(env);
 
         } catch (NamingException e) {
-            log.error(e);
+            LOG.error(e);
             throw e;
         }
         return context;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java Fri Aug 10 17:49:19 2007
@@ -21,6 +21,8 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.activemq.command.ActiveMQDestination;
+
 /**
  * Used to cache up authorizations so that subsequent requests are faster.
  * 
@@ -34,37 +36,38 @@
             return true;
         }
 
-        public Set getPrincipals() {
+        @SuppressWarnings("unchecked")
+        public Set<?> getPrincipals() {
             return Collections.EMPTY_SET;
         }
     };
 
     final String userName;
 
-    final ConcurrentHashMap authorizedReadDests = new ConcurrentHashMap();
-    final ConcurrentHashMap authorizedWriteDests = new ConcurrentHashMap();
+    final ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination> authorizedReadDests = new ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination>();
+    final ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination> authorizedWriteDests = new ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination>();
 
     public SecurityContext(String userName) {
         this.userName = userName;
     }
 
-    public boolean isInOneOf(Set allowedPrincipals) {
-        HashSet set = new HashSet(getPrincipals());
+    public boolean isInOneOf(Set<?> allowedPrincipals) {
+        HashSet<?> set = new HashSet<Object>(getPrincipals());
         set.retainAll(allowedPrincipals);
         return set.size() > 0;
     }
 
-    public abstract Set getPrincipals();
+    public abstract Set<?> getPrincipals();
 
     public String getUserName() {
         return userName;
     }
 
-    public ConcurrentHashMap getAuthorizedReadDests() {
+    public ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination> getAuthorizedReadDests() {
         return authorizedReadDests;
     }
 
-    public ConcurrentHashMap getAuthorizedWriteDests() {
+    public ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination> getAuthorizedWriteDests() {
         return authorizedWriteDests;
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java Fri Aug 10 17:49:19 2007
@@ -54,7 +54,7 @@
 
             final Set groups = (Set)userGroups.get(info.getUserName());
             SecurityContext s = new SecurityContext(info.getUserName()) {
-                public Set getPrincipals() {
+                public Set<?> getPrincipals() {
                     return groups;
                 }
             };

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java Fri Aug 10 17:49:19 2007
@@ -63,7 +63,7 @@
         return this.tempDestinationAuthorizationEntry;
     }
 
-    public Set getTempDestinationAdminACLs() {
+    public Set<Object> getTempDestinationAdminACLs() {
         if (tempDestinationAuthorizationEntry != null) {
             return tempDestinationAuthorizationEntry.getAdminACLs();
         } else {
@@ -71,7 +71,7 @@
         }
     }
 
-    public Set getTempDestinationReadACLs() {
+    public Set<Object> getTempDestinationReadACLs() {
         if (tempDestinationAuthorizationEntry != null) {
             return tempDestinationAuthorizationEntry.getReadACLs();
         } else {
@@ -79,7 +79,7 @@
         }
     }
 
-    public Set getTempDestinationWriteACLs() {
+    public Set<Object> getTempDestinationWriteACLs() {
         if (tempDestinationAuthorizationEntry != null) {
             return tempDestinationAuthorizationEntry.getWriteACLs();
         } else {
@@ -87,15 +87,18 @@
         }
     }
 
-    public Set getAdminACLs(ActiveMQDestination destination) {
+    @SuppressWarnings("unchecked")
+    public Set<Object> getAdminACLs(ActiveMQDestination destination) {
         return adminACLs.get(destination);
     }
 
-    public Set getReadACLs(ActiveMQDestination destination) {
+    @SuppressWarnings("unchecked")
+    public Set<Object> getReadACLs(ActiveMQDestination destination) {
         return readACLs.get(destination);
     }
 
-    public Set getWriteACLs(ActiveMQDestination destination) {
+    @SuppressWarnings("unchecked")
+    public Set<Object> getWriteACLs(ActiveMQDestination destination) {
         return writeACLs.get(destination);
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ProducerState.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ProducerState.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ProducerState.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ProducerState.java Fri Aug 10 17:49:19 2007
@@ -21,7 +21,6 @@
 
 public class ProducerState {
     final ProducerInfo info;
-    private long lastSequenceId = -1;
 
     public ProducerState(ProducerInfo info) {
         this.info = info;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTopicMessageStore.java Fri Aug 10 17:49:19 2007
@@ -20,6 +20,7 @@
 import java.io.InterruptedIOException;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.command.ActiveMQTopic;
@@ -45,7 +46,7 @@
 
     private static final Log LOG = LogFactory.getLog(AMQTopicMessageStore.class);
     private TopicReferenceStore topicReferenceStore;
-    private HashMap<SubscriptionKey, MessageId> ackedLastAckLocations = new HashMap<SubscriptionKey, MessageId>();
+    private Map<SubscriptionKey, MessageId> ackedLastAckLocations = new HashMap<SubscriptionKey, MessageId>();
 
     public AMQTopicMessageStore(AMQPersistenceAdapter adapter, TopicReferenceStore topicReferenceStore, ActiveMQTopic destinationName) {
         super(adapter, topicReferenceStore, destinationName);
@@ -157,7 +158,7 @@
 
     @Override
     protected Location doAsyncWrite() throws IOException {
-        final HashMap<SubscriptionKey, MessageId> cpAckedLastAckLocations;
+        final Map<SubscriptionKey, MessageId> cpAckedLastAckLocations;
         // swap out the hash maps..
         synchronized (this) {
             cpAckedLastAckLocations = this.ackedLastAckLocations;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTx.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTx.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTx.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQTx.java Fri Aug 10 17:49:19 2007
@@ -19,6 +19,8 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
+
 import org.apache.activemq.command.JournalTopicAck;
 import org.apache.activemq.command.Message;
 import org.apache.activemq.command.MessageAck;
@@ -34,7 +36,7 @@
 public class AMQTx {
 
     private final Location location;
-    private ArrayList<AMQTxOperation> operations = new ArrayList<AMQTxOperation>();
+    private List<AMQTxOperation> operations = new ArrayList<AMQTxOperation>();
 
     public AMQTx(Location location) {
         this.location = location;
@@ -56,7 +58,7 @@
     }
 
     public Message[] getMessages() {
-        ArrayList<Object> list = new ArrayList<Object>();
+        List<Object> list = new ArrayList<Object>();
         for (Iterator<AMQTxOperation> iter = operations.iterator(); iter.hasNext();) {
             AMQTxOperation op = iter.next();
             if (op.getOperationType() == AMQTxOperation.ADD_OPERATION_TYPE) {
@@ -69,7 +71,7 @@
     }
 
     public MessageAck[] getAcks() {
-        ArrayList<Object> list = new ArrayList<Object>();
+        List<Object> list = new ArrayList<Object>();
         for (Iterator<AMQTxOperation> iter = operations.iterator(); iter.hasNext();) {
             AMQTxOperation op = iter.next();
             if (op.getOperationType() == AMQTxOperation.REMOVE_OPERATION_TYPE) {
@@ -88,11 +90,11 @@
         return this.location;
     }
 
-    public ArrayList<AMQTxOperation> getOperations() {
+    public List<AMQTxOperation> getOperations() {
         return operations;
     }
 
-    public void setOperations(ArrayList<AMQTxOperation> operations) {
+    public void setOperations(List<AMQTxOperation> operations) {
         this.operations = operations;
     }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/RecoveryListenerAdapter.java Fri Aug 10 17:49:19 2007
@@ -28,7 +28,7 @@
     private static final Log LOG = LogFactory.getLog(RecoveryListenerAdapter.class);
     private final MessageStore store;
     private final MessageRecoveryListener listener;
-    private int count = 0;
+    private int count;
     private MessageId lastRecovered;
 
     RecoveryListenerAdapter(MessageStore store, MessageRecoveryListener listener) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCAdapter.java Fri Aug 10 17:49:19 2007
@@ -68,7 +68,7 @@
 
     long doGetLastMessageBrokerSequenceId(TransactionContext c) throws SQLException, IOException;
 
-    Set doGetDestinations(TransactionContext c) throws SQLException, IOException;
+    Set<ActiveMQDestination> doGetDestinations(TransactionContext c) throws SQLException, IOException;
 
     void setUseExternalMessageReferences(boolean useExternalMessageReferences);
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.java Fri Aug 10 17:49:19 2007
@@ -31,6 +31,7 @@
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.BrokerServiceAware;
 import org.apache.activemq.broker.ConnectionContext;
+import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.memory.UsageManager;
@@ -76,7 +77,7 @@
     private int cleanupPeriod = 1000 * 60 * 5;
     private boolean useExternalMessageReferences;
     private boolean useDatabaseLock = true;
-    private int lockKeepAlivePeriod = 0;
+    private int lockKeepAlivePeriod;
     private DatabaseLocker databaseLocker;
     private boolean createTablesOnStartup = true;
 
@@ -88,17 +89,17 @@
         this.wireFormat = wireFormat;
     }
 
-    public Set getDestinations() {
+    public Set<ActiveMQDestination> getDestinations() {
         // Get a connection and insert the message into the DB.
         TransactionContext c = null;
         try {
             c = getTransactionContext();
             return getAdapter().doGetDestinations(c);
         } catch (IOException e) {
-            return Collections.EMPTY_SET;
+            return emptyDestinationSet();
         } catch (SQLException e) {
             JDBCPersistenceAdapter.log("JDBC Failure: ", e);
-            return Collections.EMPTY_SET;
+            return emptyDestinationSet();
         } finally {
             if (c != null) {
                 try {
@@ -107,6 +108,11 @@
                 }
             }
         }
+    }
+
+    @SuppressWarnings("unchecked")
+    private Set<ActiveMQDestination> emptyDestinationSet() {
+        return Collections.EMPTY_SET;
     }
 
     public MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCTopicMessageStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCTopicMessageStore.java?view=diff&rev=564814&r1=564813&r2=564814
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCTopicMessageStore.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/JDBCTopicMessageStore.java Fri Aug 10 17:49:19 2007
@@ -38,7 +38,7 @@
  */
 public class JDBCTopicMessageStore extends JDBCMessageStore implements TopicMessageStore {
 
-    private Map subscriberLastMessageMap = new ConcurrentHashMap();
+    private Map<String, AtomicLong> subscriberLastMessageMap = new ConcurrentHashMap<String, AtomicLong>();
 
     public JDBCTopicMessageStore(JDBCPersistenceAdapter persistenceAdapter, JDBCAdapter adapter, WireFormat wireFormat, ActiveMQTopic topic) {
         super(persistenceAdapter, adapter, wireFormat, topic);
@@ -89,7 +89,7 @@
         throws Exception {
         TransactionContext c = persistenceAdapter.getTransactionContext();
         String subcriberId = getSubscriptionKey(clientId, subscriptionName);
-        AtomicLong last = (AtomicLong)subscriberLastMessageMap.get(subcriberId);
+        AtomicLong last = subscriberLastMessageMap.get(subcriberId);
         if (last == null) {
             long lastAcked = adapter.doGetLastAckedDurableSubscriberMessageId(c, destination, clientId, subscriptionName);
             last = new AtomicLong(lastAcked);



Mime
View raw message