[jboss-remoting-commits] JBoss Remoting SVN: r6079 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Aug 31 11:49:46 EDT 2010


Author: ron.sigal at jboss.com
Date: 2010-08-31 11:49:46 -0400 (Tue, 31 Aug 2010)
New Revision: 6079

Added:
   remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/CopyOnWriteHashMapWrapper.java
Log:
JBREM-1244: Wrapper for package private class CopyOnWriteHashMap.

Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/CopyOnWriteHashMapWrapper.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/CopyOnWriteHashMapWrapper.java	                        (rev 0)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/CopyOnWriteHashMapWrapper.java	2010-08-31 15:49:46 UTC (rev 6079)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting3;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ *
+ * Copyright Aug 28, 2010
+ */
+public class CopyOnWriteHashMapWrapper<K, V> implements ConcurrentMap<K, V> {
+   private CopyOnWriteHashMap<K, V> map = new CopyOnWriteHashMap<K, V>();
+
+   public CopyOnWriteHashMapWrapper() {
+      this(new Object());
+   }
+
+   public CopyOnWriteHashMapWrapper(final Object writeLock) {
+      this(false, writeLock);
+   }
+
+   public CopyOnWriteHashMapWrapper(final boolean identity, final Object writeLock) {
+      map = new CopyOnWriteHashMap<K, V>(identity, writeLock);
+   }
+
+   public V putIfAbsent(final K key, final V value) {
+      return map.putIfAbsent(key, value);
+   }
+
+   public boolean remove(final Object key, final Object value) {
+      return map.remove(key, value);
+   }
+
+   public boolean replace(final K key, final V oldValue, final V newValue) {
+      return map.replace(key, oldValue, newValue);
+   }
+
+   public V replace(final K key, final V value) {
+      return map.replace(key, value);
+   }
+
+   public int size() {
+      return map.size();
+   }
+
+   public boolean isEmpty() {
+      return map.isEmpty();
+   }
+
+   public boolean containsKey(final Object key) {
+      return map.containsKey(key);
+   }
+
+   public boolean containsValue(final Object value) {
+      return map.containsValue(value);
+   }
+
+   public V get(final Object key) {
+      return map.get(key);
+   }
+
+   public V put(final K key, final V value) {
+      return map.put(key, value);
+   }
+
+   public V remove(final Object key) {
+      return map.remove(key);
+   }
+
+   public void putAll(final Map<? extends K, ? extends V> orig) {
+      map.putAll(orig);
+   }
+
+   public void clear() {
+      map.clear();
+   }
+
+   public Set<K> keySet() {
+      return map.keySet();
+   }
+
+   public Collection<V> values() {
+      return map.values();
+   }
+
+   public Set<Entry<K, V>> entrySet() {
+      return map.entrySet();
+   }
+}



More information about the jboss-remoting-commits mailing list