[jbosscache-commits] JBoss Cache SVN: r6937 - in core/branches/flat/src/main/java/org/jboss/cache: buddyreplication and 12 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Oct 14 13:42:25 EDT 2008
Author: mircea.markus
Date: 2008-10-14 13:42:25 -0400 (Tue, 14 Oct 2008)
New Revision: 6937
Removed:
core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java
core/branches/flat/src/main/java/org/jboss/cache/cluster/
core/branches/flat/src/main/java/org/jboss/cache/io/
core/branches/flat/src/main/java/org/jboss/cache/lock/TimeoutException.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeData.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataExceptionMarker.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataMarker.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/UnmarshalledReferences.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/StateTransferManager.java
core/branches/flat/src/main/java/org/jboss/cache/util/FastCopyHashMap.java
core/branches/flat/src/main/java/org/jboss/cache/util/concurrent/locks/
core/branches/flat/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java
Modified:
core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
core/branches/flat/src/main/java/org/jboss/cache/DataContainer.java
core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/GravitateResult.java
core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/lock/IdentityLock.java
core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/lock/NodeLock.java
core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/Marshaller.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
core/branches/flat/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
core/branches/flat/src/main/java/org/jboss/cache/util/Immutables.java
Log:
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheSPI_Legacy.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -28,7 +28,7 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.starobrno.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.factories.ComponentRegistry;
@@ -198,7 +198,7 @@
* From 2.1.0, Interceptor authors should obtain this by injection rather than this method. See the
* {@link org.jboss.cache.factories.annotations.Inject} annotation.
*
- * @return the current {@link org.jboss.cache.statetransfer.StateTransferManager}
+ * @return the current {@link org.jboss.starobrno.statetransfer.StateTransferManager}
*/
StateTransferManager getStateTransferManager();
Modified: core/branches/flat/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/DataContainer.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/DataContainer.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,27 +1,27 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.cache;
-import org.jboss.cache.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeData;
import java.util.List;
import java.util.Set;
Modified: core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/RPCManagerImpl.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -30,15 +30,16 @@
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.lock.LockManager;
-import org.jboss.cache.lock.TimeoutException;
+import org.jboss.starobrno.lock.TimeoutException;
import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
-import org.jboss.cache.statetransfer.DefaultStateTransferManager;
+import org.jboss.starobrno.statetransfer.DefaultStateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.util.concurrent.ReclosableLatch;
-import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.util.ReflectionUtil;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.remoting.SuspectException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.RuntimeConfig;
import org.jboss.starobrno.factories.ComponentRegistry;
Modified: core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/RegionManagerImpl.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -28,8 +28,8 @@
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.lock.LockManager;
-import org.jboss.cache.util.concurrent.locks.LockContainer;
-import org.jboss.cache.util.concurrent.locks.ReentrantLockContainer;
+import org.jboss.starobrno.util.concurrent.locks.LockContainer;
+import org.jboss.starobrno.util.concurrent.locks.ReentrantLockContainer;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.config.ConfigurationException;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/SuspectException.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache;
-
-import org.jboss.starobrno.CacheException;
-
-/**
- * Thrown when a member is suspected during remote method invocation
- *
- * @author Bela Ban
- * @version $Id$
- */
-public class SuspectException extends CacheException
-{
-
- private static final long serialVersionUID = -2965599037371850141L;
-
- public SuspectException()
- {
- super();
- }
-
- public SuspectException(String msg)
- {
- super(msg);
- }
-
- public SuspectException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/UnversionedNode.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -24,28 +24,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.jboss.cache.AbstractNode.NodeFlags.*;
-import org.jboss.cache.util.FastCopyHashMap;
import org.jboss.cache.util.Immutables;
import org.jboss.cache.util.concurrent.SelfInitializingConcurrentHashMap;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.util.FastCopyHashMap;
import org.jboss.starobrno.marshall.MarshalledValue;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
+import java.util.*;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-/**
- * Basic data node class. Throws {@link UnsupportedOperationException} for version-specific methods like {@link #getVersion()} and
- * {@link #setVersion(org.jboss.cache.optimistic.DataVersion)}, defined in {@link org.jboss.cache.NodeSPI}.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 2.0.0
- */
public class UnversionedNode<K, V> extends AbstractNode<K, V> implements InternalNode<K, V>
{
/**
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -39,11 +39,11 @@
import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
-import org.jboss.cache.io.ExposedByteArrayOutputStream;
-import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.starobrno.io.ExposedByteArrayOutputStream;
+import org.jboss.starobrno.lock.TimeoutException;
+import org.jboss.starobrno.statetransfer.StateTransferManager;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
-import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.util.ReflectionUtil;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.BuddyReplicationConfig;
import org.jboss.starobrno.config.BuddyReplicationConfig.BuddyLocatorConfig;
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/GravitateResult.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/GravitateResult.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/GravitateResult.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -22,7 +22,7 @@
package org.jboss.cache.buddyreplication;
import org.jboss.cache.Fqn;
-import org.jboss.cache.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeData;
import java.util.List;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -34,7 +34,7 @@
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeData;
import org.jgroups.Address;
import java.util.LinkedList;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -24,7 +24,7 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.RPCManager;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.cluster.ReplicationQueue;
+import org.jboss.starobrno.cluster.ReplicationQueue;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.VisitableCommand;
@@ -142,7 +142,7 @@
if (!sync && replicationQueue != null && !usingBuddyReplication)
{
if (log.isDebugEnabled()) log.debug("Putting call " + call + " on the replication queue.");
- replicationQueue.add(commandsFactory.buildReplicateCommand(call));
+// replicationQueue.add(commandsFactory.buildReplicateCommand(call));
}
else
{
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -54,7 +54,7 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.starobrno.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.Immutables;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -31,9 +31,9 @@
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.marshall.NodeDataExceptionMarker;
-import org.jboss.cache.marshall.NodeDataMarker;
+import org.jboss.starobrno.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeDataMarker;
+import org.jboss.starobrno.marshall.NodeDataExceptionMarker;
import org.jboss.cache.util.Immutables;
import org.jboss.starobrno.CacheException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -25,7 +25,7 @@
import org.apache.commons.logging.Log;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.io.ByteBuffer;
+import org.jboss.starobrno.io.ByteBuffer;
import org.jboss.cache.lock.StripedLock;
import org.jboss.cache.util.Util;
import org.jboss.starobrno.config.CacheLoaderConfig;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -243,7 +243,7 @@
*
* @param os ObjectOutputStream to write state
* @see AbstractCacheLoader#loadEntireState(ObjectOutputStream)
- * @see org.jboss.cache.marshall.NodeData
+ * @see org.jboss.starobrno.marshall.NodeData
*/
void loadEntireState(ObjectOutputStream os) throws Exception;
@@ -263,7 +263,7 @@
*
* @param is ObjectInputStream to read state
* @see AbstractCacheLoader#storeEntireState(ObjectInputStream)
- * @see org.jboss.cache.marshall.NodeData
+ * @see org.jboss.starobrno.marshall.NodeData
*/
void storeEntireState(ObjectInputStream is) throws Exception;
@@ -288,7 +288,7 @@
* @param os ObjectOutputStream to write state
* @see AbstractCacheLoader#loadState(Fqn,ObjectOutputStream)
* @see org.jboss.cache.Region#activate()
- * @see org.jboss.cache.marshall.NodeData
+ * @see org.jboss.starobrno.marshall.NodeData
*/
void loadState(Fqn subtree, ObjectOutputStream os) throws Exception;
@@ -324,7 +324,7 @@
* Fqns should be altered to make them children of
* <code>subtree</code> before they are persisted.
* @see AbstractCacheLoader#storeState(Fqn,ObjectInputStream)
- * @see org.jboss.cache.marshall.NodeData
+ * @see org.jboss.starobrno.marshall.NodeData
*/
void storeState(Fqn subtree, ObjectInputStream is) throws Exception;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -26,7 +26,7 @@
import org.jboss.cache.CacheSPI_Legacy;
import org.jboss.cache.Fqn;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.util.ReflectionUtil;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.CacheLoaderConfig;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -25,7 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeData;
import org.jboss.starobrno.config.CacheLoaderConfig;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -44,7 +44,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.loader.AbstractCacheLoader;
-import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.util.ReflectionUtil;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.File;
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/IdentityLock.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/IdentityLock.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -26,6 +26,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
+import org.jboss.starobrno.lock.TimeoutException;
import java.util.ArrayList;
import java.util.Collection;
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -32,10 +32,10 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.invocation.InvocationContextContainer;
import static org.jboss.cache.lock.LockType.READ;
-import org.jboss.cache.util.concurrent.locks.LockContainer;
-import org.jboss.cache.util.concurrent.locks.OwnableReentrantLock;
-import org.jboss.cache.util.concurrent.locks.OwnableReentrantLockContainer;
-import org.jboss.cache.util.concurrent.locks.ReentrantLockContainer;
+import org.jboss.starobrno.util.concurrent.locks.LockContainer;
+import org.jboss.starobrno.util.concurrent.locks.OwnableReentrantLock;
+import org.jboss.starobrno.util.concurrent.locks.OwnableReentrantLockContainer;
+import org.jboss.starobrno.util.concurrent.locks.ReentrantLockContainer;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
@@ -59,12 +59,12 @@
* READ lock. JBoss Cache's MVCC design doesn't use read locks at all.
* <p/>
* The concept of lock owners is implicit in this implementation and any owners passed in as parameters (where required)
- * will be ignored. See {@link org.jboss.cache.util.concurrent.locks.OwnableReentrantLock} for details on how ownership
+ * will be ignored. See {@link org.jboss.starobrno.util.concurrent.locks.OwnableReentrantLock} for details on how ownership
* is determined.
* <p/>
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see org.jboss.cache.util.concurrent.locks.OwnableReentrantLock
+ * @see org.jboss.starobrno.util.concurrent.locks.OwnableReentrantLock
* @since 3.0
*/
public class MVCCLockManager extends FqnLockManager
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/NodeLock.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/NodeLock.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/NodeLock.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -22,6 +22,7 @@
package org.jboss.cache.lock;
import org.jboss.cache.Fqn;
+import org.jboss.starobrno.lock.TimeoutException;
import java.util.Collection;
import java.util.Set;
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -31,6 +31,7 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.lock.TimeoutException;
import java.util.List;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/lock/TimeoutException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.lock;
-
-import org.jboss.starobrno.CacheException;
-
-
-/**
- * Thrown when a timeout occurred. used by operations with timeouts, e.g. lock
- * acquisition, or waiting for responses from all members.
- *
- * @author <a href="mailto:bela at jboss.org">Bela Ban</a>.
- * @version $Revision$
- * <p/>
- * <p><b>Revisions:</b>
- * <p/>
- * <p>Dec 28 2002 Bela Ban: first implementation
- */
-public class TimeoutException extends CacheException
-{
-
- /**
- * The serialVersionUID
- */
- private static final long serialVersionUID = -8096787619908687038L;
-
- public TimeoutException()
- {
- super();
- }
-
- public TimeoutException(String msg)
- {
- super(msg);
- }
-
- public TimeoutException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
-
- @Override
- public String toString()
- {
- return super.toString();
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -25,7 +25,7 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.io.ByteBuffer;
+import org.jboss.starobrno.io.ByteBuffer;
import org.jboss.starobrno.commands.ReplicableCommand;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -25,33 +25,19 @@
import org.jboss.cache.Region;
import org.jboss.cache.Region.Status;
import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.util.FastCopyHashMap;
import org.jboss.cache.util.Immutables;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.commands.CommandsFactory;
import org.jboss.starobrno.commands.ReplicableCommand;
import org.jboss.starobrno.factories.annotations.Inject;
-import org.jboss.starobrno.marshall.MarshalledValue;
+import org.jboss.starobrno.marshall.*;
import org.jboss.starobrno.transaction.GlobalTransaction;
+import org.jboss.starobrno.util.FastCopyHashMap;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
+import java.io.*;
+import java.util.*;
/**
* An enhanced marshaller for RPC calls between CacheImpl instances.
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/Marshaller.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/Marshaller.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/Marshaller.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -22,7 +22,7 @@
package org.jboss.cache.marshall;
import org.jboss.cache.Fqn;
-import org.jboss.cache.io.ByteBuffer;
+import org.jboss.starobrno.io.ByteBuffer;
import org.jgroups.blocks.RpcDispatcher;
import java.io.InputStream;
@@ -48,7 +48,7 @@
* is used to marshall {@link org.jboss.cache.commands.ReplicableCommand}s, their parameters and their response values.
* <p/>
* The interface is also used by the {@link org.jboss.cache.loader.CacheLoader} framework to efficiently serialize data to be persisted, as well as
- * the {@link org.jboss.cache.statetransfer.StateTransferManager} when serializing the cache for transferring state en-masse.
+ * the {@link org.jboss.starobrno.statetransfer.StateTransferManager} when serializing the cache for transferring state en-masse.
*
* @author <a href="mailto://manik@jboss.org">Manik Surtani</a>
* @since 2.0.0
Deleted: core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeData.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeData.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeData.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,145 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.marshall;
-
-import org.jboss.cache.Fqn;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Serializable representation of the data of a node (FQN and attributes)
- *
- * @author Bela Ban
- * @version $Id$
- */
-// TODO: 3.0.0: remove Externalizable and rely on the CacheMarshaller.
-public class NodeData<K, V> implements Externalizable
-{
- private Fqn fqn = null;
- private Map<K, V> attrs = null;
-
- static final long serialVersionUID = -7571995794010294485L;
-
- public NodeData()
- {
- }
-
- public NodeData(Fqn fqn)
- {
- this.fqn = fqn;
- }
-
- public NodeData(Fqn fqn, Map<K, V> attrs, boolean mapSafe)
- {
- this.fqn = fqn;
- if (mapSafe || attrs == null)
- this.attrs = attrs;
- else
- this.attrs = new HashMap<K, V>(attrs);
- }
-
- public NodeData(String fqn, Map<K, V> attrs, boolean mapSafe)
- {
- this(Fqn.fromString(fqn), attrs, mapSafe);
- }
-
- public Map<K, V> getAttributes()
- {
- return attrs;
- }
-
- public Fqn getFqn()
- {
- return fqn;
- }
-
- public boolean isMarker()
- {
- return false;
- }
-
- public boolean isExceptionMarker()
- {
- return false;
- }
-
- // TODO: 3.0.0: Remove and replace with marshallNodeData/unmarshallNodeData methods in the CacheMarshaller so that we can use the same marshalling framework for Fqns.
- public void writeExternal(ObjectOutput out) throws IOException
- {
- out.writeObject(fqn);
- if (attrs != null)
- {
- out.writeBoolean(true);
- out.writeObject(attrs);
- }
- else
- {
- out.writeBoolean(false);
- }
- }
-
- // TODO: 3.0.0: Remove in and replace with marshallNodeData/unmarshallNodeData methods in the CacheMarshaller so that we can use the same marshalling framework for Fqns.
- @SuppressWarnings("unchecked")
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- fqn = (Fqn) in.readObject();
- if (in.readBoolean())
- {
- attrs = (Map<K, V>) in.readObject();
- }
- }
-
- @Override
- public String toString()
- {
- return "NodeData {fqn: " + fqn + ", attrs=" + attrs + "}";
- }
-
-
- @Override
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- NodeData nodeData = (NodeData) o;
-
- if (attrs != null ? !attrs.equals(nodeData.attrs) : nodeData.attrs != null) return false;
- if (fqn != null ? !fqn.equals(nodeData.fqn) : nodeData.fqn != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int result;
- result = (fqn != null ? fqn.hashCode() : 0);
- result = 31 * result + (attrs != null ? attrs.hashCode() : 0);
- return result;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataExceptionMarker.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataExceptionMarker.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataExceptionMarker.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.marshall;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-public class NodeDataExceptionMarker extends NodeData
-{
-
- private static final long serialVersionUID = 240199474174502551L;
- private Throwable cause;
- private Object cacheNodeIdentity;
-
- public NodeDataExceptionMarker()
- {
- super();
- }
-
- public NodeDataExceptionMarker(Throwable t, Object node)
- {
- cause = t;
- cacheNodeIdentity = node;
- }
-
- public Throwable getCause()
- {
- return cause;
- }
-
- public Object getCacheNodeIdentity()
- {
- return cacheNodeIdentity;
- }
-
- @Override
- public boolean isExceptionMarker()
- {
- return true;
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException
- {
- super.writeExternal(out);
- out.writeObject(cause);
- out.writeObject(cacheNodeIdentity);
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- super.readExternal(in);
- cause = (Throwable) in.readObject();
- cacheNodeIdentity = in.readObject();
- }
-
- @Override
- public String toString()
- {
- return "NodeDataExceptionMarker";
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataMarker.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataMarker.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/NodeDataMarker.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.marshall;
-
-public class NodeDataMarker extends NodeData
-{
-
- private static final long serialVersionUID = 4851793846346021014L;
-
- @Override
- public boolean isMarker()
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "NodeDataMarker";
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/marshall/UnmarshalledReferences.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/UnmarshalledReferences.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/UnmarshalledReferences.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.marshall;
-
-import org.jboss.starobrno.CacheException;
-
-import java.util.ArrayList;
-
-/**
- * An efficient array-based list of referenced objects, using the reference id as a subscript for the array.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- */
-public class UnmarshalledReferences
-{
- private final ArrayList<Object> referencedObjects = new ArrayList<Object>();
-
- /**
- * Retrieves an object referenced by an id
- *
- * @param ref reference
- * @return object
- */
- public Object getReferencedObject(int ref)
- {
- if (ref >= referencedObjects.size())
- throw new CacheException("Attempting to look up a ref that hasn't been inserted yet");
- return referencedObjects.get(ref);
- }
-
- /**
- * Adds a referenced object to the list of references
- *
- * @param ref reference id
- * @param o object
- */
- public void putReferencedObject(int ref, Object o)
- {
- int sz = referencedObjects.size();
- // if we are not adding the object to the end of the list, make sure we use a specific position
- if (ref < sz)
- {
- referencedObjects.set(ref, o);
- return;
- }
- else if (ref > sz)
- {
- // if we are adding the reference to a position beyond the end of the list, make sure we expand the list first.
- // this can happen, weirdly enough, since marshallObject() can be called recursively, such as from marshallFqn().
- for (int i = sz; i < ref; i++) referencedObjects.add(null);
- }
- referencedObjects.add(o);
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -24,8 +24,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.io.ByteBuffer;
-import org.jboss.cache.io.ExposedByteArrayOutputStream;
+import org.jboss.starobrno.io.ByteBuffer;
+import org.jboss.starobrno.io.ExposedByteArrayOutputStream;
import org.jboss.cache.util.Util;
import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.factories.annotations.Inject;
@@ -76,7 +76,7 @@
String replVersionString = configuration.getReplVersionString();
// this will cause the correct marshaller to be created and put in the map of marshallers
- defaultMarshaller = configuration.getMarshaller();
+// defaultMarshaller = configuration.getMarshaller();
if (defaultMarshaller == null)
{
String marshallerClass = configuration.getMarshallerClass();
Modified: core/branches/flat/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -24,9 +24,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.io.ExposedByteArrayOutputStream;
-import org.jboss.cache.statetransfer.DefaultStateTransferManager;
-import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.starobrno.io.ExposedByteArrayOutputStream;
+import org.jboss.starobrno.statetransfer.DefaultStateTransferManager;
+import org.jboss.starobrno.statetransfer.StateTransferManager;
import org.jboss.starobrno.CacheException;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
Modified: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -29,8 +29,9 @@
import org.jboss.cache.Node;
import org.jboss.cache.Version;
import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.marshall.NodeDataExceptionMarker;
+import org.jboss.starobrno.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeDataExceptionMarker;
+import org.jboss.starobrno.statetransfer.DefaultStateTransferManager;
import java.io.IOException;
import java.io.ObjectOutputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -32,10 +32,10 @@
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.marshall.NodeDataExceptionMarker;
-import org.jboss.cache.marshall.NodeDataMarker;
import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.marshall.NodeData;
+import org.jboss.starobrno.marshall.NodeDataMarker;
+import org.jboss.starobrno.marshall.NodeDataExceptionMarker;
import org.jboss.starobrno.config.Configuration;
import org.jboss.starobrno.factories.annotations.Inject;
import org.jboss.starobrno.factories.annotations.Start;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,200 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.statetransfer;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.RegionManager;
-import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.marshall.NodeDataMarker;
-import org.jboss.starobrno.CacheSPI;
-import org.jboss.starobrno.config.Configuration;
-import org.jboss.starobrno.factories.annotations.Inject;
-import org.jboss.starobrno.factories.annotations.Start;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- * The default state transfer manager to be used when using MVCC locking.
- */
-public class DefaultStateTransferManager implements StateTransferManager
-{
- protected final static Log log = LogFactory.getLog(DefaultStateTransferManager.class);
- protected static final boolean trace = log.isTraceEnabled();
-
- public static final NodeData STREAMING_DELIMITER_NODE = new NodeDataMarker();
-
- public static final String PARTIAL_STATE_DELIMITER = "_PARTIAL_STATE_DELIMITER";
-
- protected CacheSPI cache;
- protected Marshaller marshaller;
- protected RegionManager regionManager;
- protected Configuration configuration;
- private CacheLoaderManager cacheLoaderManager;
- boolean fetchTransientState;
- boolean fetchPersistentState;
- protected long stateRetrievalTimeout;
- protected StateTransferIntegrator integrator;
- protected StateTransferGenerator generator;
-
-
- @Inject
- public void injectDependencies(CacheSPI cache, Marshaller marshaller, RegionManager regionManager, Configuration configuration, CacheLoaderManager cacheLoaderManager, StateTransferIntegrator integrator, StateTransferGenerator generator)
- {
- this.cache = cache;
- this.regionManager = regionManager;
- this.marshaller = marshaller;
- this.configuration = configuration;
- this.cacheLoaderManager = cacheLoaderManager;
- this.integrator = integrator;
- this.generator = generator;
- }
-
- @Start(priority = 14)
- public void start()
- {
- fetchTransientState = configuration.isFetchInMemoryState();
- fetchPersistentState = cacheLoaderManager != null && cacheLoaderManager.isFetchPersistentState();
- stateRetrievalTimeout = configuration.getStateRetrievalTimeout();
- }
-
- public void getState(ObjectOutputStream out, Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Exception
- {
- throw new UnsupportedOperationException("Implement me properly!");
- /*
-
- // can't give state for regions currently being activated/inactivated
- boolean canProvideState = (!regionManager.isInactive(fqn) && cache.peek(fqn, false) != null);
- if (trace) log.trace("Can provide state? " + canProvideState);
- if (canProvideState && (fetchPersistentState || fetchTransientState))
- {
- marshaller.objectToObjectStream(true, out);
- long startTime = System.currentTimeMillis();
- InternalNode subtreeRoot = fqn.isRoot() ? cache.getRoot().getDelegationTarget() : cache.getNode(fqn).getDelegationTarget();
-
- // we don't need READ locks for MVCC based state transfer!
- if (log.isDebugEnabled())
- log.debug("Generating in-memory (transient) state for subtree " + fqn);
-
- generator.generateState(out, subtreeRoot, fetchTransientState, fetchPersistentState, suppressErrors);
-
- if (log.isDebugEnabled())
- log.debug("Successfully generated state in " + (System.currentTimeMillis() - startTime) + " msec");
- }
- else
- {
- marshaller.objectToObjectStream(false, out);
- Exception e = null;
- if (!canProvideState)
- {
- String exceptionMessage = "Cache instance at " + cache.getLocalAddress() + " cannot provide state for fqn " + fqn + ".";
-
- if (regionManager.isInactive(fqn))
- {
- exceptionMessage += " Region for fqn " + fqn + " is inactive.";
- e = new InactiveRegionException(exceptionMessage);
- }
- // this is not really an exception. Just provide empty state. The exception is just a signal. Yes, lousy. - JBCACHE-1349
- if (cache.peek(fqn, false, false) == null)
- {
- e = new RegionEmptyException();
- }
- }
- if (!fetchPersistentState && !fetchTransientState)
- {
- e = new CacheException("Cache instance at " + cache.getLocalAddress() + " is not configured to provide state");
- }
- marshaller.objectToObjectStream(e, out);
- if (e != null) throw e;
- }
- */
- }
-
- public void setState(ObjectInputStream in, Fqn targetRoot) throws Exception
- {
- throw new UnsupportedOperationException("fix me!");
- /*
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- NodeSPI target = cache.getNode(targetRoot);
- if (target == null)
- {
- // Create the integration root, but do not replicate
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
-
- //needed for BR state transfers
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- cache.put(targetRoot, null);
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- target = cache.getNode(targetRoot);
- }
- Object o = marshaller.objectFromObjectStream(in);
- Boolean hasState = (Boolean) o;
- if (hasState)
- {
- setState(in, target);
- }
- else
- {
- throw new CacheException("Cache instance at " + cache.getLocalAddress()
- + " cannot integrate state since state provider could not provide state due to " + marshaller.objectFromObjectStream(in));
- }
- */
- }
-
- /**
- * Set the portion of the cache rooted in <code>targetRoot</code>
- * to match the given state. Updates the contents of <code>targetRoot</code>
- * to reflect those in <code>new_state</code>.
- * <p/>
- * <strong>NOTE:</strong> This method performs no locking of nodes; it
- * is up to the caller to lock <code>targetRoot</code> before calling
- * this method.
- *
- * @param state a serialized byte[][] array where element 0 is the
- * transient state (or null) , and element 1 is the
- * persistent state (or null)
- * @param targetRoot node into which the state should be integrated
- */
- protected void setState(ObjectInputStream state, NodeSPI targetRoot) throws Exception
- {
- long startTime = System.currentTimeMillis();
- /*
- * Vladimir/Manik/Brian (Dec 7,2006)
- *
- * integrator.integrateState(in,targetRoot, cl) will call cache.put for each
- * node read from stream. Having option override below allows nodes read
- * to be directly stored into a tree since we bypass interceptor chain.
- *
- */
- if (log.isDebugEnabled())
- log.debug("starting state integration at node " + targetRoot + ". Fetch Persistent State = " + fetchPersistentState);
- integrator.integrateState(state, targetRoot.getDelegationTarget(), targetRoot.getFqn(), fetchPersistentState);
-
- if (log.isDebugEnabled())
- log.debug("successfully integrated state in " + (System.currentTimeMillis() - startTime) + " msec");
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/StateTransferManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/StateTransferManager.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/StateTransferManager.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.statetransfer;
-
-import org.jboss.cache.Fqn;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- * This interface handles requests to generate or integrate state from neighbouring caches in a cluster.
- * <p/>
- * This has existed prior to 3.0.0 as a concrete class. An interface was introduced in 3.0.0 to provide more flexibility
- * in state transfer implementations.
- * <p/>
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- */
-public interface StateTransferManager
-{
- /**
- * Writes the state for the portion of the tree named by <code>fqn</code> to
- * the provided OutputStream.
- * <p/>
- * <p/>
- *
- * @param out stream to write state to
- * @param fqn Fqn indicating the uppermost node in the
- * portion of the tree whose state should be returned.
- * @param timeout max number of millis this method should wait to acquire
- * any locks, if necessary, on the nodes being transferred
- * @param force if locks are needed and cannot be acquired after
- * <code>timeout</code> millis, should the lock acquisition
- * be forced, and any existing transactions holding locks
- * on the nodes be rolled back?
- * @param suppressErrors if true, all exceptions are logged but not propagated.
- * @throws Exception in event of error
- */
- void getState(ObjectOutputStream out, Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Exception;
-
- /**
- * Set the portion of the cache rooted in <code>targetRoot</code>
- * to match the given state. Updates the contents of <code>targetRoot</code>
- * to reflect those in <code>new_state</code>.
- * <p/>
- * <strong>NOTE:</strong> This method performs no locking of nodes; it
- * is up to the caller to lock <code>targetRoot</code> before calling
- * this method.
- * <p/>
- * This method will use any {@link ClassLoader} needed as defined by the active {@link org.jboss.cache.Region}
- * in the {@link org.jboss.cache.RegionManager}, pertaining to the targetRoot passed in.
- *
- * @param in an input stream containing the state
- * @param targetRoot fqn of the node into which the state should be integrated
- * @throws Exception In event of error
- */
- void setState(ObjectInputStream in, Fqn targetRoot) throws Exception;
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/util/FastCopyHashMap.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/FastCopyHashMap.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/FastCopyHashMap.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,836 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.util;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.AbstractCollection;
-import java.util.AbstractMap;
-import java.util.AbstractSet;
-import java.util.Collection;
-import java.util.ConcurrentModificationException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-/**
- * A HashMap that is optimized for fast shallow copies.
- *
- * @author Jason T. Greene
- */
-public class FastCopyHashMap<K, V> extends AbstractMap<K, V> implements Map<K, V>, Cloneable, Serializable
-{
- /**
- * Marks null keys.
- */
- private static final Object NULL = new Object();
-
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = 10929568968762L;
-
- /**
- * Same default as HashMap, must be a power of 2
- */
- private static final int DEFAULT_CAPACITY = 8;
-
- /**
- * MAX_INT - 1
- */
- private static final int MAXIMUM_CAPACITY = 1 << 30;
-
- /**
- * 67%, just like IdentityHashMap
- */
- private static final float DEFAULT_LOAD_FACTOR = 0.67f;
-
- /**
- * The open-addressed table
- */
- private transient Entry<K, V>[] table;
-
- /**
- * The current number of key-value pairs
- */
- private transient int size;
-
- /**
- * The next resize
- */
- private transient int threshold;
-
- /**
- * The user defined load factor which defines when to resize
- */
- private final float loadFactor;
-
- /**
- * Counter used to detect changes made outside of an iterator
- */
- private transient int modCount;
-
- // Cached views
- private transient KeySet keySet;
- private transient Values values;
- private transient EntrySet entrySet;
-
- public FastCopyHashMap(int initialCapacity, float loadFactor)
- {
- if (initialCapacity < 0)
- throw new IllegalArgumentException("Can not have a negative size table!");
-
- if (initialCapacity > MAXIMUM_CAPACITY)
- initialCapacity = MAXIMUM_CAPACITY;
-
- if (!(loadFactor > 0F && loadFactor <= 1F))
- throw new IllegalArgumentException("Load factor must be greater than 0 and less than or equal to 1");
-
- this.loadFactor = loadFactor;
- init(initialCapacity, loadFactor);
- }
-
- @SuppressWarnings("unchecked")
- public FastCopyHashMap(Map<? extends K, ? extends V> map)
- {
- if (map instanceof FastCopyHashMap)
- {
- FastCopyHashMap<? extends K, ? extends V> fast = (FastCopyHashMap<? extends K, ? extends V>) map;
- this.table = (Entry<K, V>[]) fast.table.clone();
- this.loadFactor = fast.loadFactor;
- this.size = fast.size;
- this.threshold = fast.threshold;
- }
- else
- {
- this.loadFactor = DEFAULT_LOAD_FACTOR;
- init(map.size(), this.loadFactor);
- putAll(map);
- }
- }
-
- @SuppressWarnings("unchecked")
- private void init(int initialCapacity, float loadFactor)
- {
- int c = 1;
- for (; c < initialCapacity; c <<= 1) ;
-
- this.table = (Entry<K, V>[]) new Entry[c];
-
- threshold = (int) (c * loadFactor);
- }
-
- public FastCopyHashMap(int initialCapacity)
- {
- this(initialCapacity, DEFAULT_LOAD_FACTOR);
- }
-
- public FastCopyHashMap()
- {
- this(DEFAULT_CAPACITY);
- }
-
- // The normal bit spreader...
- private static final int hash(Object key)
- {
- int h = key.hashCode();
- h ^= (h >>> 20) ^ (h >>> 12);
- return h ^ (h >>> 7) ^ (h >>> 4);
- }
-
- @SuppressWarnings("unchecked")
- private static final <K> K maskNull(K key)
- {
- return key == null ? (K) NULL : key;
- }
-
- private static final <K> K unmaskNull(K key)
- {
- return key == NULL ? null : key;
- }
-
- private int nextIndex(int index, int length)
- {
- index = (index >= length - 1) ? 0 : index + 1;
- return index;
- }
-
- private static final boolean eq(Object o1, Object o2)
- {
- return o1 == o2 || (o1 != null && o1.equals(o2));
- }
-
- private static final int index(int hashCode, int length)
- {
- return hashCode & (length - 1);
- }
-
- public int size()
- {
- return size;
- }
-
- public boolean isEmpty()
- {
- return size == 0;
- }
-
- public V get(Object key)
- {
- key = maskNull(key);
-
- int hash = hash(key);
- int length = table.length;
- int index = index(hash, length);
-
- for (; ;)
- {
- Entry<K, V> e = table[index];
- if (e == null)
- return null;
-
- if (e.hash == hash && eq(key, e.key))
- return e.value;
-
- index = nextIndex(index, length);
- }
- }
-
- public boolean containsKey(Object key)
- {
- key = maskNull(key);
-
- int hash = hash(key);
- int length = table.length;
- int index = index(hash, length);
-
- for (; ;)
- {
- Entry<K, V> e = table[index];
- if (e == null)
- return false;
-
- if (e.hash == hash && eq(key, e.key))
- return true;
-
- index = nextIndex(index, length);
- }
- }
-
- public boolean containsValue(Object value)
- {
- for (Entry<K, V> e : table)
- if (e != null && eq(value, e.value))
- return true;
-
- return false;
- }
-
- public V put(K key, V value)
- {
- key = maskNull(key);
-
- Entry<K, V>[] table = this.table;
- int hash = hash(key);
- int length = table.length;
- int start = index(hash, length);
- int index = start;
-
-
- for (; ;)
- {
- Entry<K, V> e = table[index];
- if (e == null)
- break;
-
- if (e.hash == hash && eq(key, e.key))
- {
- table[index] = new Entry<K, V>(e.key, e.hash, value);
- return e.value;
- }
-
- index = nextIndex(index, length);
- if (index == start)
- throw new IllegalStateException("Table is full!");
- }
-
- modCount++;
- table[index] = new Entry<K, V>(key, hash, value);
- if (++size >= threshold)
- resize(length);
-
- return null;
- }
-
-
- @SuppressWarnings("unchecked")
- private void resize(int from)
- {
- int newLength = from << 1;
-
- // Can't get any bigger
- if (newLength > MAXIMUM_CAPACITY || newLength <= from)
- return;
-
- Entry<K, V>[] newTable = new Entry[newLength];
- Entry<K, V>[] old = table;
-
- for (Entry<K, V> e : old)
- {
- if (e == null)
- continue;
-
- int index = index(e.hash, newLength);
- while (newTable[index] != null)
- index = nextIndex(index, newLength);
-
- newTable[index] = e;
- }
-
- threshold = (int) (loadFactor * newLength);
- table = newTable;
- }
-
- public void putAll(Map<? extends K, ? extends V> map)
- {
- int size = map.size();
- if (size == 0)
- return;
-
- if (size > threshold)
- {
- if (size > MAXIMUM_CAPACITY)
- size = MAXIMUM_CAPACITY;
-
- int length = table.length;
- for (; length < size; length <<= 1) ;
-
- resize(length);
- }
-
- for (Map.Entry<? extends K, ? extends V> e : map.entrySet())
- put(e.getKey(), e.getValue());
- }
-
- public V remove(Object key)
- {
- key = maskNull(key);
-
- Entry<K, V>[] table = this.table;
- int length = table.length;
- int hash = hash(key);
- int start = index(hash, length);
-
- for (int index = start; ;)
- {
- Entry<K, V> e = table[index];
- if (e == null)
- return null;
-
- if (e.hash == hash && eq(key, e.key))
- {
- table[index] = null;
- relocate(index);
- modCount++;
- size--;
- return e.value;
- }
-
- index = nextIndex(index, length);
- if (index == start)
- return null;
- }
-
-
- }
-
- private void relocate(int start)
- {
- Entry<K, V>[] table = this.table;
- int length = table.length;
- int current = nextIndex(start, length);
-
- for (; ;)
- {
- Entry<K, V> e = table[current];
- if (e == null)
- return;
-
- // A Doug Lea variant of Knuth's Section 6.4 Algorithm R.
- // This provides a non-recursive method of relocating
- // entries to their optimal positions once a gap is created.
- int prefer = index(e.hash, length);
- if ((current < prefer && (prefer <= start || start <= current))
- || (prefer <= start && start <= current))
- {
- table[start] = e;
- table[current] = null;
- start = current;
- }
-
- current = nextIndex(current, length);
- }
- }
-
- public void clear()
- {
- modCount++;
- Entry<K, V>[] table = this.table;
- for (int i = 0; i < table.length; i++)
- table[i] = null;
-
- size = 0;
- }
-
- @SuppressWarnings("unchecked")
- public Object clone()
- {
- try
- {
- FastCopyHashMap<K, V> clone = (FastCopyHashMap<K, V>) super.clone();
- clone.table = table.clone();
- clone.entrySet = null;
- clone.values = null;
- clone.keySet = null;
- return clone;
- }
- catch (CloneNotSupportedException e)
- {
- // should never happen
- throw new IllegalStateException(e);
- }
- }
-
- public void printDebugStats()
- {
- int optimal = 0;
- int total = 0;
- int totalSkew = 0;
- int maxSkew = 0;
- for (int i = 0; i < table.length; i++)
- {
- Entry<K, V> e = table[i];
- if (e != null)
- {
-
- total++;
- int target = index(e.hash, table.length);
- if (i == target)
- optimal++;
- else
- {
- int skew = Math.abs(i - target);
- if (skew > maxSkew) maxSkew = skew;
- totalSkew += skew;
- }
-
- }
- }
-
- System.out.println(" Size: " + size);
- System.out.println(" Real Size: " + total);
- System.out.println(" Optimal: " + optimal + " (" + (float) optimal * 100 / total + "%)");
- System.out.println(" Average Distnce: " + ((float) totalSkew / (total - optimal)));
- System.out.println(" Max Distance: " + maxSkew);
- }
-
- public Set<Map.Entry<K, V>> entrySet()
- {
- if (entrySet == null)
- entrySet = new EntrySet();
-
- return entrySet;
- }
-
- public Set<K> keySet()
- {
- if (keySet == null)
- keySet = new KeySet();
-
- return keySet;
- }
-
- public Collection<V> values()
- {
- if (values == null)
- values = new Values();
-
- return values;
- }
-
- @SuppressWarnings("unchecked")
- private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException
- {
- s.defaultReadObject();
-
- int size = s.readInt();
-
- init(size, loadFactor);
-
- for (int i = 0; i < size; i++)
- {
- K key = (K) s.readObject();
- V value = (V) s.readObject();
- putForCreate(key, value);
- }
- }
-
- @SuppressWarnings("unchecked")
- private void putForCreate(K key, V value)
- {
- key = maskNull(key);
-
- Entry<K, V>[] table = this.table;
- int hash = hash(key);
- int length = table.length;
- int index = index(hash, length);
-
- Entry<K, V> e = table[index];
- while (e != null)
- {
- index = nextIndex(index, length);
- e = table[index];
- }
-
- table[index] = new Entry<K, V>(key, hash, value);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws IOException
- {
- s.defaultWriteObject();
- s.writeInt(size);
-
- for (Entry<K, V> e : table)
- {
- if (e != null)
- {
- s.writeObject(unmaskNull(e.key));
- s.writeObject(e.value);
- }
- }
- }
-
- private static final class Entry<K, V>
- {
- final K key;
- final int hash;
- final V value;
-
- Entry(K key, int hash, V value)
- {
- this.key = key;
- this.hash = hash;
- this.value = value;
- }
- }
-
- private abstract class FasyCopyHashMapIterator<E> implements Iterator<E>
- {
- private int next = 0;
- private int expectedCount = modCount;
- private int current = -1;
- private boolean hasNext;
- Entry<K, V> table[] = FastCopyHashMap.this.table;
-
- public boolean hasNext()
- {
- if (hasNext == true)
- return true;
-
- Entry<K, V> table[] = this.table;
- for (int i = next; i < table.length; i++)
- {
- if (table[i] != null)
- {
- next = i;
- return hasNext = true;
- }
- }
-
- next = table.length;
- return false;
- }
-
- protected Entry<K, V> nextEntry()
- {
- if (modCount != expectedCount)
- throw new ConcurrentModificationException();
-
- if (!hasNext && !hasNext())
- throw new NoSuchElementException();
-
- current = next++;
- hasNext = false;
-
- return table[current];
- }
-
- @SuppressWarnings("unchecked")
- public void remove()
- {
- if (modCount != expectedCount)
- throw new ConcurrentModificationException();
-
- int current = this.current;
- int delete = current;
-
- if (current == -1)
- throw new IllegalStateException();
-
- // Invalidate current (prevents multiple remove)
- this.current = -1;
-
- // Start were we relocate
- next = delete;
-
- Entry<K, V>[] table = this.table;
- if (table != FastCopyHashMap.this.table)
- {
- FastCopyHashMap.this.remove(table[delete].key);
- table[delete] = null;
- expectedCount = modCount;
- return;
- }
-
-
- int length = table.length;
- int i = delete;
-
- table[delete] = null;
- size--;
-
- for (; ;)
- {
- i = nextIndex(i, length);
- Entry<K, V> e = table[i];
- if (e == null)
- break;
-
- int prefer = index(e.hash, length);
- if ((i < prefer && (prefer <= delete || delete <= i))
- || (prefer <= delete && delete <= i))
- {
- // Snapshot the unseen portion of the table if we have
- // to relocate an entry that was already seen by this iterator
- if (i < current && current <= delete && table == FastCopyHashMap.this.table)
- {
- int remaining = length - current;
- Entry<K, V>[] newTable = (Entry<K, V>[]) new Entry[remaining];
- System.arraycopy(table, current, newTable, 0, remaining);
-
- // Replace iterator's table.
- // Leave table local var pointing to the real table
- this.table = newTable;
- next = 0;
- }
-
- // Do the swap on the real table
- table[delete] = e;
- table[i] = null;
- delete = i;
- }
- }
- }
- }
-
-
- private class KeyIterator extends FasyCopyHashMapIterator<K>
- {
- public K next()
- {
- return unmaskNull(nextEntry().key);
- }
- }
-
- private class ValueIterator extends FasyCopyHashMapIterator<V>
- {
- public V next()
- {
- return nextEntry().value;
- }
- }
-
- private class EntryIterator extends FasyCopyHashMapIterator<Map.Entry<K, V>>
- {
- private class WriteThroughEntry extends SimpleEntry<K, V>
- {
- WriteThroughEntry(K key, V value)
- {
- super(key, value);
- }
-
- public V setValue(V value)
- {
- if (table != FastCopyHashMap.this.table)
- FastCopyHashMap.this.put(getKey(), value);
-
- return super.setValue(value);
- }
- }
-
- public Map.Entry<K, V> next()
- {
- Entry<K, V> e = nextEntry();
- return new WriteThroughEntry(unmaskNull(e.key), e.value);
- }
-
- }
-
- private class KeySet extends AbstractSet<K>
- {
- public Iterator<K> iterator()
- {
- return new KeyIterator();
- }
-
- public void clear()
- {
- FastCopyHashMap.this.clear();
- }
-
- public boolean contains(Object o)
- {
- return containsKey(o);
- }
-
- public boolean remove(Object o)
- {
- int size = size();
- FastCopyHashMap.this.remove(o);
- return size() < size;
- }
-
- public int size()
- {
- return FastCopyHashMap.this.size();
- }
- }
-
- private class Values extends AbstractCollection<V>
- {
- public Iterator<V> iterator()
- {
- return new ValueIterator();
- }
-
- public void clear()
- {
- FastCopyHashMap.this.clear();
- }
-
- public int size()
- {
- return FastCopyHashMap.this.size();
- }
- }
-
- private class EntrySet extends AbstractSet<Map.Entry<K, V>>
- {
- public Iterator<Map.Entry<K, V>> iterator()
- {
- return new EntryIterator();
- }
-
- public boolean contains(Object o)
- {
- if (!(o instanceof Map.Entry))
- return false;
-
- Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
- Object value = get(entry.getKey());
- return eq(entry.getValue(), value);
- }
-
- public void clear()
- {
- FastCopyHashMap.this.clear();
- }
-
- public boolean isEmpty()
- {
- return FastCopyHashMap.this.isEmpty();
- }
-
- public int size()
- {
- return FastCopyHashMap.this.size();
- }
- }
-
- protected static class SimpleEntry<K, V> implements Map.Entry<K, V>
- {
- private K key;
- private V value;
-
- SimpleEntry(K key, V value)
- {
- this.key = key;
- this.value = value;
- }
-
- SimpleEntry(Map.Entry<K, V> entry)
- {
- this.key = entry.getKey();
- this.value = entry.getValue();
- }
-
- public K getKey()
- {
- return key;
- }
-
- public V getValue()
- {
- return value;
- }
-
- public V setValue(V value)
- {
- V old = this.value;
- this.value = value;
- return old;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- return true;
-
- if (!(o instanceof Map.Entry))
- return false;
- Map.Entry<?, ?> e = (Map.Entry<?, ?>) o;
- return eq(key, e.getKey()) && eq(value, e.getValue());
- }
-
- public int hashCode()
- {
- return hash(key) ^
- (value == null ? 0 : hash(value));
- }
-
- public String toString()
- {
- return getKey() + "=" + getValue();
- }
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/util/Immutables.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/Immutables.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/Immutables.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -21,6 +21,8 @@
*/
package org.jboss.cache.util;
+import org.jboss.starobrno.util.FastCopyHashMap;
+
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java 2008-10-14 17:12:01 UTC (rev 6936)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java 2008-10-14 17:42:25 UTC (rev 6937)
@@ -1,153 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.cache.util.reflect;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.starobrno.CacheException;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Basic reflection utilities to enhance what the JDK provides.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 2.1.0
- */
-public class ReflectionUtil
-{
- private static final Log log = LogFactory.getLog(ReflectionUtil.class);
-
- /**
- * Returns a set of Methods that contain the given method annotation. This includes all public, protected, package and private
- * methods, as well as those of superclasses. Note that this does *not* include overridden methods.
- *
- * @param c class to inspect
- * @param annotationType the type of annotation to look for
- * @return List of Method objects that require injection.
- */
- public static List<Method> getAllMethods(Class c, Class<? extends Annotation> annotationType)
- {
- List<Method> annotated = new LinkedList<Method>();
- inspectRecursively(c, annotated, annotationType);
- return annotated;
- }
-
- /**
- * Inspects a class and its superclasses (all the way to {@link Object} for method instances that contain a given annotation.
- * This even identifies private, package and protected methods, not just public ones.
- *
- * @param c
- * @param s
- * @param annotationType
- */
- private static void inspectRecursively(Class c, List<Method> s, Class<? extends Annotation> annotationType)
- {
- // Superclass first
- if (!c.equals(Object.class)) inspectRecursively(c.getSuperclass(), s, annotationType);
-
- for (Method m : c.getDeclaredMethods())
- {
- // don't bother if this method has already been overridden by a subclass
- if (!alreadyFound(m, s) && m.isAnnotationPresent(annotationType))
- {
- s.add(m);
- }
- }
- }
-
- /**
- * Tests whether a method has already been found, i.e., overridden.
- *
- * @param m method to inspect
- * @param s collection of methods found
- * @return true a method with the same signature already exists.
- */
- private static boolean alreadyFound(Method m, Collection<Method> s)
- {
- for (Method found : s)
- {
- if (m.getName().equals(found.getName()) &&
- Arrays.equals(m.getParameterTypes(), found.getParameterTypes()))
- return true;
- }
- return false;
- }
-
- public static void setValue(Object instance, String fieldName, Object value)
- {
- try
- {
- Field f = findFieldRecursively(instance.getClass(), fieldName);
- if (f == null)
- throw new NoSuchMethodException("Cannot find field " + fieldName + " on " + instance.getClass() + " or superclasses");
- f.setAccessible(true);
- f.set(instance, value);
- }
- catch (Exception e)
- {
- log.error("Unable to set value!", e);
- }
- }
-
- private static Field findFieldRecursively(Class c, String fieldName)
- {
- Field f = null;
- try
- {
- f = c.getDeclaredField(fieldName);
- }
- catch (NoSuchFieldException e)
- {
- if (!c.equals(Object.class)) f = findFieldRecursively(c.getSuperclass(), fieldName);
- }
- return f;
- }
-
- /**
- * Invokes a method using reflection, in an accessible manner (by using {@link Method#setAccessible(boolean)}
- *
- * @param instance instance on which to execute the method
- * @param method method to execute
- * @param parameters parameters
- */
- public static void invokeAccessibly(Object instance, Method method, Object[] parameters)
- {
- try
- {
- method.setAccessible(true);
- method.invoke(instance, parameters);
- }
- catch (Exception e)
- {
- throw new CacheException("Unable to invoke method " + method + " on object " + //instance +
- (parameters != null ? " with parameters " + Arrays.asList(parameters) : ""), e);
- }
- }
-
-}
More information about the jbosscache-commits
mailing list