From jboss-remoting-commits at lists.jboss.org Tue Aug 31 11:49:47 2010 Content-Type: multipart/mixed; boundary="===============2348974909900051709==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r6079 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3. Date: Tue, 31 Aug 2010 11:49:46 -0400 Message-ID: <201008311549.o7VFnkWp000419@svn01.web.mwc.hst.phx2.redhat.com> --===============2348974909900051709== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)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/CopyOnW= riteHashMapWrapper.java Log: JBREM-1244: Wrapper for package private class CopyOnWriteHashMap. Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/Cop= yOnWriteHashMapWrapper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/CopyOn= WriteHashMapWrapper.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/CopyOn= WriteHashMapWrapper.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 Ron Sigal + * @version $Revision: 1.1 $ + * + * Copyright Aug 28, 2010 + */ +public class CopyOnWriteHashMapWrapper implements ConcurrentMap { + private CopyOnWriteHashMap map =3D new CopyOnWriteHashMap(); + + public CopyOnWriteHashMapWrapper() { + this(new Object()); + } + + public CopyOnWriteHashMapWrapper(final Object writeLock) { + this(false, writeLock); + } + + public CopyOnWriteHashMapWrapper(final boolean identity, final Object w= riteLock) { + map =3D new CopyOnWriteHashMap(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 orig) { + map.putAll(orig); + } + + public void clear() { + map.clear(); + } + + public Set keySet() { + return map.keySet(); + } + + public Collection values() { + return map.values(); + } + + public Set> entrySet() { + return map.entrySet(); + } +} --===============2348974909900051709==--