[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-commit] r2340 - in jetty/trunk: . jetty-client/src/main/java/org/eclipse/jetty/client jetty-server/src/main/java/org/eclipse/jetty/server/nio jetty-util/src/main/java/org/eclipse/jetty/util

Author: gwilkins
Date: 2010-10-11 19:17:47 -0400 (Mon, 11 Oct 2010)
New Revision: 2340

Added:
   jetty/trunk/jetty-util/src/main/java/org/eclipse/jetty/util/ConcurrentHashSet.java
Modified:
   jetty/trunk/VERSION.txt
   jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
   jetty/trunk/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java
Log:
327469 removed needless java6 dependencies

Modified: jetty/trunk/VERSION.txt
===================================================================
--- jetty/trunk/VERSION.txt	2010-10-11 06:58:46 UTC (rev 2339)
+++ jetty/trunk/VERSION.txt	2010-10-11 23:17:47 UTC (rev 2340)
@@ -5,6 +5,7 @@
  + 326734 Configure Digest maxNonceAge with Security handler init param
  + 327109 Fixed AJP handling of empty packets
  + 327183 Allow better configurability of HttpClient for TLS/SSL
+ + 327469 removed needless java6 dependencies
  + JETTY-1288 Info statement when atypical classloader set on WebAppContext
 
 jetty-7.2.0.RC0 1 Oct 2010

Modified: jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
===================================================================
--- jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java	2010-10-11 06:58:46 UTC (rev 2339)
+++ jetty/trunk/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java	2010-10-11 23:17:47 UTC (rev 2340)
@@ -335,7 +335,7 @@
                 if (isProxied() && endPoint instanceof SelectConnector.ProxySelectChannelEndPoint)
                 {
                     SelectConnector.ProxySelectChannelEndPoint proxyEndPoint = (SelectConnector.ProxySelectChannelEndPoint)endPoint;
-                    HttpExchange exchange = _queue.peekFirst();
+                    HttpExchange exchange = _queue.get(0);
                     ConnectExchange connect = new ConnectExchange(getAddress(), proxyEndPoint, exchange);
                     connect.setAddress(getProxy());
                     send(connection, connect);

Modified: jetty/trunk/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java
===================================================================
--- jetty/trunk/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	2010-10-11 06:58:46 UTC (rev 2339)
+++ jetty/trunk/jetty-server/src/main/java/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	2010-10-11 23:17:47 UTC (rev 2340)
@@ -32,6 +32,7 @@
 import org.eclipse.jetty.io.nio.ChannelEndPoint;
 import org.eclipse.jetty.server.HttpConnection;
 import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.util.ConcurrentHashSet;
 import org.eclipse.jetty.util.log.Log;
 
 
@@ -50,7 +51,7 @@
 public class BlockingChannelConnector extends AbstractNIOConnector 
 {
     private transient ServerSocketChannel _acceptChannel;
-    private final Set<BlockingChannelEndPoint> _endpoints = Collections.newSetFromMap(new ConcurrentHashMap<BlockingChannelEndPoint,Boolean>());
+    private final Set<BlockingChannelEndPoint> _endpoints = new ConcurrentHashSet<BlockingChannelEndPoint>();
     
     
     /* ------------------------------------------------------------ */

Added: jetty/trunk/jetty-util/src/main/java/org/eclipse/jetty/util/ConcurrentHashSet.java
===================================================================
--- jetty/trunk/jetty-util/src/main/java/org/eclipse/jetty/util/ConcurrentHashSet.java	                        (rev 0)
+++ jetty/trunk/jetty-util/src/main/java/org/eclipse/jetty/util/ConcurrentHashSet.java	2010-10-11 23:17:47 UTC (rev 2340)
@@ -0,0 +1,108 @@
+package org.eclipse.jetty.util;
+
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ConcurrentHashSet<E> extends AbstractSet<E> implements Set<E>
+{
+    private final Map<E, Boolean> _map = new ConcurrentHashMap<E, Boolean>();
+    private transient Set<E> _keys = _map.keySet();
+
+    public ConcurrentHashSet()
+    {
+    }
+
+    @Override
+    public boolean add(E e)
+    {
+        return _map.put(e,Boolean.TRUE) == null;
+    }
+
+    @Override
+    public void clear()
+    {
+        _map.clear();
+    }
+
+    @Override
+    public boolean contains(Object o)
+    {
+        return _map.containsKey(o);
+    }
+
+    @Override
+    public boolean containsAll(Collection<?> c)
+    {
+        return _keys.containsAll(c);
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        return o == this || _keys.equals(o);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return _keys.hashCode();
+    }
+
+    @Override
+    public boolean isEmpty()
+    {
+        return _map.isEmpty();
+    }
+
+    @Override
+    public Iterator<E> iterator()
+    {
+        return _keys.iterator();
+    }
+
+    @Override
+    public boolean remove(Object o)
+    {
+        return _map.remove(o) != null;
+    }
+
+    @Override
+    public boolean removeAll(Collection<?> c)
+    {
+        return _keys.removeAll(c);
+    }
+
+    @Override
+    public boolean retainAll(Collection<?> c)
+    {
+        return _keys.retainAll(c);
+    }
+
+    @Override
+    public int size()
+    {
+        return _map.size();
+    }
+
+    @Override
+    public Object[] toArray()
+    {
+        return _keys.toArray();
+    }
+
+    @Override
+    public <T> T[] toArray(T[] a)
+    {
+        return _keys.toArray(a);
+    }
+
+    @Override
+    public String toString()
+    {
+        return _keys.toString();
+    }
+}


Property changes on: jetty/trunk/jetty-util/src/main/java/org/eclipse/jetty/util/ConcurrentHashSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native