[jbosscache-commits] JBoss Cache SVN: r6885 - in core/branches/flat/src/main/java/org/jboss/cache: batch and 25 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Oct 8 12:28:10 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-10-08 12:28:04 -0400 (Wed, 08 Oct 2008)
New Revision: 6885
Removed:
core/branches/flat/src/main/java/org/jboss/cache/CacheException.java
core/branches/flat/src/main/java/org/jboss/cache/commands/OptimisticCommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/PessimisticCommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/legacy/
core/branches/flat/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
core/branches/flat/src/main/java/org/jboss/cache/factories/CacheConfigsXmlParser.java
core/branches/flat/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/annotations/
core/branches/flat/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/Interceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheStoreInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferGenerator.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferIntegrator.java
core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
Modified:
core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java
core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java
core/branches/flat/src/main/java/org/jboss/cache/Cache.java
core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java
core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java
core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java
core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyLocator.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyNotInitException.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java
core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocatorConfig.java
core/branches/flat/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
core/branches/flat/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java
core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
core/branches/flat/src/main/java/org/jboss/cache/commands/VersionedDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/Visitor.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/branches/flat/src/main/java/org/jboss/cache/factories/BootstrapFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/BuddyManagerFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/CommandsMetaFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/branches/flat/src/main/java/org/jboss/cache/factories/ContextMetaFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/LockManagerFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/NodeMetaFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/RegionManagerFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/ReplicationQueueFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/RuntimeConfigAwareFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferManagerFactory.java
core/branches/flat/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/BuddyRegionAwareEvictionInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/JmxStatsCommandInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/PrePostProcessingCommandInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java
core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java
core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoaderConfig.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/ChainingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOldConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreDefaultConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java
core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3Exception.java
core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3LoaderConfig.java
core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
core/branches/flat/src/main/java/org/jboss/cache/lock/AbstractLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/lock/LockStrategyFactory.java
core/branches/flat/src/main/java/org/jboss/cache/lock/LockingException.java
core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
core/branches/flat/src/main/java/org/jboss/cache/lock/TimeoutException.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/CacheMarshaller300.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionException.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValue.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValueMap.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/MethodCall.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/UnmarshalledReferences.java
core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java
core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java
core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java
core/branches/flat/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java
core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.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/statetransfer/DefaultStateTransferManager.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/AbstractTransactionContext.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java
core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java
core/branches/flat/src/main/java/org/jboss/cache/util/concurrent/WithinThreadExecutor.java
core/branches/flat/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java
Log:
Moved stuff
Modified: core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/AbstractNode.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,7 +24,6 @@
import static org.jboss.cache.AbstractNode.NodeFlags.REMOVED;
import static org.jboss.cache.AbstractNode.NodeFlags.RESIDENT;
import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -180,17 +179,6 @@
throw new UnsupportedOperationException("Not supported in this implementation!");
}
- // versioning
- public void setVersion(DataVersion version)
- {
- throw new UnsupportedOperationException("Versioning not supported");
- }
-
- public DataVersion getVersion()
- {
- throw new UnsupportedOperationException("Versioning not supported");
- }
-
@Override
public boolean equals(Object another)
{
Modified: core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/AbstractNodeFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,15 +22,13 @@
package org.jboss.cache;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.invocation.NodeInvocationDelegate;
import org.jboss.cache.mvcc.ReadCommittedNode;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
import java.util.Map;
@@ -115,11 +113,6 @@
throw new UnsupportedOperationException("Unsupported in this implementation (" + getClass().getSimpleName() + ")!");
}
- public WorkspaceNode<K, V> createWrappedNode(NodeSPI<K, V> dataNode, TransactionWorkspace workspace)
- {
- throw new UnsupportedOperationException("Unsupported in this implementation (" + getClass().getSimpleName() + ")!");
- }
-
public ReadCommittedNode createWrappedNode(InternalNode<K, V> node, InternalNode<K, V> parent)
{
throw new UnsupportedOperationException("Unsupported in this implementation (" + getClass().getSimpleName() + ")!");
Modified: core/branches/flat/src/main/java/org/jboss/cache/Cache.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/Cache.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/Cache.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,7 +22,8 @@
package org.jboss.cache;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.config.Configuration;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
import org.jgroups.Address;
import java.util.List;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/CacheException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheException.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheException.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,57 +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;
-
-/**
- * Thrown when operations on {@link org.jboss.cache.Cache} or {@link org.jboss.cache.Node} fail unexpectedly.
- * <p/>
- * Specific subclasses such as {@link org.jboss.cache.lock.TimeoutException}, {@link org.jboss.cache.config.ConfigurationException} and {@link org.jboss.cache.lock.LockingException}
- * have more specific uses.
- *
- * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
- * @author <a href="mailto:manik at jboss.org">Manik Surtani</a>
- */
-public class CacheException extends RuntimeException
-{
-
- private static final long serialVersionUID = -4386393072593859164L;
-
- public CacheException()
- {
- super();
- }
-
- public CacheException(Throwable cause)
- {
- super(cause);
- }
-
- public CacheException(String msg)
- {
- super(msg);
- }
-
- public CacheException(String msg, Throwable cause)
- {
- super(msg, cause);
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,8 +22,8 @@
package org.jboss.cache;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
import java.io.InputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache;
-import org.jboss.cache.config.Configuration;
import org.jgroups.ChannelFactory;
import java.util.Set;
Modified: core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/CacheManagerImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,9 +21,9 @@
*/
package org.jboss.cache;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationRegistry;
-import org.jboss.cache.config.XmlParsingConfigurationRegistry;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationRegistry;
+import org.jboss.starobrno.config.XmlParsingConfigurationRegistry;
import org.jgroups.ChannelFactory;
import java.util.HashMap;
Modified: core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/batch/BatchContainer.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.batch;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.factories.annotations.Inject;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,28 +1,28 @@
-/*
- * 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.buddyreplication;
-import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
+import org.jboss.starobrno.CacheException;
import org.jgroups.Address;
import java.util.ArrayList;
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyLocator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyLocator.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyLocator.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.buddyreplication;
-import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
+import org.jboss.starobrno.config.BuddyReplicationConfig;
+import org.jboss.starobrno.config.BuddyReplicationConfig.BuddyLocatorConfig;
import org.jgroups.Address;
import java.util.List;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
@@ -40,13 +39,6 @@
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.config.BuddyReplicationConfig;
-import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.io.ExposedByteArrayOutputStream;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.notifications.Notifier;
@@ -56,6 +48,14 @@
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.BuddyReplicationConfig;
+import org.jboss.starobrno.config.BuddyReplicationConfig.BuddyLocatorConfig;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import org.jboss.util.stream.MarshalledValueInputStream;
import org.jboss.util.stream.MarshalledValueOutputStream;
import org.jgroups.Address;
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyNotInitException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyNotInitException.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/BuddyNotInitException.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.buddyreplication;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
/**
* Exception to depict that a buddy has not been initialised to participate in any comms
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/Fqn2BuddyFqnVisitor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.buddyreplication;
import org.jboss.cache.Fqn;
@@ -26,7 +26,6 @@
import org.jboss.cache.commands.AbstractVisitor;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -35,7 +34,6 @@
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -210,19 +208,6 @@
return factory.buildRollbackCommand(null);
}
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- List<WriteCommand> transformed = transformBatch(command.getModifications());
- return factory.buildOptimisticPrepareCommand(command.getGlobalTransaction(), transformed, command.getLocalAddress(), command.isOnePhaseCommit());
- }
-
- @Override
- public Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command) throws Throwable
- {
- return factory.buildCreateNodeCommand(getBackupFqn(command.getFqn()));
- }
-
public List<WriteCommand> transformBatch(List<WriteCommand> toTransform) throws Throwable
{
List<WriteCommand> transformedCommands = new ArrayList<WriteCommand>(toTransform.size());
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,7 +24,7 @@
import net.jcip.annotations.ThreadSafe;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
+import org.jboss.starobrno.config.BuddyReplicationConfig.BuddyLocatorConfig;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
Modified: core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocatorConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocatorConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/buddyreplication/NextMemberBuddyLocatorConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,9 +21,9 @@
*/
package org.jboss.cache.buddyreplication;
-import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
-import org.jboss.cache.config.Dynamic;
+import org.jboss.starobrno.config.BuddyReplicationConfig;
+import org.jboss.starobrno.config.BuddyReplicationConfig.BuddyLocatorConfig;
+import org.jboss.starobrno.config.Dynamic;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/cluster/ReplicationQueue.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -27,10 +27,10 @@
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import java.util.ArrayList;
import java.util.LinkedList;
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/AbstractVisitor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/AbstractVisitor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,28 +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.commands;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -31,7 +30,6 @@
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -150,16 +148,6 @@
return handleDefault(ctx, command);
}
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- return handleDefault(ctx, command);
- }
-
- public Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command) throws Throwable
- {
- return handleDefault(ctx, command);
- }
-
/**
* A default handler for all commands visited. This is called for any visit method called, unless a visit command is
* appropriately overridden.
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.buddyreplication.BuddyGroup;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -38,7 +37,6 @@
import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -119,8 +117,6 @@
RollbackCommand buildRollbackCommand(GlobalTransaction gtx);
- OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, List<WriteCommand> modifications, Address address, boolean onePhaseCommit);
-
AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address, String buddyPoolName);
RemoveFromBuddyGroupCommand buildRemoveFromBuddyGroupCommand(String groupName);
@@ -129,8 +125,6 @@
ClusteredGetCommand buildClusteredGetCommand(Boolean searchBackupSubtrees, DataCommand dataCommand);
- CreateNodeCommand buildCreateNodeCommand(Fqn fqn);
-
/**
* Builds a cache command based on the ID passed in and an object array of parameters
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/CommandsFactoryImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,27 +1,26 @@
-/*
- * 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.commands;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
@@ -29,7 +28,6 @@
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyGroup;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -44,7 +42,6 @@
import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -56,12 +53,13 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
import org.jgroups.Address;
import javax.transaction.TransactionManager;
@@ -227,11 +225,6 @@
return new RollbackCommand(gtx);
}
- public OptimisticPrepareCommand buildOptimisticPrepareCommand(GlobalTransaction gtx, List<WriteCommand> modifications, Address address, boolean onePhaseCommit)
- {
- return new OptimisticPrepareCommand(gtx, modifications, address, onePhaseCommit);
- }
-
public AnnounceBuddyPoolNameCommand buildAnnounceBuddyPoolNameCommand(Address address, String buddyPoolName)
{
AnnounceBuddyPoolNameCommand command = new AnnounceBuddyPoolNameCommand(address, buddyPoolName);
@@ -288,11 +281,6 @@
return cmd;
}
- public CreateNodeCommand buildCreateNodeCommand(Fqn fqn)
- {
- throw new UnsupportedOperationException("Not supported in MVCC!");
- }
-
public ReplicableCommand fromStream(int id, Object[] parameters)
{
ReplicableCommand command;
@@ -398,10 +386,6 @@
command = returnValue;
break;
}
- case CreateNodeCommand.METHOD_ID:
- {
- throw new UnsupportedOperationException("CreateNodeCommand is not supported in MVCC!");
- }
// --- transactional method calls
case PrepareCommand.METHOD_ID:
@@ -410,12 +394,6 @@
break;
}
- case OptimisticPrepareCommand.METHOD_ID:
- {
- command = new OptimisticPrepareCommand();
- break;
- }
-
case CommitCommand.METHOD_ID:
{
command = new CommitCommand();
Deleted: core/branches/flat/src/main/java/org/jboss/cache/commands/OptimisticCommandsFactoryImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/OptimisticCommandsFactoryImpl.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/OptimisticCommandsFactoryImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,115 +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.commands;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.legacy.read.LegacyGravitateDataCommand;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
-import org.jboss.cache.commands.legacy.write.LegacyEvictCommand;
-import org.jboss.cache.commands.legacy.write.VersionedInvalidateCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
-
-/**
- * Extends the default commands factory impl for optimistic locking.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed with opt locking
- */
- at Deprecated
- at SuppressWarnings("deprecation")
-public class OptimisticCommandsFactoryImpl extends CommandsFactoryImpl
-{
- @Override
- public EvictCommand buildEvictFqnCommand(Fqn fqn)
- {
- EvictCommand command = new LegacyEvictCommand(fqn);
- command.initialize(notifier, dataContainer);
- return command;
- }
-
- @Override
- public InvalidateCommand buildInvalidateCommand(Fqn fqn)
- {
- VersionedInvalidateCommand command = new VersionedInvalidateCommand(fqn);
- command.initialize(txManager);
- command.initialize(cacheSpi, dataContainer, notifier);
- return command;
- }
-
- @Override
- public GravitateDataCommand buildGravitateDataCommand(Fqn fqn, Boolean searchSubtrees)
- {
- LegacyGravitateDataCommand command = new LegacyGravitateDataCommand(fqn, searchSubtrees, rpcManager.getLocalAddress());
- command.initialize(dataContainer, cacheSpi, buddyFqnTransformer);
- return command;
- }
-
- @Override
- public CreateNodeCommand buildCreateNodeCommand(Fqn fqn)
- {
- CreateNodeCommand command = new CreateNodeCommand(fqn);
- command.initialize(dataContainer);
- return command;
- }
-
-
- @Override
- public ReplicableCommand fromStream(int id, Object[] parameters)
- {
- ReplicableCommand command;
- boolean skipSetParams = false;
- switch (id)
- {
- case CreateNodeCommand.METHOD_ID:
- {
- CreateNodeCommand returnValue = new CreateNodeCommand(null);
- returnValue.initialize(dataContainer);
- command = returnValue;
- break;
- }
- case GravitateDataCommand.METHOD_ID:
- {
- LegacyGravitateDataCommand returnValue = new LegacyGravitateDataCommand(rpcManager.getLocalAddress());
- returnValue.initialize(dataContainer, cacheSpi, buddyFqnTransformer);
- command = returnValue;
- break;
- }
- case InvalidateCommand.METHOD_ID:
- {
- VersionedInvalidateCommand returnValue = new VersionedInvalidateCommand(null);
- returnValue.initialize(cacheSpi, dataContainer, notifier);
- command = returnValue;
- break;
- }
- default:
- // pass up to superclass
- command = super.fromStream(id, parameters);
- skipSetParams = true;
- }
-
- if (!skipSetParams) command.setParameters(id, parameters);
- return command;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/commands/PessimisticCommandsFactoryImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/PessimisticCommandsFactoryImpl.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/PessimisticCommandsFactoryImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,219 +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.commands;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.commands.legacy.read.PessGetChildrenNamesCommand;
-import org.jboss.cache.commands.legacy.write.PessClearDataCommand;
-import org.jboss.cache.commands.legacy.write.PessMoveCommand;
-import org.jboss.cache.commands.legacy.write.PessPutDataMapCommand;
-import org.jboss.cache.commands.legacy.write.PessPutForExternalReadCommand;
-import org.jboss.cache.commands.legacy.write.PessPutKeyValueCommand;
-import org.jboss.cache.commands.legacy.write.PessRemoveKeyCommand;
-import org.jboss.cache.commands.legacy.write.PessRemoveNodeCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
-
-import java.util.Map;
-
-/**
- * This specific implementation of {@link CommandsFactory} specifically creates
- * pessimistic commands where appropriate, with the ability to roll back.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @see org.jboss.cache.commands.legacy.ReversibleCommand
- * @since 3.0
- * @deprecated will be removed with possimistic locking
- */
- at Deprecated
- at SuppressWarnings("deprecation")
-public class PessimisticCommandsFactoryImpl extends OptimisticCommandsFactoryImpl
-{
- @Override
- public GetChildrenNamesCommand buildGetChildrenNamesCommand(Fqn fqn)
- {
- GetChildrenNamesCommand command = new PessGetChildrenNamesCommand(fqn);
- command.initialize(dataContainer);
- return command;
- }
-
- @Override
- public PutDataMapCommand buildPutDataMapCommand(GlobalTransaction gtx, Fqn fqn, Map data)
- {
- PutDataMapCommand cmd = new PessPutDataMapCommand(gtx, fqn, data);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public PutKeyValueCommand buildPutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value)
- {
- PutKeyValueCommand cmd = new PessPutKeyValueCommand(gtx, fqn, key, value);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public PutForExternalReadCommand buildPutForExternalReadCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value)
- {
- PutForExternalReadCommand cmd = new PessPutForExternalReadCommand(gtx, fqn, key, value);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public RemoveNodeCommand buildRemoveNodeCommand(GlobalTransaction gtx, Fqn fqn)
- {
- RemoveNodeCommand cmd = new PessRemoveNodeCommand(gtx, fqn);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public ClearDataCommand buildClearDataCommand(GlobalTransaction gtx, Fqn fqn)
- {
- ClearDataCommand cmd = new PessClearDataCommand(gtx, fqn);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public RemoveKeyCommand buildRemoveKeyCommand(GlobalTransaction tx, Fqn fqn, Object key)
- {
- RemoveKeyCommand cmd = new PessRemoveKeyCommand(tx, fqn, key);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public MoveCommand buildMoveCommand(Fqn from, Fqn to)
- {
- MoveCommand cmd = new PessMoveCommand(from, to);
- cmd.initialize(notifier, dataContainer);
- return cmd;
- }
-
- @Override
- public InvalidateCommand buildInvalidateCommand(Fqn fqn)
- {
- InvalidateCommand command = new InvalidateCommand(fqn);
- command.initialize(cacheSpi, dataContainer, notifier);
- return command;
- }
-
- @Override
- public ReplicableCommand fromStream(int id, Object[] parameters)
- {
- ReplicableCommand command;
- boolean skipSetParams = false;
- switch (id)
- {
- case GetChildrenNamesCommand.METHOD_ID:
- {
- GetChildrenNamesCommand returnValue = new PessGetChildrenNamesCommand();
- returnValue.initialize(dataContainer);
- command = returnValue;
- break;
- }
- case MoveCommand.METHOD_ID:
- {
- MoveCommand returnValue = new PessMoveCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
- case PutDataMapCommand.METHOD_ID:
- case PutDataMapCommand.ERASE_METHOD_ID:
- case PutDataMapCommand.ERASE_VERSIONED_METHOD_ID:
- case PutDataMapCommand.VERSIONED_METHOD_ID:
- {
- PutDataMapCommand returnValue = new PessPutDataMapCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
- case PutKeyValueCommand.METHOD_ID:
- case PutKeyValueCommand.VERSIONED_METHOD_ID:
- {
- PutKeyValueCommand returnValue = new PessPutKeyValueCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
- case PutForExternalReadCommand.METHOD_ID:
- case PutForExternalReadCommand.VERSIONED_METHOD_ID:
- {
- PutForExternalReadCommand returnValue = new PessPutForExternalReadCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
- case ClearDataCommand.METHOD_ID:
- case ClearDataCommand.VERSIONED_METHOD_ID:
- {
- ClearDataCommand returnValue = new PessClearDataCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
- case RemoveKeyCommand.METHOD_ID:
- case RemoveKeyCommand.VERSIONED_METHOD_ID:
- {
- RemoveKeyCommand returnValue = new PessRemoveKeyCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
-
- case RemoveNodeCommand.METHOD_ID:
- case RemoveNodeCommand.VERSIONED_METHOD_ID:
- {
- RemoveNodeCommand returnValue = new PessRemoveNodeCommand();
- returnValue.initialize(notifier, dataContainer);
- command = returnValue;
- break;
- }
- case InvalidateCommand.METHOD_ID:
- {
- InvalidateCommand returnValue = new InvalidateCommand(null);
- returnValue.initialize(cacheSpi, dataContainer, notifier);
- command = returnValue;
- break;
- }
- default:
- // pass up to superclass
- command = super.fromStream(id, parameters);
- skipSetParams = true;
- }
-
- if (!skipSetParams) command.setParameters(id, parameters);
- return command;
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/VersionedDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/VersionedDataCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/VersionedDataCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,28 +1,26 @@
-/*
- * 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.commands;
-import org.jboss.cache.optimistic.DataVersion;
-
/**
* Just like a {@link org.jboss.cache.commands.DataCommand}, except that these are versioned and reversible too. Versioning
* is currently used by optimistic locking, and in future will be used by MVCC as well.
@@ -36,14 +34,13 @@
/**
* @return the DataVersion pertaining to this command.
*/
- DataVersion getDataVersion();
+// DataVersion getDataVersion();
/**
* Sets the DataVersion pertaining to this command.
*
* @param dataVersion to set
*/
- void setDataVersion(DataVersion dataVersion);
/**
* Has data version set? (i.e. not null)
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/Visitor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/Visitor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/Visitor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,28 +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.commands;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -31,7 +30,6 @@
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -245,26 +243,4 @@
*/
Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable;
- /**
- * Visits a OptimisticPrepareCommand.
- *
- * @param ctx invocation context
- * @param command command to visit
- * @return response from the visit
- * @throws Throwable in the event of problems.
- */
- Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable;
-
-
- /**
- * Visits a CreateNodeCommand.
- *
- * @param ctx invocation context
- * @param command command to visit
- * @return response from the visit
- * @throws Throwable in the event of problems.
- * @deprecated in 3.0. Will be removed once optimistic and pessimistic locking is removed.
- */
- @Deprecated
- Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command) throws Throwable;
}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,107 +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.commands.tx;
-
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jgroups.Address;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * An optimistic version of {@link PrepareCommand}.
- *
- * @author Mircea.Markus at jboss.com
- * @since 2.2
- */
-public class OptimisticPrepareCommand extends PrepareCommand
-{
- public static final int METHOD_ID = 18;
-
- public OptimisticPrepareCommand(GlobalTransaction gtx, List<WriteCommand> modifications, Address address, boolean onePhaseCommit)
- {
- super(gtx, modifications, address, onePhaseCommit);
- }
-
- public OptimisticPrepareCommand()
- {
- }
-
- @Override
- public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
- {
- return visitor.visitOptimisticPrepareCommand(ctx, this);
- }
-
- @Override
- public int getCommandId()
- {
- return METHOD_ID;
- }
-
- @Override
- public Object[] getParameters()
- {
- // the null is needed for wire-level compat with pre-command versions
- return new Object[]{globalTransaction, modifications, null, localAddress, onePhaseCommit};
- }
-
- /**
- * A shallow copy of all fields except collections.
- *
- * @return a copy of this command
- */
- @Override
- public OptimisticPrepareCommand copy()
- {
- OptimisticPrepareCommand copy = new OptimisticPrepareCommand();
- copy.globalTransaction = globalTransaction;
- copy.localAddress = localAddress;
- copy.modifications = modifications == null ? null : new ArrayList<WriteCommand>(modifications);
- copy.onePhaseCommit = onePhaseCommit;
- return copy;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void setParameters(int commandId, Object[] args)
- {
- globalTransaction = (GlobalTransaction) args[0];
- modifications = (List<WriteCommand>) args[1];
- //args[2] is probably null.
- localAddress = (Address) args[3];
- onePhaseCommit = (Boolean) args[4];
- }
-
- @Override
- public String toString()
- {
- return "OptimisticPrepareCommand{" +
- "modifications=" + modifications +
- ", localAddress=" + localAddress +
- ", onePhaseCommit=" + onePhaseCommit +
- '}';
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -28,8 +28,6 @@
import org.jboss.cache.commands.VersionedDataCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DataVersioningException;
import org.jboss.cache.transaction.GlobalTransaction;
/**
@@ -42,7 +40,7 @@
{
protected Notifier notifier;
- protected DataVersion dataVersion;
+ // protected DataVersion dataVersion;
protected GlobalTransaction globalTransaction;
public void initialize(Notifier notifier, DataContainer dataContainer)
@@ -51,16 +49,6 @@
this.dataContainer = dataContainer;
}
- public DataVersion getDataVersion()
- {
- return dataVersion;
- }
-
- public void setDataVersion(DataVersion dataVersion)
- {
- this.dataVersion = dataVersion;
- }
-
public GlobalTransaction getGlobalTransaction()
{
return globalTransaction;
@@ -73,17 +61,14 @@
public boolean isVersioned()
{
- return dataVersion != null;
+ return false;
}
// basic implementations
@Override
public Object[] getParameters()
{
- if (isVersioned())
- return new Object[]{fqn, dataVersion};
- else
- return new Object[]{fqn};
+ return new Object[]{fqn};
}
// basic implementations
@@ -91,7 +76,6 @@
public void setParameters(int commandId, Object[] args)
{
fqn = (Fqn) args[0];
- if (isVersionedId(commandId)) dataVersion = (DataVersion) args[1];
}
protected abstract boolean isVersionedId(int id);
@@ -107,7 +91,7 @@
@Override
public int hashCode()
{
- return 31 * super.hashCode() + (dataVersion != null ? dataVersion.hashCode() : 0);
+ return 31 * super.hashCode();
}
/**
@@ -120,12 +104,6 @@
*/
protected NodeSPI peekVersioned(InvocationContext ctx)
{
- NodeSPI n = ctx.lookUpNode(fqn);
- if (n != null && isVersioned() && n.getVersion().newerThan(dataVersion))
- {
- String errMsg = new StringBuilder("Node found, but version is not equal to or less than the expected [").append(dataVersion).append("]. Is [").append(n.getVersion()).append("] instead!").toString();
- throw new DataVersioningException(errMsg);
- }
- return n;
+ throw new UnsupportedOperationException();
}
}
\ No newline at end of file
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.commands.write;
import org.apache.commons.logging.Log;
@@ -28,7 +28,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -94,10 +93,7 @@
@Override
public Object[] getParameters()
{
- if (isVersioned())
- return new Object[]{globalTransaction, fqn, true, dataVersion};
- else
- return new Object[]{globalTransaction, fqn, true};
+ return new Object[]{globalTransaction, fqn, true};
}
@Override
@@ -105,7 +101,6 @@
{
globalTransaction = (GlobalTransaction) args[0];
fqn = (Fqn) args[1];
- if (isVersionedId(commandId)) dataVersion = (DataVersion) args[3];
}
@Override
@@ -137,7 +132,6 @@
{
return "RemoveDataCommand{" +
"fqn=" + fqn +
- ", dataVersion=" + dataVersion +
", globalTransaction=" + globalTransaction +
'}';
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutDataMapCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.commands.write;
import org.apache.commons.logging.Log;
@@ -29,7 +29,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Collections;
@@ -122,10 +121,7 @@
@Override
public Object[] getParameters()
{
- if (isVersioned())
- return new Object[]{globalTransaction, fqn, data, false, dataVersion};
- else
- return new Object[]{globalTransaction, fqn, data, false};
+ return new Object[]{globalTransaction, fqn, data, false};
}
@Override
@@ -134,7 +130,6 @@
globalTransaction = (GlobalTransaction) args[0];
fqn = (Fqn) args[1];
data = (Map) args[2];
- if (isVersionedId(commandId)) dataVersion = (DataVersion) args[4];
}
@Override
@@ -171,7 +166,6 @@
{
return "PutDataMapCommand{" +
"fqn=" + fqn +
- ", dataVersion=" + dataVersion +
", data=" + data +
", globalTransaction=" + globalTransaction +
'}';
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.commands.write;
import org.apache.commons.logging.Log;
@@ -29,7 +29,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Collections;
@@ -135,10 +134,7 @@
@Override
public Object[] getParameters()
{
- if (isVersioned())
- return new Object[]{globalTransaction, fqn, key, value, false, dataVersion};
- else
- return new Object[]{globalTransaction, fqn, key, value, false};
+ return new Object[]{globalTransaction, fqn, key, value, false};
}
@Override
@@ -148,7 +144,6 @@
fqn = (Fqn) args[1];
key = args[2];
value = args[3];
- if (isVersionedId(commandId)) dataVersion = (DataVersion) args[5];
}
@Override
@@ -189,7 +184,6 @@
{
return getClass().getSimpleName() + "{" +
"fqn=" + fqn +
- ", dataVersion=" + dataVersion +
", globalTransaction=" + globalTransaction +
", key=" + key +
", value=" + value +
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveKeyCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.commands.write;
import org.apache.commons.logging.Log;
@@ -28,7 +28,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Collections;
@@ -114,10 +113,7 @@
@Override
public Object[] getParameters()
{
- if (isVersioned())
- return new Object[]{globalTransaction, fqn, key, true, dataVersion};
- else
- return new Object[]{globalTransaction, fqn, key, true};
+ return new Object[]{globalTransaction, fqn, key, true};
}
@Override
@@ -126,7 +122,6 @@
globalTransaction = (GlobalTransaction) args[0];
fqn = (Fqn) args[1];
key = args[2];
- if (isVersionedId(commandId)) dataVersion = (DataVersion) args[4];
}
@Override
@@ -165,7 +160,6 @@
{
return "RemoveKeyCommand{" +
"fqn=" + fqn +
- ", dataVersion=" + dataVersion +
", globalTransaction=" + globalTransaction +
", key=" + key +
'}';
Modified: core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.commands.write;
import org.apache.commons.logging.Log;
@@ -27,7 +27,6 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -138,10 +137,7 @@
@Override
public Object[] getParameters()
{
- if (isVersioned())
- return new Object[]{globalTransaction, fqn, true, skipSendingNodeEvents, dataVersion};
- else
- return new Object[]{globalTransaction, fqn, true, skipSendingNodeEvents};
+ return new Object[]{globalTransaction, fqn, true, skipSendingNodeEvents};
}
@Override
@@ -150,7 +146,6 @@
globalTransaction = (GlobalTransaction) args[0];
fqn = (Fqn) args[1];
skipSendingNodeEvents = (Boolean) args[3];
- if (isVersionedId(commandId)) dataVersion = (DataVersion) args[4];
}
@Override
@@ -194,7 +189,6 @@
{
return "RemoveNodeCommand{" +
"fqn=" + fqn +
- ", dataVersion=" + dataVersion +
", globalTransaction=" + globalTransaction +
", skipSendingNodeEvents=" + skipSendingNodeEvents +
", parentFqn=" + parentFqn +
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/BootstrapFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/BootstrapFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/BootstrapFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,11 +21,11 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
-import org.jboss.cache.factories.annotations.NonVolatile;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
/**
* Factory for setting up bootstrap components
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/BuddyManagerFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/BuddyManagerFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/BuddyManagerFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,8 +22,8 @@
package org.jboss.cache.factories;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Buddy manager factory
Deleted: core/branches/flat/src/main/java/org/jboss/cache/factories/CacheConfigsXmlParser.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/CacheConfigsXmlParser.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/CacheConfigsXmlParser.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,35 +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.factories;
-
-import org.jboss.cache.annotations.Compat;
-
-/**
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated here for compatibility reasons. Use the class with the same name in the <tt>org.jboss.cache.config.parsing</tt> package.
- */
- at Compat
- at Deprecated
-public class CacheConfigsXmlParser extends org.jboss.cache.config.parsing.CacheConfigsXmlParser
-{
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/CommandsMetaFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/CommandsMetaFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/CommandsMetaFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,10 +23,7 @@
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.CommandsFactoryImpl;
-import org.jboss.cache.commands.OptimisticCommandsFactoryImpl;
-import org.jboss.cache.commands.PessimisticCommandsFactoryImpl;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* COnstructs commands factory
@@ -40,15 +37,6 @@
@SuppressWarnings("deprecation")
protected <T> T construct(Class<T> componentType)
{
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(new CommandsFactoryImpl());
- case OPTIMISTIC:
- return componentType.cast(new OptimisticCommandsFactoryImpl());
- case PESSIMISTIC:
- return componentType.cast(new PessimisticCommandsFactoryImpl());
- }
- throw new ConfigurationException("Unknown locking scheme " + configuration.getNodeLockingScheme());
+ return componentType.cast(new CommandsFactoryImpl());
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,9 +23,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.factories.annotations.Inject;
/**
* Factory that creates components used internally within JBoss Cache, and also wires dependencies into the components.
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,21 +23,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Version;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.RuntimeConfig;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
-import org.jboss.cache.factories.annotations.Destroy;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.util.BeanUtils;
import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.RuntimeConfig;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.factories.annotations.Destroy;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import javax.management.MBeanServerFactory;
import java.lang.reflect.Method;
@@ -189,7 +189,7 @@
s.add(BootstrapFactory.class);
s.add(BuddyManagerFactory.class);
s.add(EmptyConstructorFactory.class);
- s.add(InterceptorChainFactory.class);
+// s.add(InterceptorChainFactory.class);
s.add(RuntimeConfigAwareFactory.class);
s.add(TransactionManagerFactory.class);
s.add(ReplicationQueueFactory.class);
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/ContextMetaFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/ContextMetaFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/ContextMetaFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,12 +21,9 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.factories.context.ContextFactory;
import org.jboss.cache.factories.context.MVCCContextFactory;
-import org.jboss.cache.factories.context.OptimisticContextFactory;
-import org.jboss.cache.factories.context.PessimisticContextFactory;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Responsible for creating the appropriate {@link org.jboss.cache.factories.context.ContextFactory} based on configuration used.
@@ -40,19 +37,6 @@
@SuppressWarnings("deprecation")
protected <T> T construct(Class<T> componentType)
{
- if (log.isTraceEnabled()) log.trace("Cache configuration is " + configuration.getNodeLockingScheme());
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- if (log.isTraceEnabled()) log.trace("Creating an MVCC context factory");
- return componentType.cast(new MVCCContextFactory());
- case OPTIMISTIC:
- if (log.isTraceEnabled()) log.trace("Creating an optimistic context factory");
- return componentType.cast(new OptimisticContextFactory());
- case PESSIMISTIC:
- if (log.isTraceEnabled()) log.trace("Creating a pessimistic context factory");
- return componentType.cast(new PessimisticContextFactory());
- }
- throw new ConfigurationException("Unknown configuration node locking scheme");
+ return componentType.cast(new MVCCContextFactory());
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/EmptyConstructorFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,8 +25,6 @@
import org.jboss.cache.RegionRegistry;
import org.jboss.cache.batch.BatchContainer;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.loader.CacheLoaderManager;
@@ -37,6 +35,8 @@
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.remoting.jgroups.ChannelMessageListener;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Simple factory that just uses reflection and an empty constructor of the component type.
Deleted: core/branches/flat/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,240 +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.factories;
-
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.CustomInterceptorConfig;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
-import org.jboss.cache.interceptors.*;
-import org.jboss.cache.interceptors.base.CommandInterceptor;
-
-import java.util.List;
-
-/**
- * Factory class that builds an interceptor chain based on cache configuration.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- */
- at DefaultFactoryFor(classes = InterceptorChain.class)
-public class InterceptorChainFactory extends ComponentFactory
-{
- /**
- * Note - this method used to return a singleton instance, and since 2.1.0 returns a new instance. The method is
- * deprecated and you should use the no-arg constructor to create a new instance of this factory.
- *
- * @return a NEW instance of this class.
- */
- @Deprecated
- public static InterceptorChainFactory getInstance()
- {
- return new InterceptorChainFactory();
- }
-
- private CommandInterceptor createInterceptor(Class<? extends CommandInterceptor> clazz) throws IllegalAccessException, InstantiationException
- {
- CommandInterceptor chainedInterceptor = componentRegistry.getComponent(clazz);
- if (chainedInterceptor == null)
- {
- chainedInterceptor = clazz.newInstance();
- componentRegistry.registerComponent(chainedInterceptor, clazz);
- }
- else
- {
- // wipe next/last chaining!!
- chainedInterceptor.setNext(null);
- }
- return chainedInterceptor;
- }
-
- public InterceptorChain buildInterceptorChain() throws IllegalAccessException, InstantiationException, ClassNotFoundException
- {
- boolean optimistic = configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC;
- boolean invocationBatching = configuration.isInvocationBatchingEnabled();
- // load the icInterceptor first
- CommandInterceptor first = invocationBatching ? createInterceptor(BatchingInterceptor.class) : createInterceptor(InvocationContextInterceptor.class);
- InterceptorChain interceptorChain = new InterceptorChain(first);
-
- // add the interceptor chain to the registry first, since some interceptors may ask for it.
- componentRegistry.registerComponent(interceptorChain, InterceptorChain.class);
-
- // NOW add the ICI if we are using batching!
- if (invocationBatching)
- interceptorChain.appendIntereceptor(createInterceptor(InvocationContextInterceptor.class));
-
- // load the cache management interceptor next
- if (configuration.getExposeManagementStatistics())
- interceptorChain.appendIntereceptor(createInterceptor(CacheMgmtInterceptor.class));
-
- // load the tx interceptor
- interceptorChain.appendIntereceptor(createInterceptor(optimistic ? OptimisticTxInterceptor.class : TxInterceptor.class));
-
- if (configuration.isUseLazyDeserialization())
- interceptorChain.appendIntereceptor(createInterceptor(MarshalledValueInterceptor.class));
- interceptorChain.appendIntereceptor(createInterceptor(NotificationInterceptor.class));
-
- switch (configuration.getCacheMode())
- {
- case REPL_SYNC:
- case REPL_ASYNC:
- interceptorChain.appendIntereceptor(optimistic ? createInterceptor(OptimisticReplicationInterceptor.class) : createInterceptor(ReplicationInterceptor.class));
- break;
- case INVALIDATION_SYNC:
- case INVALIDATION_ASYNC:
- interceptorChain.appendIntereceptor(createInterceptor(InvalidationInterceptor.class));
- break;
- case LOCAL:
- //Nothing...
- }
-
- if (configuration.getNodeLockingScheme() == NodeLockingScheme.MVCC)
- {
- // if MVCC, then the CLI or AI must come before the MVCCLI.
- if (configuration.isUsingCacheLoaders())
- {
- if (configuration.getCacheLoaderConfig().isPassivation())
- {
- interceptorChain.appendIntereceptor(createInterceptor(ActivationInterceptor.class));
- }
- else
- {
- interceptorChain.appendIntereceptor(createInterceptor(CacheLoaderInterceptor.class));
- }
- }
- interceptorChain.appendIntereceptor(createInterceptor(MVCCLockingInterceptor.class));
- }
- else if (configuration.getNodeLockingScheme() == NodeLockingScheme.PESSIMISTIC)
- {
- interceptorChain.appendIntereceptor(createInterceptor(PessimisticLockInterceptor.class));
- }
-
- if (configuration.isUsingCacheLoaders())
- {
- if (configuration.getCacheLoaderConfig().isPassivation())
- {
- if (configuration.getNodeLockingScheme() != NodeLockingScheme.MVCC)
- {
- interceptorChain.appendIntereceptor(createInterceptor(LegacyActivationInterceptor.class));
- interceptorChain.appendIntereceptor(createInterceptor(LegacyPassivationInterceptor.class));
- }
- else
- {
- interceptorChain.appendIntereceptor(createInterceptor(PassivationInterceptor.class));
- }
- }
- else
- {
- if (configuration.getNodeLockingScheme() != NodeLockingScheme.MVCC)
- {
- interceptorChain.appendIntereceptor(createInterceptor(LegacyCacheLoaderInterceptor.class));
- interceptorChain.appendIntereceptor(createInterceptor(LegacyCacheStoreInterceptor.class));
- }
- else
- {
- interceptorChain.appendIntereceptor(createInterceptor(CacheStoreInterceptor.class));
- }
- }
- }
-
- if (configuration.isUsingBuddyReplication())
- {
- if (configuration.getNodeLockingScheme() == NodeLockingScheme.MVCC)
- interceptorChain.appendIntereceptor(createInterceptor(DataGravitatorInterceptor.class));
- else
- interceptorChain.appendIntereceptor(createInterceptor(LegacyDataGravitatorInterceptor.class));
- }
-
-
- if (optimistic)
- {
- interceptorChain.appendIntereceptor(createInterceptor(OptimisticLockingInterceptor.class));
- interceptorChain.appendIntereceptor(createInterceptor(OptimisticValidatorInterceptor.class));
- interceptorChain.appendIntereceptor(createInterceptor(OptimisticCreateIfNotExistsInterceptor.class));
- }
- // eviction interceptor to come before the optimistic node interceptor
- if (configuration.getEvictionConfig() != null && configuration.getEvictionConfig().isValidConfig())
- interceptorChain.appendIntereceptor(createInterceptor(configuration.isUsingBuddyReplication() ? BuddyRegionAwareEvictionInterceptor.class : EvictionInterceptor.class));
-
- if (optimistic) interceptorChain.appendIntereceptor(createInterceptor(OptimisticNodeInterceptor.class));
- CommandInterceptor callInterceptor = createInterceptor(CallInterceptor.class);
- interceptorChain.appendIntereceptor(callInterceptor);
- if (log.isTraceEnabled()) log.trace("Finished building default interceptor chain.");
- buildCustomInterceptors(interceptorChain, configuration.getCustomInterceptors());
- return interceptorChain;
- }
-
- private void buildCustomInterceptors(InterceptorChain interceptorChain, List<CustomInterceptorConfig> customInterceptors)
- {
- for (CustomInterceptorConfig config : customInterceptors)
- {
- if (interceptorChain.containsInstance(config.getInterceptor())) continue;
- if (config.isFirst())
- {
- interceptorChain.addInterceptor(config.getInterceptor(), 0);
- }
- if (config.isLast()) interceptorChain.appendIntereceptor(config.getInterceptor());
- if (config.getIndex() >= 0) interceptorChain.addInterceptor(config.getInterceptor(), config.getIndex());
- if (config.getAfterClass() != null)
- {
- List<CommandInterceptor> withClassName = interceptorChain.getInterceptorsWithClassName(config.getAfterClass());
- if (withClassName.isEmpty())
- {
- throw new ConfigurationException("Cannot add after class: " + config.getAfterClass()
- + " as no such iterceptor exists in the default chain");
- }
- interceptorChain.addAfterInterceptor(config.getInterceptor(), withClassName.get(0).getClass());
- }
- if (config.getBeforeClass() != null)
- {
- List<CommandInterceptor> withClassName = interceptorChain.getInterceptorsWithClassName(config.getBeforeClass());
- if (withClassName.isEmpty())
- {
- throw new ConfigurationException("Cannot add before class: " + config.getAfterClass()
- + " as no such iterceptor exists in the default chain");
- }
- interceptorChain.addBeforeInterceptor(config.getInterceptor(), withClassName.get(0).getClass());
- }
- }
- }
-
- @Override
- protected <T> T construct(Class<T> componentType)
- {
- try
- {
- return componentType.cast(buildInterceptorChain());
- }
- catch (Exception e)
- {
- throw new ConfigurationException("Unable to build interceptor chain", e);
- }
- }
-
- public static InterceptorChainFactory getInstance(ComponentRegistry componentRegistry, Configuration configuration)
- {
- InterceptorChainFactory icf = new InterceptorChainFactory();
- icf.componentRegistry = componentRegistry;
- icf.configuration = configuration;
- return icf;
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/LockManagerFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/LockManagerFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/LockManagerFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,11 +21,9 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.lock.MVCCLockManager;
-import org.jboss.cache.lock.NodeBasedLockManager;
-import org.jboss.cache.lock.PessimisticNodeBasedLockManager;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Creates lock managers
@@ -40,16 +38,6 @@
@SuppressWarnings("deprecation")
protected <T> T construct(Class<T> componentType)
{
- if (log.isTraceEnabled()) log.trace("Cache configuration is " + configuration.getNodeLockingScheme());
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(super.construct(MVCCLockManager.class));
- case OPTIMISTIC:
- return componentType.cast(super.construct(NodeBasedLockManager.class));
- case PESSIMISTIC:
- default:
- return componentType.cast(super.construct(PessimisticNodeBasedLockManager.class));
- }
+ return componentType.cast(super.construct(MVCCLockManager.class));
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/NodeMetaFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/NodeMetaFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/NodeMetaFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,11 +22,8 @@
package org.jboss.cache.factories;
import org.jboss.cache.NodeFactory;
-import org.jboss.cache.PessimisticNodeFactory;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.mvcc.MVCCNodeFactory;
-import org.jboss.cache.optimistic.OptimisticNodeFactory;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Creates node factories.
@@ -40,16 +37,6 @@
@SuppressWarnings("deprecation")
protected <T> T construct(Class<T> componentType)
{
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(new MVCCNodeFactory());
- case OPTIMISTIC:
- return componentType.cast(new OptimisticNodeFactory());
- case PESSIMISTIC:
- return componentType.cast(new PessimisticNodeFactory());
- default:
- throw new ConfigurationException("Unknown locking scheme " + configuration.getNodeLockingScheme());
- }
+ return componentType.cast(new MVCCNodeFactory());
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/RegionManagerFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/RegionManagerFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/RegionManagerFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,10 +21,9 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.LegacyRegionManagerImpl;
import org.jboss.cache.RegionManager;
import org.jboss.cache.RegionManagerImpl;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Creates region managers
@@ -38,12 +37,6 @@
@SuppressWarnings("deprecation")
protected <T> T construct(Class<T> componentType)
{
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(new RegionManagerImpl());
- default:
- return componentType.cast(new LegacyRegionManagerImpl());
- }
+ return componentType.cast(new RegionManagerImpl());
}
}
\ No newline at end of file
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/ReplicationQueueFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/ReplicationQueueFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/ReplicationQueueFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,8 +22,8 @@
package org.jboss.cache.factories;
import org.jboss.cache.cluster.ReplicationQueue;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* RPCManager factory
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/RuntimeConfigAwareFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/RuntimeConfigAwareFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/RuntimeConfigAwareFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,10 +22,10 @@
package org.jboss.cache.factories;
import org.jboss.cache.RPCManager;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.RuntimeConfig;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.util.BeanUtils;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.RuntimeConfig;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
import java.lang.reflect.Method;
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,13 +21,11 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.statetransfer.DefaultStateTransferGenerator;
import org.jboss.cache.statetransfer.DefaultStateTransferIntegrator;
-import org.jboss.cache.statetransfer.LegacyStateTransferGenerator;
-import org.jboss.cache.statetransfer.LegacyStateTransferIntegrator;
import org.jboss.cache.statetransfer.StateTransferGenerator;
import org.jboss.cache.statetransfer.StateTransferIntegrator;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Factory class able to create {@link org.jboss.cache.statetransfer.StateTransferGenerator} and
@@ -48,23 +46,11 @@
{
if (componentType.equals(StateTransferIntegrator.class))
{
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(new DefaultStateTransferIntegrator());
- default:
- return componentType.cast(new LegacyStateTransferIntegrator());
- }
+ return componentType.cast(new DefaultStateTransferIntegrator());
}
else
{
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(new DefaultStateTransferGenerator());
- default:
- return componentType.cast(new LegacyStateTransferGenerator());
- }
+ return componentType.cast(new DefaultStateTransferGenerator());
}
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferManagerFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferManagerFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/StateTransferManagerFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,10 +21,9 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.statetransfer.DefaultStateTransferManager;
-import org.jboss.cache.statetransfer.LegacyStateTransferManager;
import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
/**
* Constructs {@link org.jboss.cache.statetransfer.StateTransferManager} instances.
@@ -38,12 +37,6 @@
@SuppressWarnings("deprecation")
protected <T> T construct(Class<T> componentType)
{
- switch (configuration.getNodeLockingScheme())
- {
- case MVCC:
- return componentType.cast(new DefaultStateTransferManager());
- default:
- return componentType.cast(new LegacyStateTransferManager());
- }
+ return componentType.cast(new DefaultStateTransferManager());
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/TransactionManagerFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,10 +21,10 @@
*/
package org.jboss.cache.factories;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.factories.annotations.DefaultFactoryFor;
import org.jboss.cache.transaction.BatchModeTransactionManager;
import org.jboss.cache.transaction.TransactionManagerLookup;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.factories.annotations.DefaultFactoryFor;
import javax.transaction.TransactionManager;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/context/OptimisticContextFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,47 +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.factories.context;
-
-import org.jboss.cache.transaction.OptimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionContext;
-
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-
-/**
- * Constructs contexts for optimistic locking
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed when optimistic locking is removed.
- */
- at Deprecated
- at SuppressWarnings("deprecation")
-public class OptimisticContextFactory extends PessimisticContextFactory
-{
- @Override
- public TransactionContext createTransactionContext(Transaction tx) throws SystemException, RollbackException
- {
- return new OptimisticTransactionContext(tx);
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/factories/context/PessimisticContextFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,63 +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.factories.context;
-
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.LegacyInvocationContext;
-import org.jboss.cache.transaction.PessimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionContext;
-
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-
-/**
- * Constructs contexts for pessimistic locking
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed when pessimistic locking is removed.
- */
- at Deprecated
- at SuppressWarnings("deprecation")
-public class PessimisticContextFactory implements ContextFactory
-{
- DataContainer container;
-
- @Inject
- public void inject(DataContainer container)
- {
- this.container = container;
- }
-
- public InvocationContext createInvocationContext()
- {
- return new LegacyInvocationContext(container);
- }
-
- public TransactionContext createTransactionContext(Transaction tx) throws SystemException, RollbackException
- {
- return new PessimisticTransactionContext(tx);
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -30,7 +30,6 @@
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.read.GetKeysCommand;
import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
import org.jboss.cache.commands.write.MoveCommand;
@@ -39,12 +38,12 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
@@ -246,17 +245,6 @@
}
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- Object retval = invokeNextInterceptor(ctx, command);
- if (inTransaction())
- {
- prepareCacheLoader(ctx);
- }
- return retval;
- }
-
private boolean inTransaction() throws SystemException
{
return txMgr != null && txMgr.getTransaction() != null;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -28,13 +28,13 @@
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import org.jgroups.Address;
import javax.transaction.Transaction;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BaseTransactionalContextInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,12 +22,12 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
import javax.transaction.Status;
import javax.transaction.SystemException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BatchingInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,8 +24,8 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.batch.BatchContainer;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.CommandInterceptor;
+import org.jboss.starobrno.factories.annotations.Inject;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/BuddyRegionAwareEvictionInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/BuddyRegionAwareEvictionInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/BuddyRegionAwareEvictionInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,7 +24,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Inject;
/**
* A subclass of EvictionInterceptor that is aware of and able to deal with buddy regions.
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.CacheException;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -40,11 +39,6 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
-import static org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.JmxStatsCommandInterceptor;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
@@ -54,6 +48,10 @@
import org.jboss.cache.mvcc.NullMarkerNode;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import java.util.Collections;
import java.util.HashMap;
@@ -235,10 +233,6 @@
@Override
public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
{
- if (configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC && command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), null, false, false, false, false, false, false, false);
- }
return invokeNextInterceptor(ctx, command);
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -28,10 +28,10 @@
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.JmxStatsCommandInterceptor;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
+import org.jboss.starobrno.factories.annotations.Inject;
import java.util.HashMap;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -30,7 +30,6 @@
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.WriteCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -40,10 +39,6 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.SkipCheckChainedInterceptor;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
@@ -51,9 +46,11 @@
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
+import org.jboss.starobrno.config.CacheLoaderConfig;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import javax.transaction.SystemException;
-import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.ArrayList;
import java.util.HashMap;
@@ -102,7 +99,7 @@
{
// this should only happen after the CacheLoaderManager has started, since the CacheLoaderManager only creates the CacheLoader instance in its @Start method.
loader = loaderManager.getCacheLoader();
- optimistic = configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC;
+ optimistic = false;
this.setStatisticsEnabled(configuration.getExposeManagementStatistics());
}
@@ -200,12 +197,6 @@
}
@Override
- protected Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- return handlePrepareCommand(ctx, command);
- }
-
- @Override
protected Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
{
if (inTransaction())
@@ -319,30 +310,7 @@
private void storeInternalState(Set<Fqn> affectedFqns, InvocationContext ctx) throws Exception
{
- if (configuration.getNodeLockingScheme().isVersionedScheme())
- {
- // we need to suspend any txs here since they would be in the tx-committed state and if the loader attempts to
- // use JTA (E.g., a JDBC CL using connections from a tx aware datasource) it will fail since the tx is in an
- // illegal state to perform writes. See JBCACHE-1408.
- Transaction tx = txMgr.suspend();
- try
- {
- for (Fqn f : affectedFqns)
- {
- // NOT going to store tombstones!!
- NodeSPI n = ctx.lookUpNode(f);
- if (n != null && !n.isDeleted())
- {
- Map internalState = n.getInternalState(false);
- loader.put(f, internalState);
- }
- }
- }
- finally
- {
- txMgr.resume(tx);
- }
- }
+ // no op
}
private void recursiveMove(Fqn fqn, Fqn newFqn) throws Exception
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -26,7 +26,6 @@
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.WriteCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -36,10 +35,9 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.factories.annotations.Start;
import javax.transaction.Transaction;
@@ -61,7 +59,7 @@
@Start
protected void start()
{
- notOptimisticLocking = configuration.getNodeLockingScheme() != NodeLockingScheme.OPTIMISTIC;
+ notOptimisticLocking = true;
}
@Override
@@ -72,13 +70,6 @@
}
@Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- if (trace) log.trace("Suppressing invocation of method handleOptimisticPrepareCommand.");
- return null;
- }
-
- @Override
public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
{
if (trace) log.trace("Suppressing invocation of method handleCommitCommand.");
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,39 +21,13 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.mvcc.MVCCNodeHelper;
-import org.jboss.cache.mvcc.ReadCommittedNode;
-
/**
* MVCC specific version of the LegacyDataGravitatorInterceptor
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 3.0
*/
-public class DataGravitatorInterceptor extends LegacyDataGravitatorInterceptor
+public class DataGravitatorInterceptor
{
- MVCCNodeHelper helper;
-
- @Inject
- public void injectMvccNodeHelper(MVCCNodeHelper helper)
- {
- this.helper = helper;
- }
-
- @Override
- protected boolean nodeDoesNotExist(InvocationContext ctx, Fqn fqn)
- {
- ReadCommittedNode node = (ReadCommittedNode) ctx.lookUpNode(fqn);
- return node == null || node.isNullNode();
- }
-
-
- @Override
- protected void wrapIfNeeded(InvocationContext ctx, Fqn fqnToWrap) throws InterruptedException
- {
- helper.wrapNodeForReading(ctx, fqnToWrap, true);
- }
+ // DO NOTHING
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -36,10 +36,9 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.eviction.EvictionEvent;
-import static org.jboss.cache.eviction.EvictionEvent.Type.*;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.CommandInterceptor;
+import static org.jboss.starobrno.eviction.EvictionEvent.Type.*;
+import org.jboss.starobrno.factories.annotations.Inject;
/**
* Eviction Interceptor.
@@ -241,7 +240,7 @@
return retVal;
}
- private void registerEvictionEventToRegionManager(Fqn fqn, EvictionEvent.Type type, int elementDifference, Region region)
+ private void registerEvictionEventToRegionManager(Fqn fqn, org.jboss.starobrno.eviction.EvictionEvent.Type type, int elementDifference, Region region)
{
//we do not trigger eviction events for resident nodes
if (dataContainer.isResident(fqn)) return;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/Interceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/Interceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,103 +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.interceptors;
-
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.interceptors.base.CommandInterceptor;
-
-/**
- * Class representing an interceptor.
- *
- * @author Bela Ban
- * @version $Id$
- * @deprecated this will be removed in a 3.x release. Please use {@link org.jboss.cache.interceptors.base.CommandInterceptor} instead, since it provides strongly typed callbacks which are more efficient.
- */
- at Deprecated
-public abstract class Interceptor extends CommandInterceptor
-{
- protected CacheSPI<?, ?> cache;
- protected boolean trace;
-
- public void setCache(CacheSPI cache)
- {
- this.cache = cache;
- }
-
- @Start
- private void start()
- {
- // for backward compatibility, this must only be done when the cache starts.
- setCache(cache);
- }
-
- @Inject
- private void injectDependencies(CacheSPI cache)
- {
- this.cache = cache;
- }
-
- /**
- * Using this method call for forwarding a call in the chain is not redable and error prone in the case of interceptors
- * extending other interceptors. This metod rather refers to interceptor doing its business operations rather than
- * delegating to the nextInterceptor interceptor in chain. For delegation please use {@link #nextInterceptor(org.jboss.cache.InvocationContext)}
- */
- public Object invoke(InvocationContext ctx) throws Throwable
- {
- return handleDefault(ctx, null);
- }
-
- /**
- * Forwards the call to the nextInterceptor interceptor in the chain.
- * This is here for backward compatibility.
- */
- public Object nextInterceptor(InvocationContext ctx) throws Throwable
- {
- return invokeNextInterceptor(ctx, null);
- }
-
- @Override
- public String toString()
- {
- return getClass().getName()
- + "{next: "
- + (getNext() == null ? null : getNext().getClass())
- + "}";
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- if (command != null) //call originated from a command's accept() method.
- {
- return invoke(ctx);
- }
-
- //this means that another Interceptor called this method, we have to dispatch the call to the appropriate method. Probably called directly using super.invoke().
- command = ctx.getCommand();
- return command.acceptVisitor(ctx, getNext());
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,36 +1,36 @@
-/*
- * 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.interceptors;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.util.CachePrinter;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import java.util.ArrayList;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -27,33 +27,24 @@
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.legacy.write.VersionedInvalidateCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.InvalidateCommand;
import org.jboss.cache.commands.write.MoveCommand;
import org.jboss.cache.commands.write.PutDataMapCommand;
import org.jboss.cache.commands.write.PutForExternalReadCommand;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.OptimisticTransactionContext;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
@@ -94,7 +85,7 @@
@Start
private void initTxMap()
{
- optimistic = configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC;
+ optimistic = false;
if (optimistic) txMods = new ConcurrentHashMap<GlobalTransaction, List<WriteCommand>>();
this.setStatisticsEnabled(configuration.getExposeManagementStatistics());
}
@@ -180,29 +171,6 @@
}
@Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- Object retval = invokeNextInterceptor(ctx, command);
- Transaction tx = ctx.getTransaction();
- if (tx != null)
- {
- // here we just record the modifications but actually do the invalidate in commit.
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (transactionContext == null)
- throw new IllegalStateException("cannot find transaction transactionContext for " + gtx);
-
- if (transactionContext.hasModifications())
- {
- List<WriteCommand> mods = new ArrayList<WriteCommand>(transactionContext.getModifications());
- if (transactionContext.hasLocalModifications()) mods.removeAll(transactionContext.getLocalModifications());
- txMods.put(gtx, mods);
- }
- }
- return retval;
- }
-
- @Override
public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
{
Object retval = invokeNextInterceptor(ctx, command);
@@ -281,8 +249,7 @@
{
try
{
- TransactionWorkspace workspace = optimistic ? getWorkspace(ctx) : null;
- for (Fqn fqn : filterVisitor.result) invalidateAcrossCluster(fqn, workspace, defaultSynchronous, ctx);
+ for (Fqn fqn : filterVisitor.result) invalidateAcrossCluster(fqn, null, defaultSynchronous, ctx);
}
catch (Throwable t)
{
@@ -369,8 +336,9 @@
}
- protected void invalidateAcrossCluster(Fqn fqn, TransactionWorkspace workspace, boolean synchronous, InvocationContext ctx) throws Throwable
+ protected void invalidateAcrossCluster(Fqn fqn, Object workspace, boolean synchronous, InvocationContext ctx) throws Throwable
{
+ /*
if (!isLocalModeForced(ctx))
{
// increment invalidations counter if statistics maintained
@@ -382,6 +350,7 @@
// voila, invalidated!
replicateCall(ctx, command, synchronous, ctx.getOptionOverrides());
}
+ */
}
private void incrementInvalidations()
@@ -389,28 +358,6 @@
if (getStatisticsEnabled()) invalidations++;
}
- protected DataVersion getNodeVersion(TransactionWorkspace w, Fqn f)
- {
- if (w == null) return null;
- WorkspaceNode wn = w.getNode(f);
- if (wn == null) return null; // JBCACHE-1297
- DataVersion v = wn.getVersion();
-
- if (wn.isVersioningImplicit())
- {
- // then send back an incremented version
- v = ((DefaultDataVersion) v).increment();
- }
-
- return v;
- }
-
- protected TransactionWorkspace getWorkspace(InvocationContext ctx)
- {
- OptimisticTransactionContext entry = (OptimisticTransactionContext) ctx.getTransactionContext();
- return entry.getTransactionWorkSpace();
- }
-
@ManagedOperation
public void resetStatistics()
{
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -26,7 +26,6 @@
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -35,10 +34,10 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
@@ -119,12 +118,6 @@
}
@Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- return handleAll(ctx, command, command.getGlobalTransaction(), true);
- }
-
- @Override
public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
{
return handleAll(ctx, command, null, false);
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyActivationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,417 +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.interceptors;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Modification;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.jmx.annotations.ManagedOperation;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionContext;
-
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Loads nodes that don't exist at the time of the call into memory from the CacheLoader.
- * If the nodes were evicted earlier then we remove them from the cache loader after
- * their attributes have been initialized and their children have been loaded in memory.
- *
- * @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id$
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class LegacyActivationInterceptor extends LegacyCacheLoaderInterceptor
-{
-
- protected TransactionManager txMgr = null;
- private long activations = 0;
- ActivationModificationsBuilder builder;
-
- /**
- * List<Transaction> that we have registered for
- */
- protected ConcurrentHashMap transactions = new ConcurrentHashMap(16);
- protected static final Object NULL = new Object();
-
- public LegacyActivationInterceptor()
- {
- isActivation = true;
- useCacheStore = false;
- }
-
- @Inject
- public void injectTransactionManager(TransactionManager txMgr)
- {
- this.txMgr = txMgr;
- }
-
- @Start
- public void createModificationsBuilder()
- {
- builder = new ActivationModificationsBuilder();
- }
-
- @Override
- public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
- {
- Object returnValue = super.visitClearDataCommand(ctx, command);
- if (trace)
- log.trace("This is a remove data operation; removing the data from the loader, no activation processing needed.");
- loader.removeData(command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
- {
- Object returnValue = super.visitRemoveNodeCommand(ctx, command);
- if (trace)
- log.trace("This is a remove operation; removing the node from the loader, no activation processing needed.");
- loader.remove(command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
- {
- Object returnValue = super.visitGetChildrenNamesCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
- {
- Object returnValue = super.visitGetKeysCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
- {
- Object returnValue = super.visitGetNodeCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
- {
- Object returnValue = super.visitGetKeyValueCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- return visitPutKeyValueCommand(ctx, command);
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- Object returnValue = super.visitPutKeyValueCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- Object returnValue = super.visitPutDataMapCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
- {
- Object returnValue = super.visitRemoveKeyCommand(ctx, command);
- removeNodeFromCacheLoader(ctx, command.getFqn());
- return returnValue;
- }
-
- @Override
- public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
- {
- Object returnValue = super.visitMoveCommand(ctx, command);
- if (trace)
- log.trace("This is a move operation; removing the FROM node from the loader, no activation processing needed.");
- loader.remove(command.getFqn());
- removeNodeFromCacheLoader(ctx, command.getFqn().getParent());
- removeNodeFromCacheLoader(ctx, command.getTo());
- return returnValue;
- }
-
-
- /**
- * Remove the node from the cache loader if it exists in memory,
- * its attributes have been initialized, its children have been loaded,
- * AND it was found in the cache loader (nodeLoaded = true).
- * Then notify the listeners that the node has been activated.
- */
- private void removeNodeFromCacheLoader(InvocationContext ctx, Fqn fqn) throws Throwable
- {
- NodeSPI n;
- if (((n = dataContainer.peek(fqn, true, false)) != null) && n.isDataLoaded() && loader.exists(fqn))
- {
- // node not null and attributes have been loaded?
- if (!n.getChildrenDirect().isEmpty())
- {
- boolean result = childrenLoaded(n);
- if (result)
- {
- log.debug("children all initialized");
- remove(fqn);
- }
- }
- else if (loaderNoChildren(fqn))
- {
- if (log.isDebugEnabled()) log.debug("no children " + n);
- remove(fqn);
- }
- }
- }
-
- private static boolean childrenLoaded(NodeSPI<?, ?> node)
- {
- if (!node.isChildrenLoaded())
- {
- return false;
- }
- for (NodeSPI child : node.getChildrenDirect())
- {
- if (!child.isDataLoaded())
- {
- return false;
- }
- }
- return true;
-
- }
-
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- Object retval = invokeNextInterceptor(ctx, command);
- if (inTransaction())
- {
- prepareCacheLoader(ctx);
- }
- return retval;
- }
-
- private boolean inTransaction() throws SystemException
- {
- return txMgr != null && txMgr.getTransaction() != null;
- }
-
- @Override
- public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
- {
- Object retval = invokeNextInterceptor(ctx, command);
- if (inTransaction())
- {
- prepareCacheLoader(ctx);
- }
- return retval;
- }
-
- private void remove(Fqn fqn) throws Exception
- {
- loader.remove(fqn);
- if (getStatisticsEnabled()) activations++;
- }
-
- /**
- * Returns true if the loader indicates no children for this node.
- * Return false on error.
- */
- private boolean loaderNoChildren(Fqn fqn)
- {
- try
- {
- Set childrenNames = loader.getChildrenNames(fqn);
- return (childrenNames == null);
- }
- catch (Exception e)
- {
- log.error("failed getting the children names for " + fqn + " from the cache loader", e);
- return false;
- }
- }
-
- public long getActivations()
- {
- return activations;
- }
-
- private void prepareCacheLoader(InvocationContext ctx) throws Throwable
- {
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- TransactionContext tCtx = ctx.getTransactionContext();
- if (tCtx == null)
- {
- throw new Exception("tCtx for transaction " + gtx + " not found in transaction table");
- }
- List<Modification> cacheLoaderModifications = new ArrayList<Modification>();
-
- builder.visitCollection(ctx, tCtx.getModifications());
- if (cacheLoaderModifications.size() > 0)
- {
- loader.prepare(gtx, cacheLoaderModifications, false);
- }
- }
-
- public class ActivationModificationsBuilder extends AbstractVisitor
- {
-
- private List<Modification> cacheLoaderModifications = new ArrayList<Modification>();
-
- private int txActs = 0;
-
- @Override
- public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand removeNodeCommand) throws Throwable
- {
- Modification mod = new Modification(Modification.ModificationType.REMOVE_NODE, removeNodeCommand.getFqn());
- cacheLoaderModifications.add(mod);
- return null;
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- Fqn fqn = command.getFqn();
- handlePutCommand(ctx, fqn);
- return null;
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- Fqn fqn = command.getFqn();
- handlePutCommand(ctx, fqn);
- return null;
- }
-
- // On the way out, remove the node from the cache loader.
- // Only remove the node if it exists in memory, its attributes have
- // been initialized, its children have been loaded
- // AND it was found in the cache loader (nodeLoaded = true).
- // Then notify the listeners that the node has been activated.
- private void handlePutCommand(InvocationContext ctx, Fqn fqn)
- throws Exception
- {
- if (fqn != null && dataContainer.peek(fqn, false, false) != null && loader.exists(fqn))
- {
- NodeSPI n = dataContainer.peek(fqn, true, false);// don't load
- // node not null and attributes have been loaded?
- if (n != null && n.isDataLoaded())
- {
- // has children?
- boolean result = childrenLoaded(n);
- if (!n.getChildrenDirect().isEmpty() && result)
- {
- // children have been loaded, remove the node
- addRemoveMod(ctx, cacheLoaderModifications, fqn, n.getDataDirect());
- txActs++;
- }
- // doesn't have children, check the cache loader
- else if (loaderNoChildren(fqn))
- {
- addRemoveMod(ctx, cacheLoaderModifications, fqn, n.getDataDirect());
- txActs++;
- }
- }
- }
- }
-
- private boolean loaderNoChildren(Fqn fqn) throws Exception
- {
- return loader.getChildrenNames(fqn) != null;
- }
-
- private void addRemoveMod(InvocationContext ctx, List<Modification> l, Fqn fqn, Map data)
- {
- Modification mod = new Modification(Modification.ModificationType.REMOVE_NODE, fqn);
- l.add(mod);
- notifier.notifyNodeActivated(fqn, false, data, ctx);
- }
-
- public List<Modification> getCacheLoaderModifications()
- {
- return cacheLoaderModifications;
- }
-
- public int getTxActs()
- {
- return txActs;
- }
-
- }
-
- @ManagedOperation
- public void resetStatistics()
- {
- super.resetStatistics();
- activations = 0;
- }
-
- @ManagedOperation
- public Map<String, Object> dumpStatistics()
- {
- Map<String, Object> retval = super.dumpStatistics();
- if (retval == null)
- {
- retval = new HashMap<String, Object>();
- }
- retval.put("Activations", activations);
- return retval;
- }
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheLoaderInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,610 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
-import static org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.interceptors.base.JmxStatsCommandInterceptor;
-import org.jboss.cache.jmx.annotations.ManagedAttribute;
-import org.jboss.cache.jmx.annotations.ManagedOperation;
-import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.loader.CacheLoaderManager;
-import org.jboss.cache.lock.LockManager;
-import org.jboss.cache.lock.LockType;
-import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.transaction.TransactionContext;
-import org.jboss.cache.transaction.TransactionTable;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Loads nodes that don't exist at the time of the call into memory from the CacheLoader
- *
- * @author Bela Ban
- * @version $Id$
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class LegacyCacheLoaderInterceptor extends JmxStatsCommandInterceptor
-{
- private long cacheLoads = 0;
- private long cacheMisses = 0;
- private CacheLoaderManager clm;
- private LockManager lockManager;
-
- protected TransactionTable txTable = null;
- protected CacheLoader loader;
- protected DataContainer dataContainer;
- protected Notifier notifier;
-
- protected boolean isActivation = false;
- protected boolean usingVersionedInvalidation = false;
-
-
- /**
- * True if CacheStoreInterceptor is in place.
- * This allows us to skip loading keys for remove(Fqn, key) and put(Fqn, key).
- * It also affects removal of node data and listing children.
- */
- protected boolean useCacheStore = true;
-
- @Inject
- protected void injectDependencies(TransactionTable txTable, CacheLoaderManager clm, Configuration configuration,
- DataContainer dataContainer, LockManager lockManager, Notifier notifier)
- {
- this.txTable = txTable;
- this.clm = clm;
- CacheMode mode = configuration.getCacheMode();
- usingVersionedInvalidation = configuration.getNodeLockingScheme().isVersionedScheme() && mode.isInvalidation();
- this.dataContainer = dataContainer;
- this.lockManager = lockManager;
- this.notifier = notifier;
- }
-
- @Start
- protected void startInterceptor()
- {
- loader = clm.getCacheLoader();
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), null, true, true, false, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), command.getKey(), false, useCacheStore, !useCacheStore, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- return visitPutKeyValueCommand(ctx, command);
- }
-
- @Override
- public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- if (command.getTo() != null)
- {
- loadIfNeeded(ctx, command.getTo(), null, false, false, true, ctx.getTransactionContext(), false, true, false);
- }
- loadIfNeeded(ctx, command.getFqn(), null, false, false, true, ctx.getTransactionContext(), true, true, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), command.getKey(), false, false, true, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
-
- @Override
- public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), null, false, false, true, ctx.getTransactionContext(), false, false, !usingVersionedInvalidation);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
- {
- Fqn fqn = command.getFqn();
- if (fqn != null)
- {
- loadIfNeeded(ctx, fqn, null, false, false, false, ctx.getTransactionContext(), false, false, true);
- NodeSPI n = dataContainer.peek(fqn, true, true);
- loadChildren(fqn, n, false, false, ctx);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
-
- @Override
- public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), null, true, false, true, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command) throws Throwable
- {
- if (command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), null, true, false, true, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
- {
- // clean up nodesCreated map
- if (trace) log.trace("Removing temporarily created nodes from treecache");
-
- // this needs to be done in reverse order.
- List list = ctx.getTransactionContext().getDummyNodesCreatedByCacheLoader();
- if (list != null && list.size() > 0)
- {
- ListIterator i = list.listIterator(list.size());
- while (i.hasPrevious())
- {
- Fqn fqn = (Fqn) i.previous();
- try
- {
- dataContainer.evict(fqn, false);
- }
- catch (CacheException e)
- {
- if (trace) log.trace("Unable to evict node " + fqn, e);
- }
- }
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
- {
- if (configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC && command.getFqn() != null)
- {
- loadIfNeeded(ctx, command.getFqn(), null, false, false, false, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
- {
- if (command.getFqn() != null && !useCacheStore)
- {
- loadIfNeeded(ctx, command.getFqn(), command.getKey(), false, false, false, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
- {
- Fqn fqn = command.getFqn();
- if (fqn != null && !useCacheStore)
- {
- loadIfNeeded(ctx, fqn, null, false, true, false, ctx.getTransactionContext(), false, false, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- private void loadIfNeeded(InvocationContext ctx, Fqn fqn, Object key, boolean allKeys, boolean initNode, boolean acquireLock, TransactionContext transactionContext, boolean recursive, boolean isMove, boolean bypassLoadingData) throws Throwable
- {
- NodeSPI n = dataContainer.peek(fqn, true, true);
- Object lockOwner = lockManager.getLockOwner(ctx);
- boolean needLock = n != null && !lockManager.ownsLock(fqn, lockOwner);
- boolean mustLoad = false;
- try
- {
- if (needLock)
- {
- if (!lockManager.lock(n, LockType.READ, lockOwner))
- throw new TimeoutException("Unable to acquire lock on " + fqn + ". Lock info: " + lockManager.printLockInfo(n));
- }
- mustLoad = mustLoad(n, key, allKeys || isMove);
- }
- finally
- {
- if (needLock) lockManager.unlock(n, lockOwner);
- }
-
- if (trace)
- {
- log.trace("load element " + fqn + " mustLoad=" + mustLoad);
- }
- if (mustLoad)
- {
- if (initNode)
- {
- n = createTempNode(fqn, transactionContext);
- }
-
- // Only attempt to acquire this lock if we need to - i.e., if
- // the lock hasn't already been acquired by the Lock
- // interceptor. CRUD methods (put, remove) would have acquired
- // this lock - even if the node is not in memory and needs to be
- // loaded. Non-CRUD methods (put) would NOT have acquired this
- // lock so if we are to load the node from cache loader, we need
- // to acquire a write lock here. as a 'catch-all', DO NOT
- // attempt to acquire a lock here *anyway*, even for CRUD
- // methods - this leads to a deadlock when you have threads
- // simultaneously trying to create a node. See
- // org.jboss.cache.loader.deadlock.ConcurrentCreationDeadlockTest
- // - Manik Surtani (21 March 2006)
- if (acquireLock)
- {
- lock(fqn, LockType.WRITE, false, ctx);// non-recursive for now
- }
-
-// if (!initNode && !wasRemovedInTx(fqn, ctx.getGlobalTransaction()))
- if (!wasRemovedInTx(fqn, ctx))
- {
- if (bypassLoadingData)
- {
- if (n == null && loader.exists(fqn))
- {
- // just create a dummy node in memory
- n = createTempNode(fqn, transactionContext);
- }
- }
- else
- {
- n = loadNode(ctx, fqn, n, transactionContext);
- }
- }
- }
-
- // The complete list of children aren't known without loading them
- if (recursive)
- {
- loadChildren(fqn, n, recursive, isMove, ctx);
- }
- }
-
- /**
- * Load the children.
- *
- * @param node may be null if the node was not found.
- * @param ctxt
- */
- private void loadChildren(Fqn fqn, NodeSPI node, boolean recursive, boolean isMove, InvocationContext ctxt) throws Throwable
- {
-
- if (node != null && node.isChildrenLoaded())
- {
- if (trace) log.trace("Children already loaded!");
- return;
- }
- Set childrenNames;
- try
- {
- childrenNames = loader.getChildrenNames(fqn);
- }
- catch (Exception e)
- {
- if (log.isInfoEnabled()) log.info("Cache loader was unable to load state", e);
- // return!
- return;
- }
-
- if (trace)
- {
- log.trace("load children " + fqn + " children=" + childrenNames);
- }
-
- // For getChildrenNames null means no children
- if (childrenNames == null)
- {
- if (node != null)
- {
- if (useCacheStore)
- {
- node.removeChildrenDirect();//getChildrenMapDirect().clear();
- }
- node.setChildrenLoaded(true);
- }
- return;
- }
-
- // Create if node had not been created already
- if (node == null)
- {
- node = createNodes(fqn, null);// dont care about local transactions
- }
-
- // Create one DataNode per child, mark as UNINITIALIZED
- for (Object name : childrenNames)
- {
- Fqn childFqn = Fqn.fromElements(name);// this is a RELATIVE Fqn!!
-
- // create child if it didn't exist
- NodeSPI child = node.addChildDirect(childFqn);
- if ((isMove || isActivation) && recursive)
- {
- // load data for children as well!
- child.setInternalState(loader.get(child.getFqn()));
- child.setDataLoaded(true);
- }
-
- if (recursive)
- {
- loadChildren(child.getFqn(), child, true, isMove, ctxt);
- }
- }
- lock(fqn, recursive ? LockType.WRITE : LockType.READ, true, ctxt);// recursive=true: lock entire subtree
- node.setChildrenLoaded(true);
- }
-
- private boolean mustLoad(NodeSPI n, Object key, boolean allKeys)
- {
- if (n == null)
- {
- if (trace) log.trace("must load, node null");
- return true;
- }
-
- // check this first!!!
- if (!n.isValid() && configuration.getNodeLockingScheme().isVersionedScheme())
- {
- // attempt to load again; this only happens if we have tombstones lying around, or we are using invalidation.
- if (trace) log.trace("loading again from cache loader since in-memory node is marked as invalid");
- return true;
- }
-
- // JBCACHE-1172 Skip single-key optimization if request needs all keys
- if (!allKeys)
- {
- // if we are not looking for a specific key don't bother loading!
- if (key == null)
- {
- if (trace) log.trace("don't load, key requested is null");
- return false;
- }
- if (n.getKeysDirect().contains(key))
- {
- if (trace) log.trace("don't load, already have necessary key in memory");
- return false;
- }
- }
- if (!n.isDataLoaded())
- {
- if (trace) log.trace("must Load, uninitialized");
- return true;
- }
- return false;
- }
-
- protected void lock(Fqn fqn, LockType lockType, boolean recursive, InvocationContext ctx) throws Throwable
- {
- if (configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC) return;
-
- if (recursive)
- lockManager.lockAllAndRecord(fqn, lockType, ctx);
- else
- lockManager.lockAndRecord(fqn, lockType, ctx);
- }
-
- /**
- * Returns true if the FQN or parent was removed during the current
- * transaction.
- * This is O(N) WRT to the number of modifications so far.
- */
- private boolean wasRemovedInTx(Fqn fqn, InvocationContext ctx)
- {
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (transactionContext == null) return false;
-
- for (WriteCommand txCacheCommand : transactionContext.getModifications())
- {
- if (txCacheCommand instanceof RemoveNodeCommand && fqn.isChildOrEquals(txCacheCommand.getFqn())) return true;
- }
- return false;
- }
-
- /**
- * Loads a node from disk; if it exists creates parent TreeNodes.
- * If it doesn't exist on disk but in memory, clears the
- * uninitialized flag, otherwise returns null.
- */
- private NodeSPI loadNode(InvocationContext ctx, Fqn fqn, NodeSPI n, TransactionContext transactionContext) throws Exception
- {
- if (trace) log.trace("loadNode " + fqn);
- Map nodeData = loadData(fqn);
- if (nodeData != null)
- {
- if (trace) log.trace("Node data is not null, loading");
-
- notifier.notifyNodeLoaded(fqn, true, Collections.emptyMap(), ctx);
- if (isActivation)
- {
- notifier.notifyNodeActivated(fqn, true, Collections.emptyMap(), ctx);
- }
-
- n = createNodes(fqn, transactionContext);
-// n.clearDataDirect();
- n.setInternalState(nodeData);
-
- // set this node as valid?
- if (usingVersionedInvalidation) n.setValid(true, false);
-
- notifier.notifyNodeLoaded(fqn, false, nodeData, ctx);
- if (isActivation)
- {
- notifier.notifyNodeActivated(fqn, false, nodeData, ctx);
- }
- }
- if (n != null && !n.isDataLoaded())
- {
- if (trace) log.trace("Setting dataLoaded to true");
- n.setDataLoaded(true);
- }
- return n;
- }
-
- /**
- * Creates a new memory node in preparation for storage.
- */
- private NodeSPI createTempNode(Fqn fqn, TransactionContext transactionContext) throws Exception
- {
- NodeSPI n = createNodes(fqn, transactionContext);
- n.setDataLoaded(false);
- if (trace)
- {
- log.trace("createTempNode n " + n);
- }
- return n;
- }
-
- @SuppressWarnings("unchecked")
- private NodeSPI<?, ?> createNodes(Fqn fqn, TransactionContext transactionContext) throws Exception
- {
- Object[] results = dataContainer.createNodes(fqn);
- List<NodeSPI<?, ?>> createdNodes = (List<NodeSPI<?, ?>>) results[0];
-
- NodeSPI lastCreated = null;
- for (NodeSPI node : createdNodes)
- {
- node.setDataLoaded(false);
- if (transactionContext != null)
- {
- transactionContext.addDummyNodeCreatedByCacheLoader(node.getFqn());
- }
- lastCreated = node;
- }
-
- // mark the leaf node as data loaded since that is what we are doing in this interceptor.
- if (lastCreated != null) lastCreated.setDataLoaded(true);
-
- // regardless of whether the last node was created, return it.
- return (NodeSPI) results[1];
- }
-
- private Map loadData(Fqn fqn) throws Exception
- {
-
- Map nodeData = loader.get(fqn);
- boolean nodeExists = (nodeData != null);
- if (trace) log.trace("nodeExists " + nodeExists);
-
- if (getStatisticsEnabled())
- {
- if (nodeExists)
- {
- cacheLoads++;
- }
- else
- {
- cacheMisses++;
- }
- }
- return nodeData;
- }
-
- @ManagedAttribute(description = "number of cache loader node loads")
- public long getCacheLoaderLoads()
- {
- return cacheLoads;
- }
-
- @ManagedAttribute(description = "number of cache loader node misses")
- public long getCacheLoaderMisses()
- {
- return cacheMisses;
- }
-
- @ManagedOperation
- public void resetStatistics()
- {
- cacheLoads = 0;
- cacheMisses = 0;
- }
-
- @ManagedOperation
- public Map<String, Object> dumpStatistics()
- {
- Map<String, Object> retval = new HashMap<String, Object>();
- retval.put("CacheLoaderLoads", cacheLoads);
- retval.put("CacheLoaderMisses", cacheMisses);
- return retval;
- }
-
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheStoreInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheStoreInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyCacheStoreInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * 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.cache.interceptors;
-
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.annotations.Compat;
-
- at Compat
- at Deprecated
-public class LegacyCacheStoreInterceptor extends CacheStoreInterceptor
-{
- @Override
- protected void storeStateForPutDataMap(Fqn f, InvocationContext ctx) throws Exception
- {
- loader.put(f, ctx.lookUpNode(f).getDataDirect());
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,464 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.buddyreplication.GravitateResult;
-import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.DataCommand;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.remote.DataGravitationCleanupCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jgroups.Address;
-import org.jgroups.blocks.GroupRequest;
-import org.jgroups.blocks.RspFilter;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * The Data Gravitator interceptor intercepts cache misses and attempts to
- * gravitate data from other parts of the cluster.
- * <p/>
- * Only used if Buddy Replication is enabled. Also, the interceptor only kicks
- * in if an {@link org.jboss.cache.config.Option} is passed in to force Data
- * Gravitation for a specific invocation or if <b>autoDataGravitation</b> is
- * set to <b>true</b> when configuring Buddy Replication.
- * <p/>
- * See the JBoss Cache User Guide for more details on configuration options.
- * There is a section dedicated to Buddy Replication in the Replication
- * chapter.
- * <p/>
- * In terms of functionality, if a gravitation call has occured and a cleanup call is needed (based on
- * how BR is configured), a cleanup call will be broadcast immediately after the gravitation call (no txs)
- * or if txs are used, an <i>asynchronous</i> call is made to perform the cleanup <i>outside</i> the scope
- * of the tx that caused the gravitation event.
- * <p/>
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @deprecated will be removed with optimistic and pessimistic locking.
- */
- at Deprecated
-public class LegacyDataGravitatorInterceptor extends BaseRpcInterceptor
-{
- private BuddyManager buddyManager;
- /**
- * Map that contains commands that need cleaning up. This is keyed on global transaction, and contains a list of
- * cleanup commands corresponding to all gravitate calls made during the course of the transaction in question.
- */
- private Map<GlobalTransaction, List<ReplicableCommand>> cleanupCommands = new ConcurrentHashMap<GlobalTransaction, List<ReplicableCommand>>();
- private DataContainer dataContainer;
- private CommandsFactory commandsFactory;
- private CacheSPI cacheSPI;
- private BuddyFqnTransformer buddyFqnTransformer;
-
- @Inject
- public void injectComponents(BuddyManager buddyManager, DataContainer dataContainer, CommandsFactory commandsFactory, CacheSPI cacheSPI, BuddyFqnTransformer transformer)
- {
- this.buddyManager = buddyManager;
- this.dataContainer = dataContainer;
- this.commandsFactory = commandsFactory;
- this.cacheSPI = cacheSPI;
- buddyFqnTransformer = transformer;
- }
-
- @Override
- public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
- {
- return handleGetMethod(ctx, command);
- }
-
- @Override
- public Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command) throws Throwable
- {
- return handleGetMethod(ctx, command);
- }
-
- @Override
- public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
- {
- return handleGetMethod(ctx, command);
- }
-
- @Override
- public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
- {
- return handleGetMethod(ctx, command);
- }
-
- @Override
- public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
- {
- return handleGetMethod(ctx, command);
- }
-
- @Override
- public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
- {
- try
- {
- return invokeNextInterceptor(ctx, command);
- }
- finally
- {
- cleanupCommands.remove(ctx.getGlobalTransaction());
- }
- }
-
- @Override
- public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
- {
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- try
- {
- doCommit(gtx);
- return invokeNextInterceptor(ctx, command);
- }
- finally
- {
- cleanupCommands.remove(gtx);
- }
- }
-
- /**
- * @param ctx invocation context
- * @param fqn fqn to test
- * @return true if the node does not exist; false otherwise.
- */
- protected boolean nodeDoesNotExist(InvocationContext ctx, Fqn fqn)
- {
- return !dataContainer.exists(fqn);
- }
-
- private Object handleGetMethod(InvocationContext ctx, DataCommand command) throws Throwable
- {
- if (isGravitationEnabled(ctx))
- {
- // test that the Fqn being requested exists locally in the cache.
- if (trace) log.trace("Checking local existence of requested fqn " + command.getFqn());
- if (buddyFqnTransformer.isBackupFqn(command.getFqn()))
- {
- log.info("Is call for a backup Fqn, not performing any gravitation. Direct calls on internal backup nodes are *not* supported.");
- }
- else
- {
- if (nodeDoesNotExist(ctx, command.getFqn()))
- {
- // gravitation is necessary.
-
- if (trace) log.trace("Gravitating from local backup tree");
- BackupData data = localBackupGet(command.getFqn(), ctx);
-
- if (data == null)
- {
- if (trace) log.trace("Gravitating from remote backup tree");
- // gravitate remotely.
- data = remoteBackupGet(command.getFqn());
- }
-
- if (data != null)
- {
- if (trace)
- log.trace("Passing the put call locally to make sure state is persisted and ownership is correctly established.");
- // store the gravitated node locally. This will cause it being backed up in the current instance's buddy.
- createNode(data.backupData);
- cleanBackupData(data, ctx);
- wrapIfNeeded(ctx, data.primaryFqn);
- }
- }
- else
- {
- if (trace) log.trace("No need to gravitate; have this already.");
- }
- }
- }
- else
- {
- if (trace)
- {
- log.trace("Suppressing data gravitation for this call.");
- }
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- protected void wrapIfNeeded(InvocationContext ctx, Fqn fqnToWrap) throws InterruptedException
- {
- // no op
- }
-
- private boolean isGravitationEnabled(InvocationContext ctx)
- {
- boolean enabled = ctx.isOriginLocal();
- if (enabled)
- {
- if (!buddyManager.isAutoDataGravitation())
- {
- enabled = ctx.getOptionOverrides().getForceDataGravitation();
- }
- }
- return enabled;
- }
-
- private void doCommit(GlobalTransaction gtx) throws Throwable
- {
- if (cleanupCommands.containsKey(gtx))
- {
- if (trace) log.trace("Broadcasting cleanup commands for gtx " + gtx);
-
- for (ReplicableCommand command : cleanupCommands.get(gtx))
- {
- try
- {
- doCleanup(command);
- }
- catch (Throwable th)
- {
- log.warn("Problems performing gravitation cleanup. Cleanup command: " + command, th);
- }
- }
- }
- else
- {
- if (trace) log.trace("No cleanups to broadcast in commit phase for gtx " + gtx);
- }
- }
-
- private BackupData remoteBackupGet(Fqn name) throws Exception
- {
- BackupData result = null;
- GravitateResult gr = gravitateData(name);
- if (gr.isDataFound())
- {
- if (trace)
- {
- log.trace("Got response " + gr);
- }
-
- result = new BackupData(name, gr);
- }
- return result;
- }
-
- private void cleanBackupData(BackupData backup, InvocationContext ctx) throws Throwable
- {
-
- DataGravitationCleanupCommand cleanupCommand = commandsFactory.buildDataGravitationCleanupCommand(backup.primaryFqn, backup.backupFqn);
- GlobalTransaction gtx = ctx.getGlobalTransaction();
-
- if (gtx == null)
- {
- // broadcast removes
- // remove main Fqn
- if (trace) log.trace("Performing cleanup on [" + backup.primaryFqn + "]");
- // remove backup Fqn
- doCleanup(cleanupCommand);
- }
- else
- {
- if (trace)
- log.trace("Data gravitation performed under global transaction " + gtx + ". Not broadcasting cleanups until the tx commits. Recording cleanup command for later use.");
- List<ReplicableCommand> commands;
- if (cleanupCommands.containsKey(gtx))
- {
- commands = cleanupCommands.get(gtx);
- }
- else
- {
- commands = new LinkedList<ReplicableCommand>();
- }
-
- commands.add(cleanupCommand);
- cleanupCommands.put(gtx, commands);
- }
- }
-
- private void doCleanup(ReplicableCommand cleanupCommand) throws Throwable
- {
- // cleanup commands are always ASYNCHRONOUS and is broadcast to *everyone* (even members of the current buddy
- // group as they may be members of > 1 buddy group)
- replicateCall(null, cleanupCommand, false, false, false, true, -1);
- }
-
- @SuppressWarnings("deprecation")
- private GravitateResult gravitateData(Fqn fqn) throws Exception
- {
- if (trace) log.trace("Requesting data gravitation for Fqn " + fqn);
-
- List<Address> mbrs = rpcManager.getMembers();
- Boolean searchSubtrees = buddyManager.isDataGravitationSearchBackupTrees() ? Boolean.TRUE : Boolean.FALSE;
- GravitateDataCommand command = commandsFactory.buildGravitateDataCommand(fqn, searchSubtrees);
- // doing a GET_ALL is crappy but necessary since JGroups' GET_FIRST could return null results from nodes that do
- // not have either the primary OR backup, and stop polling other valid nodes.
- List resps = rpcManager.callRemoteMethods(null, command, GroupRequest.GET_ALL, buddyManager.getBuddyCommunicationTimeout(), new ResponseValidityFilter(mbrs, rpcManager.getLocalAddress()), false);
-
- if (trace) log.trace("got responses " + resps);
-
- if (resps == null)
- {
- if (mbrs.size() > 1) log.error("No replies to call " + command);
- return GravitateResult.noDataFound();
- }
-
- // test for and remove exceptions
- GravitateResult result = GravitateResult.noDataFound();
- for (Object o : resps)
- {
- if (o instanceof Throwable)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Found remote Throwable among responses - removing from responses list", (Exception) o);
- }
- }
- else if (o != null)
- {
- result = (GravitateResult) o;
- if (result.isDataFound())
- {
- break;
- }
- }
- else if (!configuration.isUseRegionBasedMarshalling())
- {
- // Null is OK if we are using region based marshalling; it
- // is what is returned if a region is inactive. Otherwise
- // getting a null is an error condition
- log.error("Unexpected null response to call " + command + ".");
- }
-
- }
-
- return result;
- }
-
- @SuppressWarnings("unchecked")
- private void createNode(List<NodeData> nodeData) throws CacheException
- {
- for (NodeData data : nodeData)
- {
- cacheSPI.put(data.getFqn(), data.getAttributes());
- }
- }
-
- private BackupData localBackupGet(Fqn fqn, InvocationContext ctx) throws CacheException
- {
- GravitateResult result = cacheSPI.gravitateData(fqn, true, ctx);// a "local" gravitation
- boolean found = result.isDataFound();
- BackupData data = null;
-
- if (found)
- {
- Fqn backupFqn = result.getBuddyBackupFqn();
- data = new BackupData(fqn, result);
- // now the cleanup
- if (buddyManager.isDataGravitationRemoveOnFind())
- {
- // Remove locally only; the remote call will
- // be broadcast later
- ctx.getOptionOverrides().setCacheModeLocal(true);
- cacheSPI.removeNode(backupFqn);
- }
- else
- {
- cacheSPI.evict(backupFqn, true);
- }
- }
-
- if (trace) log.trace("Retrieved data " + data + " found = " + found);
- return data;
- }
-
- private static class BackupData
- {
- Fqn primaryFqn;
- Fqn backupFqn;
- List<NodeData> backupData;
-
- public BackupData(Fqn primaryFqn, GravitateResult gr)
- {
- this.primaryFqn = primaryFqn;
- this.backupFqn = gr.getBuddyBackupFqn();
- this.backupData = gr.getNodeData();
- }
-
- public String toString()
- {
- return "BackupData{" +
- "primaryFqn=" + primaryFqn +
- ", backupFqn=" + backupFqn +
- ", backupData=" + backupData +
- '}';
- }
- }
-
- public static class ResponseValidityFilter implements RspFilter
- {
- private int numValidResponses = 0;
- private List<Address> pendingResponders;
-
- public ResponseValidityFilter(List<Address> expected, Address localAddress)
- {
- // so for now I used a list to keep it consistent
- this.pendingResponders = new ArrayList<Address>(expected);
- // We'll never get a response from ourself
- this.pendingResponders.remove(localAddress);
- }
-
- public boolean isAcceptable(Object object, Address address)
- {
- pendingResponders.remove(address);
-
- if (object instanceof GravitateResult)
- {
- GravitateResult response = (GravitateResult) object;
- if (response.isDataFound()) numValidResponses++;
- }
- // always return true to make sure a response is logged by the JGroups RpcDispatcher.
- return true;
- }
-
- public boolean needMoreResponses()
- {
- return numValidResponses < 1 && pendingResponders.size() > 0;
- }
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/LegacyPassivationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,69 +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.interceptors;
-
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.factories.annotations.Inject;
-
-import java.util.List;
-
-/**
- * Passivation interceptor for optimistic and pessimistic locking
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class LegacyPassivationInterceptor extends PassivationInterceptor
-{
- private DataContainer dataContainer;
-
- @Inject
- private void injectDataContainer(DataContainer dataContainer)
- {
- this.dataContainer = dataContainer;
- }
-
- @Override
- public Object visitEvictFqnCommand(InvocationContext ctx, EvictCommand command) throws Throwable
- {
- if (command.isRecursive())
- {
- for (Fqn f : getNodeList(command.getFqn())) passivate(ctx, f);
- }
- else
- {
- passivate(ctx, command.getFqn());
- }
-
- return invokeNextInterceptor(ctx, command);
- }
-
- private List<Fqn> getNodeList(Fqn startingPoint)
- {
- return dataContainer.getNodesForEviction(startingPoint, true);
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -46,10 +46,10 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.PrePostProcessingCommandInterceptor;
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.mvcc.MVCCNodeHelper;
+import org.jboss.starobrno.factories.annotations.Inject;
import java.util.Collections;
import java.util.LinkedList;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/MarshalledValueInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -63,10 +63,6 @@
@Override
public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
{
- if (command.getDataVersion() != null)
- {
- return invokeNextInterceptor(ctx, command);
- }
Set<MarshalledValue> marshalledValues = new HashSet<MarshalledValue>();
command.setData(wrapMap(command.getData(), marshalledValues, ctx));
Object retVal = invokeNextInterceptor(ctx, command);
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,8 +25,8 @@
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.Notifier;
+import org.jboss.starobrno.factories.annotations.Inject;
/**
* The interceptor in charge of firing off notifications to cache listeners
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,294 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeFactory;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.GlobalTransaction;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Used to create new {@link NodeSPI} instances in the main data structure and then copy it into the
- * {@link TransactionWorkspace} as {@link WorkspaceNode}s as needed. This is only invoked if nodes needed do not exist
- * in the underlying structure, they are added and the corresponding {@link org.jboss.cache.optimistic.WorkspaceNode#isCreated()}
- * would return <tt>true</tt> to denote that this node has been freshly created in the underlying structure.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticCreateIfNotExistsInterceptor extends OptimisticInterceptor
-{
- /**
- * A reference to the node factory registered with the cache instance, used to create both WorkspaceNodes as well as
- * NodeSPI objects in the underlying data structure.
- */
- private NodeFactory nodeFactory;
-
- private DataContainer dataContainer;
-
- private CacheSPI cache;
-
- private long lockAcquisitionTimeout;
-
- @Inject
- private void injectDependencies(NodeFactory nodeFactory, DataContainer dataContainer, CacheSPI cacheSPI)
- {
- this.nodeFactory = nodeFactory;
- this.dataContainer = dataContainer;
- this.cache = cacheSPI;
- }
-
- @Start
- private void init()
- {
- lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- createNode(ctx, command.getFqn(), false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- createNode(ctx, command.getFqn(), false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- createNode(ctx, command.getFqn(), false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
- {
- List<Fqn> fqns = new ArrayList<Fqn>();
- fqns.add(command.getTo());
- // peek into Node and get a hold of all child fqns as these need to be in the workspace.
- NodeSPI node = dataContainer.peek(command.getFqn(), true, true);
- greedyGetFqns(fqns, node, command.getTo());
- if (trace) log.trace("Adding Fqns " + fqns + " for a move() operation.");
- for (Fqn f : fqns)
- {
- createNode(ctx, f, true);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- /**
- * The only method that should be creating nodes.
- *
- * @param targetFqn
- * @throws CacheException
- */
- private void createNode(InvocationContext ctx, Fqn targetFqn, boolean suppressNotification) throws CacheException
- {
- if (dataContainer.peek(targetFqn, false, false) != null) return;
- // we do nothing if targetFqn is null
- if (targetFqn == null) return;
-
- boolean debug = log.isDebugEnabled();
-
- GlobalTransaction gtx = getGlobalTransaction(ctx);
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
-
- WorkspaceNode workspaceNode;
-
- List<Fqn> nodesCreated = new ArrayList<Fqn>();
-
- DataVersion version = null;
- if (ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
- {
- version = ctx.getOptionOverrides().getDataVersion();
- workspace.setVersioningImplicit(false);
- }
-
- // start with the ROOT node and then work our way down to the node necessary, creating nodes along the way.
- workspaceNode = workspace.getNode(Fqn.ROOT);
- if (debug) log.debug("GlobalTransaction: " + gtx + "; Root: " + workspaceNode);
-
- // we do not have the root in the workspace! Put it into thr workspace now.
- if (workspaceNode == null)
- {
- NodeSPI node = dataContainer.getRoot();
- workspaceNode = lockAndCreateWorkspaceNode(nodeFactory, node, workspace, gtx, lockAcquisitionTimeout);
- workspace.addNode(workspaceNode);
- log.debug("Created root node in workspace.");
- }
- else
- {
- log.debug("Found root node in workspace.");
- }
-
- // iterate through the target Fqn's elements.
- int targetFqnSize = targetFqn.size(), currentDepth = 1;
- for (Object childName : targetFqn.peekElements())
- {
- boolean isTargetFqn = (currentDepth == targetFqnSize);
- currentDepth++;
-
- // current workspace node canot be null.
- // try and get the child of current node
-
- if (debug) log.debug("Attempting to get child " + childName);
- NodeSPI currentNode = workspaceNode.getNode().getChildDirect(childName);
-
- if (currentNode == null)
- {
- // first test that it exists in the workspace and has been created in thix tx!
- WorkspaceNode peekInWorkspace = workspace.getNode(Fqn.fromRelativeElements(workspaceNode.getFqn(), childName));
- if (peekInWorkspace != null && peekInWorkspace.isCreated())
- {
- // exists in workspace and has just been created.
- currentNode = peekInWorkspace.getNode();
- if (peekInWorkspace.isRemoved())
- {
- peekInWorkspace.setRemoved(false);
- // add in parent again
- workspaceNode.addChild(peekInWorkspace);
- }
- }
- }
-
- if (currentNode == null)
- {
- // no child exists with this name; create it in the underlying data structure and then add it to the workspace.
- if (trace) log.trace("Creating new child, since it doesn't exist in the cache.");
- // we put the parent node into the workspace as we are changing its children.
- // at this point "workspaceNode" refers to the parent of the current node. It should never be null if
- // you got this far!
- if (workspaceNode.isRemoved())
- {
- //add a new one or overwrite an existing one that has been deleted
- if (trace)
- log.trace("Parent node doesn't exist in workspace or has been deleted. Adding to workspace.");
- workspace.addNode(workspaceNode);
- if (!(workspaceNode.getVersion() instanceof DefaultDataVersion))
- workspaceNode.setVersioningImplicit(false);
- }
- else
- {
- if (trace) log.trace("Parent node exists: " + workspaceNode);
- }
-
- // get the version passed in, if we need to use explicit versioning.
- DataVersion versionToPassIn = null;
- if (isTargetFqn && !workspace.isVersioningImplicit()) versionToPassIn = version;
-
- NodeSPI newUnderlyingChildNode = workspaceNode.createChild(childName, workspaceNode.getNode(), cache, versionToPassIn);
-
- // now assign "workspaceNode" to the new child created.
- workspaceNode = lockAndCreateWorkspaceNode(nodeFactory, newUnderlyingChildNode, workspace, gtx, lockAcquisitionTimeout);
- workspaceNode.setVersioningImplicit(versionToPassIn == null || !isTargetFqn);
- if (trace)
- log.trace("setting versioning of " + workspaceNode.getFqn() + " to be " + (workspaceNode.isVersioningImplicit() ? "implicit" : "explicit"));
-
- // now add the wrapped child node into the transaction space
- workspace.addNode(workspaceNode);
- workspaceNode.markAsCreated();
- // save in list so we can broadcast our created nodes outside
- // the synch block
- nodesCreated.add(workspaceNode.getFqn());
- }
- else
- {
- // node does exist but might not be in the workspace
- workspaceNode = workspace.getNode(currentNode.getFqn());
- // wrap it up so we can put it in later if we need to
- if (workspaceNode == null)
- {
- if (trace)
- log.trace("Child node " + currentNode.getFqn() + " doesn't exist in workspace or has been deleted. Adding to workspace in gtx " + gtx);
-
- workspaceNode = lockAndCreateWorkspaceNode(nodeFactory, currentNode, workspace, gtx, lockAcquisitionTimeout);
-
- // if the underlying node is a tombstone then mark the workspace node as newly created
- if (!currentNode.isValid()) workspaceNode.markAsCreated();
-
- if (isTargetFqn && !workspace.isVersioningImplicit())
- {
- workspaceNode.setVersion(version);
- workspaceNode.setVersioningImplicit(false);
- }
- else
- {
- workspaceNode.setVersioningImplicit(true);
- }
- if (trace)
- log.trace("setting versioning of " + workspaceNode.getFqn() + " to be " + (workspaceNode.isVersioningImplicit() ? "implicit" : "explicit"));
- workspace.addNode(workspaceNode);
- }
- else if (workspaceNode.isRemoved())
- {
- if (trace) log.trace("Found node but it is deleted in this workspace. Needs resurrecting.");
- undeleteWorkspaceNode(workspaceNode, workspace);
- }
- else
- {
- if (trace) log.trace("Found child node in the workspace: " + currentNode);
-
- }
- }
- }
-
- if (!suppressNotification)
- {
- if (nodesCreated.size() > 0)
- {
- Notifier n = cache.getNotifier();
- for (Fqn temp : nodesCreated)
- {
- n.notifyNodeCreated(temp, true, ctx);
- n.notifyNodeCreated(temp, false, ctx);
- if (trace) log.trace("Notifying cache of node created in workspace " + temp);
- }
- }
- }
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,152 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeFactory;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.CommandInterceptor;
-import org.jboss.cache.lock.LockManager;
-import static org.jboss.cache.lock.LockType.READ;
-import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.OptimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionTable;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.List;
-
-/**
- * Abstract interceptor for optimistic locking
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public abstract class OptimisticInterceptor extends CommandInterceptor
-{
- protected TransactionManager txManager;
- protected TransactionTable txTable;
- protected LockManager lockManager;
-
- @Inject
- private void injectDependencies(TransactionManager txManager, TransactionTable txTable, LockManager lockManager)
- {
- this.txManager = txManager;
- this.txTable = txTable;
- this.lockManager = lockManager;
- }
-
- protected TransactionWorkspace getTransactionWorkspace(InvocationContext ctx) throws CacheException
- {
- OptimisticTransactionContext transactionContext = (OptimisticTransactionContext) ctx.getTransactionContext();
-
- if (transactionContext == null)
- {
- throw new CacheException("Unable to map global transaction " + ctx.getGlobalTransaction() + " to transaction entry when trying to retrieve transaction workspace.");
- }
-
- // try and get the workspace from the transaction
- return transactionContext.getTransactionWorkSpace();
- }
-
- /**
- * Adds the Fqn of the node as well as all children and childrens children to the list.
- */
- protected void greedyGetFqns(List<Fqn> list, NodeSPI<?, ?> n, Fqn newBase)
- {
- list.add(n.getFqn());
- Fqn newFqn = Fqn.fromRelativeElements(newBase, n.getFqn().getLastElement());
- list.add(newFqn);
-
- for (NodeSPI child : n.getChildrenDirect())
- {
- greedyGetFqns(list, child, newFqn);
- }
- }
-
- /**
- * @return the {@link org.jboss.cache.transaction.GlobalTransaction}, extracted from the current {@link org.jboss.cache.InvocationContext}.
- * @throws CacheException if the {@link org.jboss.cache.transaction.GlobalTransaction} or {@link javax.transaction.Transaction} associated with the
- * {@link org.jboss.cache.InvocationContext} is null.
- */
- protected GlobalTransaction getGlobalTransaction(InvocationContext ctx) throws CacheException
- {
- Transaction tx = ctx.getTransaction();
- if (tx == null) throw new CacheException("Transaction associated with the current invocation is null!");
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- if (gtx == null) throw new CacheException("GlobalTransaction associated with the current invocation is null!");
- return gtx;
- }
-
- protected void undeleteWorkspaceNode(WorkspaceNode nodeToUndelete, TransactionWorkspace workspace)
- {
- undeleteWorkspaceNode(nodeToUndelete, workspace.getNode(nodeToUndelete.getFqn().getParent()));
- }
-
- /**
- * Undeletes a node that already exists in the workspace, by setting appropriate flags and re-adding to parent's child map.
- *
- * @param nodeToUndelete WorkspaceNode to undelete
- * @param parent parent of node to undelete
- */
- @SuppressWarnings("unchecked")
- protected void undeleteWorkspaceNode(WorkspaceNode nodeToUndelete, WorkspaceNode parent)
- {
- nodeToUndelete.setRemoved(false);
- nodeToUndelete.clearData();
- // add in parent again
- parent.addChild(nodeToUndelete);
- nodeToUndelete.markAsResurrected(true);
- }
-
- @SuppressWarnings("unchecked")
- protected WorkspaceNode lockAndCreateWorkspaceNode(NodeFactory<?, ?> nodeFactory, NodeSPI node, TransactionWorkspace<?, ?> workspace, GlobalTransaction gtx, long timeout)
- {
- boolean locked;
- try
- {
- locked = lockManager.lock(node, READ, gtx, timeout);
- }
- catch (InterruptedException e)
- {
- // test if we acquired the lock
- locked = lockManager.getReadOwners(node).contains(gtx);
- }
-
- if (!locked)
- throw new TimeoutException("Unable to lock node " + node.getFqn() + " after timeout " + timeout + " for copying into workspace");
-
- WorkspaceNode<?, ?> wn = nodeFactory.createWrappedNode(node, workspace);
-
- lockManager.unlock(node, gtx);
- return wn;
- }
-
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,156 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.factories.annotations.Start;
-import static org.jboss.cache.lock.LockType.READ;
-import static org.jboss.cache.lock.LockType.WRITE;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.BatchModeTransactionManager;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionContext;
-
-/**
- * Locks nodes during transaction boundaries. Only affects prepare/commit/rollback method calls; other method calls
- * are simply passed up the interceptor stack.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticLockingInterceptor extends OptimisticInterceptor
-{
- @Start
- private void init()
- {
- if (txManager == null || txManager.getClass().equals(BatchModeTransactionManager.class))
- log.fatal("No transaction manager lookup class has been defined. Transactions cannot be used and thus OPTIMISTIC locking cannot be used! Expect errors!!");
- }
-
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- //try and acquire the locks - before passing on
- GlobalTransaction gtx = getGlobalTransaction(ctx);
-
- boolean succeeded = false;
- try
- {
- TransactionWorkspace<?, ?> workspace = getTransactionWorkspace(ctx);
- if (log.isDebugEnabled()) log.debug("Locking nodes in transaction workspace for GlobalTransaction " + gtx);
-
- for (WorkspaceNode workspaceNode : workspace.getNodes().values())
- {
- NodeSPI node = workspaceNode.getNode();
-
- boolean isWriteLockNeeded = workspaceNode.isDirty() || (workspaceNode.isChildrenModified() && (configuration.isLockParentForChildInsertRemove() || node.isLockForChildInsertRemove()));
-
- boolean acquired = lockManager.lockAndRecord(node, isWriteLockNeeded ? WRITE : READ, ctx);
- if (acquired)
- {
- if (trace) log.trace("Acquired lock on node " + node.getFqn());
- }
- else
- {
- throw new CacheException("Unable to acquire lock on node " + node.getFqn());
- }
-
- }
-
- // locks have acquired so lets pass on up
- Object retval = invokeNextInterceptor(ctx, command);
- succeeded = true;
- return retval;
- }
- catch (Throwable e)
- {
- succeeded = false;
- log.debug("Caught exception attempting to lock nodes ", e);
- //we have failed - set to rollback and throw exception
- throw e;
- }
- finally
- {
- if (!succeeded) unlock(ctx);
- }
- }
-
- @Override
- public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
- {
- return transactionFinalized(ctx, command);
- }
-
- @Override
- public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
- {
- return transactionFinalized(ctx, command);
- }
-
- private Object transactionFinalized(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- Object retval = null;
- // we need to let the stack run its commits or rollbacks first -
- // we unlock last - even if an exception occurs
- try
- {
- retval = invokeNextInterceptor(ctx, command);
- }
- finally
- {
- unlock(ctx);
- }
- return retval;
- }
-
- /**
- * Releases all locks held by the specified global transaction.
- *
- * @param ctx Invocation Context
- */
- private void unlock(InvocationContext ctx)
- {
- try
- {
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (transactionContext != null)
- {
- lockManager.unlock(ctx);
- }
- }
- catch (Exception e)
- {
- // we have failed to unlock - now what?
- log.error("Failed to unlock nodes after a commit or rollback! Locks are possibly in a very inconsistent state now!", e);
- }
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,617 +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.interceptors;
-
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeFactory;
-import org.jboss.cache.NodeNotExistsException;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetDataMapCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.notifications.Notifier;
-import static org.jboss.cache.notifications.event.NodeModifiedEvent.ModificationType.*;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.GlobalTransaction;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.SortedMap;
-
-/**
- * Operations on nodes are done on the copies that exist in the workspace rather than passed down
- * to the {@link org.jboss.cache.interceptors.CallInterceptor}. These operations happen in this interceptor.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticNodeInterceptor extends OptimisticInterceptor
-{
- /**
- * Needed for the creation of workspace nodes based on underlying nodes in the cache.
- */
- private NodeFactory nodeFactory;
- private Notifier notifier;
- private DataContainer dataContainer;
- private long lockAcquisitionTimeout;
-
- @Inject
- protected void injectDependencies(Notifier notifier, NodeFactory nodeFactory, DataContainer dataContainer)
- {
- this.notifier = notifier;
- this.nodeFactory = nodeFactory;
- this.dataContainer = dataContainer;
- }
-
- @Start
- private void init()
- {
- lockAcquisitionTimeout = configuration.getLockAcquisitionTimeout();
- }
-
- public OptimisticNodeInterceptor()
- {
- log = LogFactory.getLog(getClass());
- trace = log.isTraceEnabled();
- }
-
- @Override
- public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, true);
- if (workspaceNode != null)
- {
- setVersioning(ctx, workspace, workspaceNode);
- }
- Object result = removeNode(workspace, workspaceNode, true, ctx);
- addToModificationList(command, ctx);
- return result;
- }
-
- @Override
- public Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- return visitPutKeyValueCommand(ctx, command);
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
- if (workspaceNode != null)
- {
- setVersioning(ctx, workspace, workspaceNode);
- }
- else
- {
- // "fail-more-silently" patch thanks to Owen Taylor - JBCACHE-767
- if ((ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently()))
- {
- throw new CacheException("Unable to set node version for " + command.getFqn() + ", node is null.");
- }
- }
- Object result = putDataKeyValueAndNotify(command.getKey(), command.getValue(), workspace, workspaceNode, ctx);
- addToModificationList(command, ctx);
- return result;
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
- if (workspaceNode != null)
- {
- setVersioning(ctx, workspace, workspaceNode);
- }
- else
- {
- // "fail-more-silently" patch thanks to Owen Taylor - JBCACHE-767
- if ((ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently()))
- {
- throw new CacheException("Unable to set node version for " + command.getFqn() + ", node is null.");
- }
- }
- putDataMapAndNotify(command.getData(), workspace, workspaceNode, ctx);
- addToModificationList(command, ctx);
- return null;
- }
-
-
- @Override
- public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
- if (ctx.isOriginLocal() && ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
- {
- throw new CacheException("Setting a data version while performing a move() is not supported!!");
- }
- if (workspaceNode != null)
- {
- setVersioning(ctx, workspace, workspaceNode);
- }
- moveNodeAndNotify(command.getTo(), workspaceNode, workspace, ctx);
- addToModificationList(command, ctx);
- return null;
- }
-
- @Override
- public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
-
- if (workspaceNode != null)
- {
- setVersioning(ctx, workspace, workspaceNode);
- }
- Object result = removeKeyAndNotify(command.getKey(), workspace, workspaceNode, ctx);
- addToModificationList(command, ctx);
- return result;
- }
-
- @Override
- public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, true, true);
- if (workspaceNode != null)
- {
- setVersioning(ctx, workspace, workspaceNode);
- }
- removeDataAndNotify(workspace, workspaceNode, ctx);
- addToModificationList(command, ctx);
- return null;
- }
-
- @Override
- public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- Object result;
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
-
- if (workspaceNode == null)
- {
- if (trace) log.debug("Unable to find node " + command.getFqn() + " in workspace.");
- result = null;
- }
- else
- {
- //add this node into the wrokspace
- notifier.notifyNodeVisited(command.getFqn(), true, ctx);
- Object val = workspaceNode.get(command.getKey());
- workspace.addNode(workspaceNode);
- notifier.notifyNodeVisited(command.getFqn(), false, ctx);
- result = val;
- }
- return result;
- }
-
- @Override
- public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- Object result;
- Fqn fqn = command.getFqn();
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, fqn, workspace, false, false);
- if (workspaceNode == null)
- {
- if (trace) log.trace("unable to find node " + fqn + " in workspace.");
- result = null;
- }
- else
- {
- notifier.notifyNodeVisited(fqn, true, ctx);
- Object keySet = workspaceNode.getKeys();
- workspace.addNode(workspaceNode);
- notifier.notifyNodeVisited(fqn, false, ctx);
- result = keySet;
- }
- return result;
- }
-
- @Override
- public Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- Object result;
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
- if (workspaceNode == null)
- {
- if (trace) log.trace("unable to find node " + command.getFqn() + " in workspace.");
- result = null;
- }
- else
- {
- notifier.notifyNodeVisited(command.getFqn(), true, ctx);
- Object data = workspaceNode.getData();
- workspace.addNode(workspaceNode);
- notifier.notifyNodeVisited(command.getFqn(), false, ctx);
- result = data;
- }
- return result;
- }
-
- @Override
- public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- Object result;
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
- if (workspaceNode == null)
- {
- if (trace) log.trace("Unable to find node " + command.getFqn() + " in workspace.");
- result = null;
- }
- else
- {
- notifier.notifyNodeVisited(command.getFqn(), true, ctx);
- Object nameSet = workspaceNode.getChildrenNames();
- workspace.addNode(workspaceNode);
- notifier.notifyNodeVisited(command.getFqn(), false, ctx);
- result = nameSet;
- }
- return result;
- }
-
- @Override
- public Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
- Object result;
- WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace, false, false);
- if (workspaceNode == null)
- {
- if (trace) log.trace("Unable to find node " + command.getFqn() + " in workspace.");
- result = null;
- }
- else if (workspaceNode.isRemoved())
- {
- if (trace) log.trace("Attempted to retrieve node " + command.getFqn() + " but it has been deleted!");
- result = null;
- }
- else
- {
- notifier.notifyNodeVisited(command.getFqn(), true, ctx);
- workspace.addNode(workspaceNode);
- notifier.notifyNodeVisited(command.getFqn(), false, ctx);
- result = workspaceNode.getNode();
- }
- return result;
- }
-
- private void setVersioning(InvocationContext ctx, TransactionWorkspace workspace, WorkspaceNode workspaceNode)
- {
- // use explicit versioning
- if (ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
- {
- workspace.setVersioningImplicit(false);
- DataVersion version = ctx.getOptionOverrides().getDataVersion();
-
- workspaceNode.setVersion(version);
- if (trace) log.trace("Setting versioning for node " + workspaceNode.getFqn() + " to explicit");
-
- workspaceNode.setVersioningImplicit(false);
- }
- else
- {
- if (trace) log.trace("Setting versioning for node " + workspaceNode.getFqn() + " to implicit");
- workspaceNode.setVersioningImplicit(true);
- }
- }
-
- /**
- * Retrieves a backup fqn in an array of arguments. This is typically used to parse arguments from a data gravitation cleanup method.
- *
- * @param args array of arguments to parse
- * @return an Fqn
- */
- private Fqn getBackupFqn(Object[] args)
- {
- return (Fqn) args[1];
- }
-
- /**
- * Adds a method call to the modification list of a given transaction's transaction entry
- */
- private void addToModificationList(WriteCommand command, InvocationContext ctx)
- {
- // Option opt = ctx.getOptionOverrides();
- ctx.getTransactionContext().addModification(command);
- if (log.isDebugEnabled()) log.debug("Adding command " + command + " to modification list");
- }
-
- // -----------------------------------------------------------------
-
- // Methods that mimic core functionality in the cache, except that they work on WorkspaceNodes in the TransactionWorkspace.
-
- // -----------------------------------------------------------------
-
-
- /**
- * Performs a move within the workspace.
- *
- * @param parentFqn parent under which the node is to be moved
- * @param node node to move
- * @param ws transaction workspace
- * @param ctx
- */
- private void moveNodeAndNotify(Fqn parentFqn, WorkspaceNode node, TransactionWorkspace ws, InvocationContext ctx)
- {
- Fqn nodeFqn = node.getFqn();
- if (nodeFqn.isRoot())
- {
- log.warn("Attempting to move the root node. Not taking any action, treating this as a no-op.");
- return;
- }
-
- WorkspaceNode oldParent = fetchWorkspaceNode(ctx, nodeFqn.getParent(), ws, false, true);
- if (oldParent == null) throw new NodeNotExistsException("Node " + nodeFqn.getParent() + " does not exist!");
-
- if (parentFqn.equals(oldParent.getFqn()))
- {
- log.warn("Attempting to move a node in same place. Not taking any action, treating this as a no-op.");
- return;
- }
- // retrieve parent
- WorkspaceNode parent = fetchWorkspaceNode(ctx, parentFqn, ws, false, true);
- if (parent == null) throw new NodeNotExistsException("Node " + parentFqn + " does not exist!");
-
- Object nodeName = nodeFqn.getLastElement();
-
- // now that we have the parent and target nodes:
- // first correct the pointers at the pruning point
- oldParent.removeChild(nodeName);
-
- // parent pointer is calculated on the fly using Fqns.
- // now adjust Fqns of node and all children.
- Fqn nodeNewFqn = Fqn.fromRelativeElements(parent.getFqn(), nodeFqn.getLastElement());
-
- // pre-notify
- notifier.notifyNodeMoved(nodeFqn, nodeNewFqn, true, ctx);
- recursiveMoveNode(ctx, node, parent.getFqn(), ws);
-
- // remove old nodes. this may mark some nodes which have already been moved as deleted
- removeNode(ws, node, false, ctx);
-
- // post-notify
- notifier.notifyNodeMoved(nodeFqn, nodeNewFqn, false, ctx);
- }
-
- /**
- * Moves a node to a new base.
- *
- * @param node node to move
- * @param newBase new base Fqn under which the given node will now exist
- * @param ws transaction workspace
- */
- private void recursiveMoveNode(InvocationContext ctx, WorkspaceNode node, Fqn newBase, TransactionWorkspace ws)
- {
- Fqn newFqn = Fqn.fromRelativeElements(newBase, node.getFqn().getLastElement());
- WorkspaceNode movedNode = fetchWorkspaceNode(ctx, newFqn, ws, true, true);
- movedNode.putAll(node.getData());
-
- // invoke children
- for (Object n : node.getChildrenNames())
- {
- WorkspaceNode child = fetchWorkspaceNode(ctx, Fqn.fromRelativeElements(node.getFqn(), n), ws, false, true);
- if (child != null) recursiveMoveNode(ctx, child, newFqn, ws);
- }
- }
-
- private void putDataMapAndNotify(Map<Object, Object> data, TransactionWorkspace workspace, WorkspaceNode workspaceNode, InvocationContext ctx)
- {
- if (workspaceNode == null)
- throw new NodeNotExistsException("optimisticCreateIfNotExistsInterceptor should have created this node!");
- // pre-notify
- notifier.notifyNodeModified(workspaceNode.getFqn(), true, PUT_MAP, workspaceNode.getData(), ctx);
- workspaceNode.putAll(data);
- workspace.addNode(workspaceNode);
- // post-notify
- notifier.notifyNodeModified(workspaceNode.getFqn(), false, PUT_MAP, workspaceNode.getData(), ctx);
- }
-
- private Object putDataKeyValueAndNotify(Object key, Object value, TransactionWorkspace workspace, WorkspaceNode workspaceNode, InvocationContext ctx)
- {
- if (workspaceNode == null)
- throw new NodeNotExistsException("optimisticCreateIfNotExistsInterceptor should have created this node!");
-
- if (notifier.shouldNotifyOnNodeModified())// pre-notify
- {
- notifier.notifyNodeModified(workspaceNode.getFqn(), true, PUT_DATA, workspaceNode.getData(), ctx);
- }
-
- Object old = workspaceNode.put(key, value);
- workspace.addNode(workspaceNode);
-
- if (notifier.shouldNotifyOnNodeModified())// post-notify
- {
- Map addedData = Collections.singletonMap(key, value);
- notifier.notifyNodeModified(workspaceNode.getFqn(), false, PUT_DATA, addedData, ctx);
- }
-
- return old;
- }
-
- private boolean removeNode(TransactionWorkspace workspace, WorkspaceNode workspaceNode, boolean notify, InvocationContext ctx) throws CacheException
- {
- // it is already removed - we can ignore it
- if (workspaceNode == null) return false;
-
- Fqn parentFqn = workspaceNode.getFqn().getParent();
- WorkspaceNode parentNode = fetchWorkspaceNode(ctx, parentFqn, workspace, false, true);
- if (parentNode == null) throw new NodeNotExistsException("Unable to find parent node with fqn " + parentFqn);
-
- // pre-notify
- if (notify) notifier.notifyNodeRemoved(workspaceNode.getFqn(), true, workspaceNode.getData(), ctx);
-
- Fqn nodeFqn = workspaceNode.getFqn();
- parentNode.removeChild(nodeFqn.getLastElement());
-
- SortedMap<Fqn, WorkspaceNode> tailMap = workspace.getNodesAfter(workspaceNode.getFqn());
-
- for (WorkspaceNode toDelete : tailMap.values())
- {
- if (toDelete.getFqn().isChildOrEquals(nodeFqn))
- {
- if (trace) log.trace("marking node " + toDelete.getFqn() + " as deleted");
- toDelete.setRemoved(true);
- }
- else
- {
- break;// no more children, we came to the end
- }
- }
-
- // post-notify
- if (notify) notifier.notifyNodeRemoved(workspaceNode.getFqn(), false, null, ctx);
- return workspaceNode.getNode().isValid();
- }
-
- private Object removeKeyAndNotify(Object removeKey, TransactionWorkspace workspace, WorkspaceNode workspaceNode, InvocationContext ctx)
- {
- if (workspaceNode == null) return null;
-
- if (notifier.shouldNotifyOnNodeModified())// pre-notify
- {
- notifier.notifyNodeModified(workspaceNode.getFqn(), true, REMOVE_DATA, workspaceNode.getData(), ctx);
- }
-
- Object old = workspaceNode.remove(removeKey);
- workspace.addNode(workspaceNode);
-
- if (notifier.shouldNotifyOnNodeModified())
- {
- Map removedData = Collections.singletonMap(removeKey, old);
- // post-notify
- notifier.notifyNodeModified(workspaceNode.getFqn(), false, REMOVE_DATA, removedData, ctx);
- }
-
- return old;
- }
-
- private void removeDataAndNotify(TransactionWorkspace workspace, WorkspaceNode workspaceNode, InvocationContext ctx)
- {
- if (workspaceNode == null) return;
-
- Map data = new HashMap(workspaceNode.getData());
-
- // pre-notify
- notifier.notifyNodeModified(workspaceNode.getFqn(), true, REMOVE_DATA, data, ctx);
-
- workspaceNode.clearData();
- workspace.addNode(workspaceNode);
-
- // post-notify
- notifier.notifyNodeModified(workspaceNode.getFqn(), false, REMOVE_DATA, data, ctx);
- }
-
- // -----------------------------------------------------------------
-
- // Methods to help retrieval of nodes from the transaction workspace.
-
- // -----------------------------------------------------------------
-
- /**
- * Retrieves a node for a given Fqn from the workspace. If the node does not exist in the workspace it is retrieved
- * from the cache's data structure. Note that at no point is a NEW node created in the underlying data structure.
- * That is up to the {@link org.jboss.cache.interceptors.OptimisticCreateIfNotExistsInterceptor}.
- * <p/>
- * If the node requested is in the workspace but marked as deleted, this method will NOT retrieve it, unless undeleteIfNecessary
- * is true, in which case the node's <tt>deleted</tt> property is set to false first before being retrieved.
- *
- * @param fqn Fqn of the node to retrieve
- * @param workspace transaction workspace to look in
- * @param undeleteIfNecessary if the node is in the workspace but marked as deleted, this meth
- * @param includeInvalidNodes
- * @return a node, if found, or null if not.
- */
- private WorkspaceNode fetchWorkspaceNode(InvocationContext ctx, Fqn fqn, TransactionWorkspace workspace, boolean undeleteIfNecessary, boolean includeInvalidNodes)
- {
- WorkspaceNode workspaceNode = workspace.getNode(fqn);
- // if we do not have the node then we need to add it to the workspace
- if (workspaceNode == null)
- {
- NodeSPI node = dataContainer.peek(fqn, true, includeInvalidNodes);
- if (node == null) return null;
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- workspaceNode = lockAndCreateWorkspaceNode(nodeFactory, node, workspace, gtx, lockAcquisitionTimeout);
-
- // and add the node to the workspace.
- workspace.addNode(workspaceNode);
- }
-
- // Check that the workspace node has been marked as deleted.
- if (workspaceNode.isRemoved())
- {
- if (trace) log.trace("Node " + fqn + " has been deleted in the workspace.");
- if (undeleteIfNecessary)
- {
- undeleteWorkspaceNode(workspaceNode, fetchWorkspaceNode(ctx, fqn.getParent(), workspace, undeleteIfNecessary, includeInvalidNodes));
- }
- else if (!includeInvalidNodes)
- {
- // don't return deleted nodes if undeleteIfNecessary is false!
- workspaceNode = null;
- }
- }
-
- // set implicit node versioning flag.
- if (workspaceNode != null && !(workspaceNode.getVersion() instanceof DefaultDataVersion))
- {
- workspaceNode.setVersioningImplicit(false);
- }
-
- // now make sure all parents are in the wsp as well
- if (workspaceNode != null && !fqn.isRoot())
- fetchWorkspaceNode(ctx, fqn.getParent(), workspace, false, includeInvalidNodes);
-
- return workspaceNode;
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,407 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.commands.VersionedDataCommand;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
-import org.jboss.cache.commands.read.GravitateDataCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.OptimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionContext;
-import org.jboss.cache.util.concurrent.ConcurrentHashSet;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Replication interceptor for the optimistically locked interceptor chain. Responsible for replicating
- * state to remote nodes. Unlike its cousin, the {@link org.jboss.cache.interceptors.ReplicationInterceptor}, this interceptor
- * only deals with transactional calls. Just like all things to do with Optimistic Locking, it is a requirement that
- * everything is done in a transaction and the transaction context is available via {@link org.jboss.cache.InvocationContext#getTransaction()}
- * and {@link org.jboss.cache.InvocationContext#getGlobalTransaction()}.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticReplicationInterceptor extends BaseRpcInterceptor
-{
- /**
- * record of local broacasts - so we do not broadcast rollbacks/commits that resuted from local prepare failures we
- * really just need a set here, but concurrent CopyOnWriteArraySet has poor performance when writing.
- */
- private final Set<GlobalTransaction> broadcastTxs = new ConcurrentHashSet<GlobalTransaction>();
-
- private CommandsFactory commandsFactory;
-
- @Inject
- public void initialize(CommandsFactory commandsFactory)
- {
- this.commandsFactory = commandsFactory;
- }
-
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- // pass up the chain.
- Object retval = invokeNextInterceptor(ctx, command);
- if (!skipReplicationOfTransactionMethod(ctx))
- {
- GlobalTransaction gtx = getGlobalTransaction(ctx);
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (transactionContext.hasLocalModifications())
- {
- OptimisticPrepareCommand replicablePrepareCommand = command.copy(); // makre sure we remove any "local" transactions
- replicablePrepareCommand.removeModifications(transactionContext.getLocalModifications());
- command = replicablePrepareCommand;
- }
-
- // replicate the prepare call.
- broadcastPrepare(command, gtx, ctx);
- }
- return retval;
- }
-
- @Override
- public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
- {
- //lets broadcast the commit first
- Throwable remoteCommitException = null;
- GlobalTransaction gtx = getGlobalTransaction(ctx);
- if (!gtx.isRemote() && ctx.isOriginLocal() && broadcastTxs.contains(gtx))
- {
- try
- {
- if (!skipReplicationOfTransactionMethod(ctx)) broadcastCommit(gtx, ctx);
- }
- catch (Throwable t)
- {
- log.error("A problem occurred with remote commit", t);
- remoteCommitException = t;
- }
- }
-
- Object retval = invokeNextInterceptor(ctx, command);
- if (remoteCommitException != null)
- {
- throw remoteCommitException;
- }
- return retval;
- }
-
- @Override
- public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
- {
- // lets broadcast the rollback first
- GlobalTransaction gtx = getGlobalTransaction(ctx);
- Throwable remoteRollbackException = null;
- if (!gtx.isRemote() && ctx.isOriginLocal() && broadcastTxs.contains(gtx))
- {
- //we dont do anything
- try
- {
- if (!skipReplicationOfTransactionMethod(ctx)) broadcastRollback(gtx, ctx);
- }
- catch (Throwable t)
- {
- log.error(" a problem occurred with remote rollback", t);
- remoteRollbackException = t;
- }
-
- }
- Object retval = invokeNextInterceptor(ctx, command);
- if (remoteRollbackException != null)
- {
- throw remoteRollbackException;
- }
- return retval;
- }
-
- @Override
- public Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- ctx.getTransactionContext().setForceAsyncReplication(true);
- return handleDefault(ctx, command);
- }
-
- public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- if (isLocalModeForced(ctx) && command instanceof WriteCommand)
- ctx.getTransactionContext().addLocalModification((WriteCommand) command);
- return invokeNextInterceptor(ctx, command);
- }
-
-
- private GlobalTransaction getGlobalTransaction(InvocationContext ctx)
- {
- // get the current globalTransaction
- GlobalTransaction gtx = ctx.getGlobalTransaction();
- if (gtx == null)
- {
- throw new CacheException("failed to get global transaction");
- }
- return gtx;
- }
-
- protected void broadcastPrepare(OptimisticPrepareCommand command, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
- {
- // this method will return immediately if we're the only member
- if (rpcManager.getMembers() != null && rpcManager.getMembers().size() > 1)
- {
- // Map method calls to data versioned equivalents.
- // See JBCACHE-843 and docs/design/DataVersioning.txt
- DataVersionPopulator populator = new DataVersionPopulator(getTransactionWorkspace(ctx), command.getModifications().size());
-
- // visit all elements in the collection and apply the DataVersionPopulator to ensure all commands have data versions set.
- populator.visitCollection(null, command.getModifications());
-
- ReplicableCommand toBroadcast = commandsFactory.buildOptimisticPrepareCommand(gtx, populator.versionedCommands, command.getLocalAddress(), command.isOnePhaseCommit());
-
- //record the things we have possibly sent
- broadcastTxs.add(gtx);
- if (log.isDebugEnabled())
- {
- log.debug("(" + rpcManager.getLocalAddress() + "): broadcasting prepare for " + gtx + " (" + command.getModificationsCount() + " modifications");
- }
- replicateCall(ctx, toBroadcast, defaultSynchronous, ctx.getOptionOverrides());
- }
- else
- {
- //no members, ignoring
- if (log.isDebugEnabled())
- {
- log.debug("(" + rpcManager.getLocalAddress() + "):not broadcasting prepare as members are " + rpcManager.getMembers());
- }
- }
- }
-
-
- protected void broadcastCommit(GlobalTransaction gtx, InvocationContext ctx) throws Throwable
- {
- boolean remoteCallSync = configuration.isSyncCommitPhase();
-
- // Broadcast commit() to all members (exclude myself though)
- if (rpcManager.getMembers() != null && rpcManager.getMembers().size() > 1)
- {
- try
- {
- broadcastTxs.remove(gtx);
- CommitCommand commitCommand = commandsFactory.buildCommitCommand(gtx);
-
- if (log.isDebugEnabled())
- log.debug("running remote commit for " + gtx + " and coord=" + rpcManager.getLocalAddress());
-
- // for an optimistic commit we don't need to force an OOB message since O/L means we have non-blocking reads.
- replicateCall(ctx, commitCommand, remoteCallSync, ctx.getOptionOverrides(), false);
- }
- catch (Exception e)
- {
- log.error("Commit failed", e);
- throw e;
- }
- }
- }
-
- protected void broadcastRollback(GlobalTransaction gtx, InvocationContext ctx) throws Throwable
- {
- boolean remoteCallSync = configuration.isSyncRollbackPhase();
-
- if (rpcManager.getMembers() != null && rpcManager.getMembers().size() > 1)
- {
- // Broadcast rollback() to all other members (excluding myself)
- try
- {
- broadcastTxs.remove(gtx);
- RollbackCommand rollbackCommand = commandsFactory.buildRollbackCommand(null);
-
- if (log.isDebugEnabled())
- log.debug("running remote rollback for " + gtx + " and coord=" + rpcManager.getLocalAddress());
- replicateCall(ctx, rollbackCommand, remoteCallSync, ctx.getOptionOverrides());
- }
- catch (Exception e)
- {
- log.error("Rollback failed", e);
- throw e;
- }
- }
- }
-
- public class DataVersionPopulator extends AbstractVisitor
- {
- final TransactionWorkspace workspace;
- final List<WriteCommand> versionedCommands;
-
- public DataVersionPopulator(TransactionWorkspace workspace, int numCommands)
- {
- this.workspace = workspace;
- versionedCommands = new ArrayList<WriteCommand>(numCommands);
- }
-
- private void setDataVersion(VersionedDataCommand clone, Fqn fqn)
- {
- DataVersion versionToBroadcast = getVersionToBroadcast(workspace, fqn);
- clone.setDataVersion(versionToBroadcast);
- versionedCommands.add(clone);
- }
-
- @Override
- public Object visitGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command) throws Throwable
- {
- return command;
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- VersionedDataCommand clone = commandsFactory.buildPutDataMapCommand(null, command.getFqn(), command.getData());
- setDataVersion(clone, command.getFqn());
- return null;
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- VersionedDataCommand clone = commandsFactory.buildPutKeyValueCommand(null, command.getFqn(), command.getKey(), command.getValue());
- setDataVersion(clone, command.getFqn());
- return null;
- }
-
- @Override
- public Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- VersionedDataCommand clone = commandsFactory.buildPutForExternalReadCommand(null, command.getFqn(), command.getKey(), command.getValue());
- setDataVersion(clone, command.getFqn());
- return null;
- }
-
- @Override
- public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
- {
- VersionedDataCommand clone = commandsFactory.buildRemoveNodeCommand(command.getGlobalTransaction(), command.getFqn());
- setDataVersion(clone, command.getFqn());
- return null;
- }
-
- @Override
- public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
- {
- VersionedDataCommand clone = commandsFactory.buildRemoveKeyCommand(null, command.getFqn(), command.getKey());
- setDataVersion(clone, command.getFqn());
- return null;
- }
-
- @Override
- public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
- {
- VersionedDataCommand clone = commandsFactory.buildClearDataCommand(command.getGlobalTransaction(), command.getFqn()
- );
- setDataVersion(clone, command.getFqn());
- return null;
- }
-
- @Override
- public Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command) throws Throwable
- {
- versionedCommands.add(command);
- return command;
- }
-
- @Override
- public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
- {
- versionedCommands.add(command);
- return command;
- }
-
- @Override
- public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- throw new CacheException("Not handling " + command + "!");
- }
-
- /**
- * Digs out the DataVersion for a given Fqn. If the versioning is explicit, it is passed as-is. If implicit, it is
- * cloned and then incremented, and the clone is returned.
- */
- private DataVersion getVersionToBroadcast(TransactionWorkspace w, Fqn f)
- {
- WorkspaceNode n = w.getNode(f);
- if (n == null)
- {
- if (trace) log.trace("Fqn " + f + " not found in workspace; not using a data version.");
- return null;
- }
- if (n.isVersioningImplicit())
- {
- DefaultDataVersion v = (DefaultDataVersion) n.getVersion();
- if (trace)
- log.trace("Fqn " + f + " has implicit versioning. Broadcasting an incremented version.");
-
- // potential bug here - need to check if we *need* to increment at all, because of Configuration.isLockParentForChildInsertRemove()
- return v.increment();
- }
- else
- {
- if (trace) log.trace("Fqn " + f + " has explicit versioning. Broadcasting the version as-is.");
- return n.getVersion();
- }
- }
-
- }
-
- protected TransactionWorkspace getTransactionWorkspace(InvocationContext ctx) throws CacheException
- {
- OptimisticTransactionContext transactionContext = (OptimisticTransactionContext) ctx.getTransactionContext();
- if (transactionContext == null)
- {
- throw new CacheException("unable to map global transaction " + ctx + " to transaction entry");
- }
- // try and get the workspace from the transaction
- return transactionContext.getTransactionWorkSpace();
- }
-
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticTxInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,244 +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.interceptors;
-
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.commands.AbstractVisitor;
-import org.jboss.cache.commands.VersionedDataCommand;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.OptimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionContext;
-
-import javax.transaction.Transaction;
-import java.util.List;
-
-/**
- * A new interceptor to simplify functionality in the {@link org.jboss.cache.interceptors.TxInterceptor}.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 2.2.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticTxInterceptor extends TxInterceptor
-{
- protected final ModificationsReplayVisitor replayVisitor = new ModificationsReplayVisitor();
-
- public OptimisticTxInterceptor()
- {
- optimistic = true;
- }
-
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- // nothing really different from a pessimistic prepare command.
- return visitPrepareCommand(ctx, command);
- }
-
- @Override
- public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- try
- {
- Transaction tx = ctx.getTransaction();
- boolean implicitTransaction = tx == null;
- if (implicitTransaction)
- {
- tx = createLocalTx();
- // we need to attach this tx to the InvocationContext.
- ctx.setTransaction(tx);
- }
-
- try
- {
- Object retval = attachGtxAndPassUpChain(ctx, command);
- if (implicitTransaction)
- {
- copyInvocationScopeOptionsToTxScope(ctx);
- copyForcedCacheModeToTxScope(ctx);
- txManager.commit();
- }
- return retval;
- }
- catch (Throwable t)
- {
- if (implicitTransaction)
- {
- log.warn("Rolling back, exception encountered", t);
- try
- {
- copyInvocationScopeOptionsToTxScope(ctx);
- copyForcedCacheModeToTxScope(ctx);
- txManager.rollback();
- }
- catch (Throwable th)
- {
- log.warn("Roll back failed encountered", th);
- }
- throw t;
- }
- }
- }
- catch (Throwable th)
- {
- ctx.throwIfNeeded(th);
- }
-
- return null;
- }
-
- private void copyForcedCacheModeToTxScope(InvocationContext ctx)
- {
- Option optionOverride = ctx.getOptionOverrides();
- if (optionOverride != null
- && (optionOverride.isForceAsynchronous() || optionOverride.isForceSynchronous()))
- {
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (transactionContext != null)
- {
- if (optionOverride.isForceAsynchronous())
- transactionContext.setForceAsyncReplication(true);
- else
- transactionContext.setForceSyncReplication(true);
- }
- }
- }
-
- @Override
- protected PrepareCommand buildPrepareCommand(GlobalTransaction gtx, List modifications, boolean onePhaseCommit)
- {
- // optimistic locking NEVER does one-phase prepares.
- return commandsFactory.buildOptimisticPrepareCommand(gtx, modifications, rpcManager.getLocalAddress(), false);
- }
-
- /**
- * Replays modifications by passing them up the interceptor chain.
- *
- * @throws Throwable
- */
- @Override
- protected void replayModifications(InvocationContext ctx, Transaction ltx, PrepareCommand command) throws Throwable
- {
- if (log.isDebugEnabled()) log.debug("Handling optimistic remote prepare " + ctx.getGlobalTransaction());
-
- // invoke all modifications by passing them up the chain, setting data versions first.
- try
- {
- replayVisitor.visitCollection(ctx, command.getModifications());
- }
- catch (Throwable t)
- {
- log.error("Prepare failed!", t);
- throw t;
- }
- }
-
- @Override
- protected void cleanupStaleLocks(InvocationContext ctx) throws Throwable
- {
- super.cleanupStaleLocks(ctx);
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (transactionContext != null)
- {
- ((OptimisticTransactionContext) transactionContext).getTransactionWorkSpace().clearNodes();
- }
- }
-
- private class ModificationsReplayVisitor extends AbstractVisitor
- {
- @Override
- public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
- {
- Object result = invokeNextInterceptor(ctx, command);
- assertTxIsStillValid(ctx.getTransaction());
- return result;
- }
-
- @Override
- public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- return handleDataVersionCommand(ctx, command);
- }
-
- @Override
- public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- return handleDataVersionCommand(ctx, command);
- }
-
- @Override
- public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
- {
- return handleDataVersionCommand(ctx, command);
- }
-
- @Override
- public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
- {
- return handleDataVersionCommand(ctx, command);
- }
-
- @Override
- public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
- {
- return handleDataVersionCommand(ctx, command);
- }
-
- private Object handleDataVersionCommand(InvocationContext ctx, VersionedDataCommand command) throws Throwable
- {
- Option originalOption = ctx.getOptionOverrides();
- if (command.isVersioned())
- {
- Option option = new Option();
- option.setDataVersion(command.getDataVersion());
- ctx.setOptionOverrides(option);
- }
- Object retval;
- try
- {
- retval = invokeNextInterceptor(ctx, command);
- assertTxIsStillValid(ctx.getTransaction());
- }
- catch (Throwable t)
- {
- log.error("method invocation failed", t);
- throw t;
- }
- finally
- {
- ctx.setOptionOverrides(originalOption);
- }
- return retval;
- }
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,305 +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.interceptors;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import static org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.optimistic.DataVersioningException;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.WorkspaceNode;
-import org.jboss.cache.transaction.GlobalTransaction;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Validates the data in the {@link TransactionWorkspace} against data in the underlying data structure
- * (versions only) and then applies changes to the underlying data structure. This is only triggered when commit,
- * rollback or prepare method calls are encountered. Other method calls are directly passed up the interceptor chain,
- * untouched. Note that prepare/commit/rollbacks are <b>not</b> passed up the interceptor chain after being processed.
- * <p/>
- * When preparting, this interceptor does nothing more than validate versions.
- * The validation scheme used is based on the {@link org.jboss.cache.optimistic.DataVersion} implementation used.
- * {@link org.jboss.cache.optimistic.DataVersion#newerThan(org.jboss.cache.optimistic.DataVersion)} is used to determine
- * whether the version of one instance is newer than the version of another. It is up to the {@link org.jboss.cache.optimistic.DataVersion}
- * implementation to deal with attempting to compare incompatible version types (and potentially throwing {@link org.jboss.cache.optimistic.DataVersioningException}s.
- * <p/>
- * Upon successful commit, changes in the workspace are applied to the underlying data structure in the cache.
- * <p/>
- * On rollback clears the nodes in the workspace and leaves the underlying data structure untouched.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @author Steve Woodcock (<a href="mailto:stevew at jofti.com">stevew at jofti.com</a>)
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticValidatorInterceptor extends OptimisticInterceptor
-{
- private boolean useTombstones;
-
- private DataContainer dataContainer;
-
- @Inject
- public void initialize(DataContainer dataContainer)
- {
- this.dataContainer = dataContainer;
- }
-
- @Inject
- private void init()
- {
- CacheMode mode = configuration.getCacheMode();
- useTombstones = (mode == CacheMode.INVALIDATION_ASYNC) || (mode == CacheMode.INVALIDATION_SYNC);
- }
-
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- TransactionWorkspace workspace = getTransactionWorkspace(ctx);
-
- // There is no guarantee that this collection is in any order!
- Collection<WorkspaceNode> nodes = workspace.getNodes().values();
-
- //we ought to have all necessary locks here so lets try and validate
- if (log.isDebugEnabled()) log.debug("Validating " + nodes.size() + " nodes.");
- for (WorkspaceNode workspaceNode : nodes)
- {
- if (workspaceNode.isDirty())
- {
- Fqn fqn = workspaceNode.getFqn();
- if (trace) log.trace("Validating version for node [" + fqn + "]");
-
- NodeSPI underlyingNode;
- underlyingNode = dataContainer.peek(fqn, true, true);
-
- // if this is a newly created node then we expect the underlying node to be null.
- // also, if the node has been deleted in the WS and the underlying node is null, this *may* be ok ... will test again later when comparing versions
- // if not, we have a problem...
- if (underlyingNode == null && !workspaceNode.isCreated() && !workspaceNode.isRemoved())
- {
- throw new DataVersioningException("Underlying node for " + fqn + " is null, and this node wasn't newly created in this transaction! We have a concurrent deletion event.");
- }
-
- // needs to have been created AND modified - we allow concurrent creation if no data is put into the node
- if (underlyingNode != null && underlyingNode.isValid() && workspaceNode.isCreated() && workspaceNode.isModified())
- {
- throw new DataVersioningException("Transaction attempted to create " + fqn + " anew. It has already been created since this transaction started, by another (possibly remote) transaction. We have a concurrent creation event.");
- }
-
- if (underlyingNode != null && !underlyingNode.isValid())
- {
- // we havea tombstone
- if (!workspaceNode.isCreated() && !workspaceNode.isRemoved())
- throw new DataVersioningException("Underlying node doesn't exist but a tombstone does; workspace node should be marked as created!");
- if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
- {
- // we have an out of date node here
- throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
- }
- }
-
- if (!workspaceNode.isCreated() && (workspaceNode.isRemoved() || workspaceNode.isModified()))
- {
- // if the real node is null, throw a DVE
- if (underlyingNode == null)
- {
- // but not if the WSN has also been deleted
- if (!workspaceNode.isRemoved())
- throw new DataVersioningException("Unable to compare versions since the underlying node has been deleted by a concurrent transaction!");
- else if (trace)
- log.trace("The data node [" + fqn + "] is null, but this is ok since the workspace node is marked as deleted as well");
- }
- // if there is a DataVersion type mismatch here, leave it up to the DataVersion impl to barf if necessary. - JBCACHE-962
- else if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
- {
- // we have an out of date node here
- throw new DataVersioningException("Version mismatch for node " + fqn + ": underlying node with version " + workspaceNode.getNode().getVersion() + " is newer than workspace node, with version " + workspaceNode.getVersion());
- }
- }
- }
- else
- {
- if (trace) log.trace("Node [" + workspaceNode.getFqn() + "] doesn't need validating as it isn't dirty");
- }
- }
- log.debug("Successfully validated nodes");
- return invokeNextInterceptor(ctx, command);
- }
-
- @SuppressWarnings("unchecked")
- private void commitTransaction(InvocationContext ctx)
- {
- GlobalTransaction gtx = getGlobalTransaction(ctx);
- TransactionWorkspace workspace;
- workspace = getTransactionWorkspace(ctx);
-
- if (log.isDebugEnabled()) log.debug("Commiting successfully validated changes for GlobalTransaction " + gtx);
- Collection<WorkspaceNode> workspaceNodes = workspace.getNodes().values();
- for (WorkspaceNode workspaceNode : workspaceNodes)
- {
- NodeSPI underlyingNode = workspaceNode.getNode();
- // short circuit if this node is deleted?
- if (workspaceNode.isRemoved())
- {
- if (trace) log.trace("Workspace node " + workspaceNode.getFqn() + " deleted; removing");
-
- if (underlyingNode.getFqn().isRoot())
- {
- throw new CacheException("An illegal attempt to delete the root node!");
- }
- else
- {
- // mark it as invalid so any direct references are marked as such
- underlyingNode.setValid(false, true);
- // we need to update versions here, too
- performVersionUpdate(underlyingNode, workspaceNode);
-
- if (!useTombstones)
- {
- // don't retain the tombstone
- NodeSPI parent = underlyingNode.getParentDirect();
- if (parent == null)
- {
- throw new CacheException("Underlying node " + underlyingNode + " has no parent");
- }
-
- parent.removeChildDirect(underlyingNode.getFqn().getLastElement());
- }
- }
- }
- else
- {
- boolean updateVersion = false;
- if (workspaceNode.isChildrenModified() || workspaceNode.isResurrected()) // if it is newly created make sure we remove all underlying children that may exist, to solve a remove-and-create-in-tx condition
- {
- if (trace) log.trace("Updating children since node has modified children");
- // merge children.
- List<Set<Fqn>> deltas = workspaceNode.getMergedChildren();
-
- if (trace) log.trace("Applying children deltas to parent node " + underlyingNode.getFqn());
-
- if (workspaceNode.isResurrected())
- {
- // mark it as invalid so any direct references are marked as such
- Map childNode = underlyingNode.getChildrenMapDirect();
- for (Object o : childNode.values())
- {
- NodeSPI cn = (NodeSPI) o;
- cn.setValid(false, true);
- if (!useTombstones) underlyingNode.removeChildDirect(cn.getFqn().getLastElement());
- }
- }
-
- for (Fqn child : deltas.get(0))
- {
- NodeSPI childNode = workspace.getNode(child).getNode();
- underlyingNode.addChildDirect(childNode);
- childNode.setValid(true, false);
- }
-
- for (Fqn child : deltas.get(1))
- {
- // mark it as invalid so any direct references are marked as such
- NodeSPI childNode = underlyingNode.getChildDirect(child.getLastElement());
- if (childNode != null) childNode.setValid(false, true);
-
- if (!useTombstones) underlyingNode.removeChildDirect(child.getLastElement());
- }
-
- updateVersion = underlyingNode.isLockForChildInsertRemove();
-
- // do we need to notify listeners of a modification?? If all we've done is added children then don't
- // notify.
- }
-
- if (workspaceNode.isModified())
- {
- if (trace) log.trace("Merging data since node is dirty");
- Map mergedData = workspaceNode.getMergedData();
- underlyingNode.clearDataDirect();
- underlyingNode.putAllDirect(mergedData);
-
- // mark node and any parents as valid- if available. Versioning parents are tough though - leave as old versions?
- validateNodeAndParents(underlyingNode);
- updateVersion = true;
- }
-
- if (updateVersion)
- {
- performVersionUpdate(underlyingNode, workspaceNode);
- }
- }
- }
- }
-
- @Override
- public Object visitCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
- {
- commitTransaction(ctx);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
- {
- TransactionWorkspace workspace;
- workspace = getTransactionWorkspace(ctx);
- workspace.clearNodes();
- return invokeNextInterceptor(ctx, command);
- }
-
-
- private void validateNodeAndParents(NodeSPI node)
- {
- node.setValid(true, false);
- if (!node.getFqn().isRoot()) validateNodeAndParents(node.getParentDirect());
- }
-
- private void performVersionUpdate(NodeSPI underlyingNode, WorkspaceNode workspaceNode)
- {
- if (workspaceNode.isVersioningImplicit())
- {
- if (trace) log.trace("Versioning is implicit; incrementing.");
- underlyingNode.setVersion(((DefaultDataVersion) workspaceNode.getVersion()).increment());
- }
- else
- {
- if (trace) log.trace("Versioning is explicit; not attempting an increment.");
- underlyingNode.setVersion(workspaceNode.getVersion());
- }
-
- if (trace)
- log.trace("Setting version of node " + underlyingNode.getFqn() + " from " + workspaceNode.getVersion() + " to " + underlyingNode.getVersion());
- }
-
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,13 +25,13 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.base.JmxStatsCommandInterceptor;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.notifications.Notifier;
+import org.jboss.starobrno.factories.annotations.Inject;
import java.util.Collections;
import java.util.HashMap;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,402 +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.interceptors;
-
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.commands.DataCommand;
-import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.legacy.ReversibleCommand;
-import org.jboss.cache.commands.read.GetChildrenNamesCommand;
-import org.jboss.cache.commands.read.GetKeyValueCommand;
-import org.jboss.cache.commands.read.GetKeysCommand;
-import org.jboss.cache.commands.read.GetNodeCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.commands.tx.RollbackCommand;
-import org.jboss.cache.commands.write.ClearDataCommand;
-import org.jboss.cache.commands.write.EvictCommand;
-import org.jboss.cache.commands.write.MoveCommand;
-import org.jboss.cache.commands.write.PutDataMapCommand;
-import org.jboss.cache.commands.write.PutForExternalReadCommand;
-import org.jboss.cache.commands.write.PutKeyValueCommand;
-import org.jboss.cache.commands.write.RemoveKeyCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.interceptors.base.PrePostProcessingCommandInterceptor;
-import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.lock.LockManager;
-import static org.jboss.cache.lock.LockType.READ;
-import static org.jboss.cache.lock.LockType.WRITE;
-import org.jboss.cache.lock.LockUtil;
-import org.jboss.cache.lock.PessimisticNodeBasedLockManager;
-import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.PessimisticTransactionContext;
-import org.jboss.cache.transaction.TransactionContext;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * An interceptor that handles locking. When a TX is associated, we register
- * for TX completion and unlock the locks acquired within the scope of the TX.
- * When no TX is present, we keep track of the locks acquired during the
- * current method and unlock when the method returns.
- *
- * @author Bela Ban
- * @version $Id$
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class PessimisticLockInterceptor extends PrePostProcessingCommandInterceptor
-{
- private DataContainer dataContainer;
- private PessimisticNodeBasedLockManager lockManager;
- private CommandsFactory commandsFactory;
-
- @Inject
- public void injectDependencies(DataContainer dataContainer, LockManager lockManager, CommandsFactory commandsFactory)
- {
- this.dataContainer = dataContainer;
- this.lockManager = (PessimisticNodeBasedLockManager) lockManager;
- this.commandsFactory = commandsFactory;
- }
-
- @Override
- protected Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
- {
- return handlePutCommand(ctx, command, false);
- }
-
- @Override
- protected Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- {
- return handlePutCommand(ctx, command, false);
- }
-
- @Override
- protected Object handlePutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command) throws Throwable
- {
- return handlePutCommand(ctx, command, true);
- }
-
- private Object handlePutCommand(InvocationContext ctx, DataCommand command, boolean zeroAcquisitionTimeout)
- throws Throwable
- {
- if ((ctx.isLockingSuppressed()) || configuration.getIsolationLevel() == IsolationLevel.NONE)
- {
- if (trace) log.trace("Suppressing locking, creating nodes if necessary");
- int treeNodeSize = command.getFqn().size();
- NodeSPI n = dataContainer.getRoot();
- for (int i = 0; i < treeNodeSize; i++)
- {
- Object childName = command.getFqn().get(i);
- Fqn childFqn = Fqn.fromElements(childName);
- NodeSPI childNode = n.getChildDirect(childFqn);
- if (childNode == null) childNode = n.addChildDirect(childFqn);
- LockUtil.manageReverseRemove(ctx, childNode, true, null, commandsFactory);
- n = childNode;
- }
- }
- else
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, true,
- zeroAcquisitionTimeout, false, true, null, false);
- }
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
- {
- // 2-phase commit prepares are no-ops here.
- if (!command.isOnePhaseCommit()) return invokeNextInterceptor(ctx, command);
-
- // commit propagated up from the tx interceptor
- commit(ctx.getTransactionContext(), ctx.getGlobalTransaction());
- Object retVal = invokeNextInterceptor(ctx, command);
- lockManager.unlock(ctx);
- return retVal;
- }
-
- @Override
- protected Object handleCommitCommand(InvocationContext ctx, CommitCommand command) throws Throwable
- {
- commit(ctx.getTransactionContext(), command.getGlobalTransaction());
- if (trace) log.trace("bypassed locking as method commit() doesn't require locking");
- Object retVal = invokeNextInterceptor(ctx, command);
- lockManager.unlock(ctx);
- return retVal;
- }
-
- @Override
- protected Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
- {
- TransactionContext transactionContext = ctx.getTransactionContext();
- if (trace)
- {
- log.trace("called to rollback cache with GlobalTransaction=" + command.getGlobalTransaction());
- }
- if (transactionContext == null)
- {
- log.error("transactionContext for transaction " + command.getGlobalTransaction() + " not found (transaction has possibly already been rolled back)");
- }
- else
- {
- for (Fqn fqn : transactionContext.getRemovedNodes())
- {
- dataContainer.removeFromDataStructure(fqn, false);
- }
- // 1. Revert the modifications by running the undo-op list in reverse. This *cannot* throw any exceptions !
-
- undoOperations((PessimisticTransactionContext) transactionContext);
- }
- if (trace)
- {
- log.trace("bypassed locking as method rollback() doesn't require locking");
- }
- Object retVal = invokeNextInterceptor(ctx, command);
- lockManager.unlock(ctx);
- return retVal;
- }
-
- private void undoOperations(PessimisticTransactionContext transactionContext)
- {
- List<WriteCommand> modificationList = transactionContext.getAllModifications();
-
- if (modificationList.isEmpty())
- {
- if (trace) log.trace("Modification list is null, no modifications in this transaction!");
- return;
- }
-
- if (trace) log.trace("undoOperations " + modificationList);
-
- ArrayList<WriteCommand> copy;
- copy = new ArrayList<WriteCommand>(modificationList);
- RuntimeException exc = null;
- for (ListIterator<WriteCommand> i = copy.listIterator(copy.size()); i.hasPrevious();)
- {
- WriteCommand undoOp = i.previous();
- // since we are using pessimistic locking, all pessimistic WriteCommands implement ReversibleCommand.
- ReversibleCommand txCommand = (ReversibleCommand) undoOp;
- if (log.isDebugEnabled()) log.debug("Calling rollback() on command " + undoOp);
- try
- {
- txCommand.rollback();
- }
- catch (RuntimeException re)
- {
- exc = re;
- }
- }
- if (exc != null) throw exc;
- }
-
- @Override
- protected Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
- {
- if (ctx.isLockingSuppressed()) return invokeNextInterceptor(ctx, command);
-
- // this call will ensure the node gets a WL and its current parent gets RL.
- if (trace) log.trace("Attempting to get WL on node to be moved [" + command.getFqn() + "]");
- if (command.getFqn() != null && !(configuration.getIsolationLevel() == IsolationLevel.NONE))
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, false, false, true, false, null, false);
- if (ctx.getGlobalTransaction() != null)
- {
- ctx.getTransactionContext().addRemovedNode(command.getFqn());
- }
- lockManager.lockAllAndRecord(dataContainer.peek(command.getFqn(), true, false), WRITE, ctx);
- }
- if (command.getTo() != null && !(configuration.getIsolationLevel() == IsolationLevel.NONE))
- {
- //now for an RL for the new parent.
- if (trace) log.trace("Attempting to get RL on new parent [" + command.getTo() + "]");
- lockManager.lockPessimistically(ctx, command.getTo(), READ, false, false, false, false, null, false);
- lockManager.lockAllAndRecord(dataContainer.peek(command.getTo(), true, false), READ, ctx);
- }
- Object retValue = invokeNextInterceptor(ctx, command);
-
- if (ctx.getTransaction() == null) // not transactional
- {
- // do a REAL remove here.
- NodeSPI n = dataContainer.peek(command.getFqn(), true, false);
- if (n != null) lockManager.unlockAll(n, Thread.currentThread());
- }
-
- return retValue;
- }
-
- @Override
- protected Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
- {
- if (ctx.isLockingSuppressed()) return invokeNextInterceptor(ctx, command);
- // need to make a note of ALL nodes created here!!
- List<NodeSPI> createdNodes = new LinkedList<NodeSPI>();
- // we need to mark new nodes created as deleted since they are only created to form a path to the node being removed, to
- // create a lock.
- boolean created = lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, true, false, true, true, createdNodes, true);
- TransactionContext transactionContext = null;
- if (ctx.getGlobalTransaction() != null)
- {
- transactionContext = ctx.getTransactionContext();
- transactionContext.addRemovedNode(command.getFqn());
- for (NodeSPI nodeSPI : createdNodes)
- {
- transactionContext.addRemovedNode(nodeSPI.getFqn());
- nodeSPI.markAsDeleted(true);
- }
- }
-
- lockAllForRemoval(dataContainer.peek(command.getFqn(), false, false), ctx, transactionContext);
-
- if (!createdNodes.isEmpty())
- {
- if (trace) log.trace("There were new nodes created, skipping notification on delete");
- if (trace)
- log.trace("Changing 'skipNotification' for command 'remove' from " + command.isSkipSendingNodeEvents() + " to true");
- command.setSkipSendingNodeEvents(true);
- }
-
- Object retVal = invokeNextInterceptor(ctx, command);
- // and make sure we remove all nodes we've created for the sake of later removal.
- if (ctx.getGlobalTransaction() == null)
- {
- for (NodeSPI nodeSPI : createdNodes) dataContainer.removeFromDataStructure(nodeSPI.getFqn(), true);
- dataContainer.removeFromDataStructure(command.getFqn(), true);
-
- NodeSPI n = dataContainer.peek(command.getFqn(), true, false);
- if (n != null) lockManager.unlockAll(n, Thread.currentThread());
- }
- // if this is a delete op and we had to create the node, return a FALSE as nothing *really* was deleted!
- return created ? false : retVal;
- }
-
- /**
- * Acquires write locks on the node and all child nodes, adding children to the list of removed nodes in the context.
- *
- * @param node node to inspect
- * @param ctx invocation context
- * @param transactionContext transaction entry
- * @throws InterruptedException in the event of interruption
- */
- @SuppressWarnings("unchecked")
- public void lockAllForRemoval(NodeSPI node, InvocationContext ctx, TransactionContext transactionContext) throws InterruptedException
- {
- if (node == null) return;
- // lock node
- lockManager.lockAndRecord(node, WRITE, ctx);
-
- // add to deleted list
- if (transactionContext != null) transactionContext.addRemovedNode(node.getFqn());
-
- // now children.
- Map<Object, NodeSPI> children = node.getChildrenMapDirect();
- for (NodeSPI child : children.values())
- {
- // lock child.
- lockAllForRemoval(child, ctx, transactionContext);
- }
- }
-
- @Override
- protected Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, false, false, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handleClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, false, false, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, false, true, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), READ, false, false, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handleGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), READ, false, false, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handleGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), READ, false, false, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- protected Object handleGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
- {
- lockManager.lockPessimistically(ctx, command.getFqn(), READ, false, false, false, false, null, false);
- return invokeNextInterceptor(ctx, command);
- }
-
- @Override
- public void doAfterCall(InvocationContext ctx, VisitableCommand command)
- {
- if (!ctx.isValidTransaction()) lockManager.unlock(ctx);
- }
-
- /**
- * Remove all locks held by <tt>tx</tt>, remove the transaction from the transaction table
- */
- private void commit(TransactionContext transactionContext, GlobalTransaction gtx)
- {
- if (trace) log.trace("committing cache with gtx " + gtx);
- if (transactionContext == null)
- {
- log.error("transactionContext for transaction " + gtx + " not found (maybe already committed)");
- return;
- }
- // first remove nodes that should be deleted.
- for (Fqn fqn : transactionContext.getRemovedNodes())
- {
- dataContainer.removeFromDataStructure(fqn, false);
- }
- }
-
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -34,9 +34,9 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
+import org.jboss.starobrno.config.Configuration;
/**
* Takes care of replicating modifications to other nodes in a cluster. Also
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.CacheException;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.RPCManager;
import org.jboss.cache.ReplicationException;
@@ -31,7 +30,6 @@
import org.jboss.cache.commands.VisitableCommand;
import org.jboss.cache.commands.WriteCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -40,9 +38,7 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Option;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.context.ContextFactory;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
@@ -53,6 +49,9 @@
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.concurrent.ConcurrentHashSet;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
import javax.transaction.InvalidTransactionException;
import javax.transaction.Status;
@@ -793,12 +792,6 @@
return null;
}
- @Override
- public Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- command.setGlobalTransaction(gtx);
- return null;
- }
});
return command;
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/CommandInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -26,8 +26,8 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.AbstractVisitor;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
/**
* This is the base class for all interceptors to extend, and implements the {@link org.jboss.cache.commands.Visitor} interface
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/JmxStatsCommandInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/JmxStatsCommandInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/JmxStatsCommandInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,9 +21,9 @@
*/
package org.jboss.cache.interceptors.base;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.jmx.JmxStatisticsExposer;
import org.jboss.cache.jmx.annotations.ManagedAttribute;
+import org.jboss.starobrno.factories.annotations.Start;
import java.util.Collections;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/PrePostProcessingCommandInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/PrePostProcessingCommandInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/PrePostProcessingCommandInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,29 +1,28 @@
-/*
- * 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.interceptors.base;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.VisitableCommand;
-import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
@@ -32,7 +31,6 @@
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -136,29 +134,7 @@
return handleDefault(ctx, command);
}
- @Override
- public final Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command) throws Throwable
- {
- try
- {
- return doBeforeCall(ctx, command) ? handleCreateNodeCommand(ctx, command) : null;
- }
- finally
- {
- doAfterCall(ctx, command);
- }
- }
- /**
- * @deprecated in 3.0. Will be removed when Optimistic and Pessimistic locking is removed.
- */
- @Deprecated
- protected Object handleCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command) throws Throwable
- {
- return handleDefault(ctx, command);
- }
-
-
@Override
public final Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
{
@@ -429,24 +405,7 @@
return handleDefault(ctx, command);
}
- @Override
- public final Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- try
- {
- return doBeforeCall(ctx, command) ? handleOptimisticPrepareCommand(ctx, command) : null;
- }
- finally
- {
- doAfterCall(ctx, command);
- }
- }
- protected Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- return handleDefault(ctx, command);
- }
-
/**
* Callback that is invoked after every handleXXX() method defined above.
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/interceptors/base/SkipCheckChainedInterceptor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.interceptors.base;
import org.jboss.cache.InvocationContext;
@@ -31,7 +31,6 @@
import org.jboss.cache.commands.read.GetNodeCommand;
import org.jboss.cache.commands.read.GravitateDataCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.ClearDataCommand;
@@ -346,21 +345,6 @@
}
@Override
- public final Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- if (skipInterception(ctx, command))
- {
- return invokeNextInterceptor(ctx, command);
- }
- return handleOptimisticPrepareCommand(ctx, command);
- }
-
- protected Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
- {
- return handleAll(ctx, command);
- }
-
- @Override
public final Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable
{
if (skipInterception(ctx, command))
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/AbstractInvocationDelegate.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,10 +22,10 @@
package org.jboss.cache.invocation;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
/**
* The JBoss Cache hand-wired interceptor stack. A "minimal" AOP framework which uses delegation through an
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.DataContainer;
@@ -53,14 +52,7 @@
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.Option;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
@@ -70,6 +62,14 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.Immutables;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.Configuration.NodeLockingScheme;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.Option;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
import org.jgroups.Address;
import javax.transaction.Transaction;
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/InvocationContextContainer.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,9 +22,9 @@
package org.jboss.cache.invocation;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.context.ContextFactory;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
/**
* Container and factory for thread locals
Deleted: core/branches/flat/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/LegacyInvocationContext.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,81 +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.invocation;
-
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.NodeSPI;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * This is to provide backward compatibility with legacy locking schemes.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class LegacyInvocationContext extends InvocationContext
-{
- DataContainer container;
-
- public LegacyInvocationContext(DataContainer container)
- {
- this.container = container;
- }
-
- public NodeSPI lookUpNode(Fqn fqn)
- {
- return container.peek(fqn);
- }
-
- public void putLookedUpNode(Fqn f, NodeSPI n)
- {
- // a no-op by default.
- }
-
- public void putLookedUpNodes(Map<Fqn, NodeSPI> lookedUpNodes)
- {
- // a no-op by default.
- }
-
- public void clearLookedUpNodes()
- {
- // no-op
- }
-
- public Map<Fqn, NodeSPI> getLookedUpNodes()
- {
- // a no-op by default.
- return Collections.emptyMap();
- }
-
- public InvocationContext copy()
- {
- LegacyInvocationContext copy = new LegacyInvocationContext(container);
- doCopy(copy);
- return copy;
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
@@ -32,10 +31,10 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeNotValidException;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.config.Option;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Option;
import java.util.Collections;
import java.util.HashSet;
@@ -148,16 +147,6 @@
throw new CacheException("This method is deprecated!");
}
- public void setVersion(DataVersion version)
- {
- node.setVersion(version);
- }
-
- public DataVersion getVersion()
- {
- return node.getVersion();
- }
-
public Set<NodeSPI<K, V>> getChildrenDirect()
{
return node.getChildrenDirect();
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,22 +24,22 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
-import org.jboss.cache.config.EvictionConfig;
-import org.jboss.cache.config.RuntimeConfig;
-import org.jboss.cache.config.parsing.JGroupsStackParser;
-import org.jboss.cache.config.parsing.element.BuddyElementParser;
-import org.jboss.cache.config.parsing.element.EvictionElementParser;
-import org.jboss.cache.config.parsing.element.LoadersElementParser;
import org.jboss.cache.util.CachePrinter;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.BuddyReplicationConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.config.EvictionConfig;
+import org.jboss.starobrno.config.RuntimeConfig;
+import org.jboss.starobrno.config.parsing.JGroupsStackParser;
+import org.jboss.starobrno.config.parsing.element.BuddyElementParser;
+import org.jboss.starobrno.config.parsing.element.EvictionElementParser;
+import org.jboss.starobrno.config.parsing.element.LoadersElementParser;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.ChannelFactory;
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/CacheJmxWrapperMBean.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,9 +22,9 @@
package org.jboss.cache.jmx;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheStatus;
-import org.jboss.cache.config.Configuration;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
import org.jgroups.Address;
import java.util.List;
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,10 +24,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/JmxUtil.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,9 @@
*/
package org.jboss.cache.jmx;
-import org.jboss.cache.config.Configuration;
+import org.jboss.starobrno.config.Configuration;
+
import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
Modified: core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/jmx/PlatformMBeanServerRegistration.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,11 +24,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
/**
* If {@link org.jboss.cache.config.Configuration#getExposeManagementStatistics()} is true, then class will register
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
@@ -36,6 +35,7 @@
import org.jboss.cache.marshall.NodeDataExceptionMarker;
import org.jboss.cache.marshall.NodeDataMarker;
import org.jboss.cache.util.Immutables;
+import org.jboss.starobrno.CacheException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AbstractDelegatingCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,7 +25,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,10 +25,10 @@
import org.apache.commons.logging.Log;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.io.ByteBuffer;
import org.jboss.cache.lock.StripedLock;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.CacheLoaderConfig;
import java.io.IOException;
import java.io.InputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AdjListJDBCCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,11 +23,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.util.Immutables;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.IOException;
import java.util.ArrayList;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/AsyncCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -26,7 +26,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/CacheLoaderManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,20 +23,20 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.CacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.config.ConfigurationException;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import java.util.ArrayList;
import java.util.Iterator;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/ChainingCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,10 +24,10 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.starobrno.config.CacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.factories.annotations.Inject;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -37,9 +37,9 @@
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
import org.jboss.cache.commands.remote.ClusteredGetCommand;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.lock.StripedLock;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.factories.annotations.Inject;
import org.jgroups.Address;
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.RspFilter;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/ClusteredCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,9 +21,10 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.config.Dynamic;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.Dynamic;
+
import java.util.Properties;
public class ClusteredCacheLoaderConfig extends IndividualCacheLoaderConfig
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,8 +25,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.lock.StripedLock;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.util.stream.MarshalledValueInputStream;
import java.io.File;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/FileCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,9 +21,9 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.config.Dynamic;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.Dynamic;
import java.util.Properties;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,9 +25,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.marshall.NodeData;
+import org.jboss.starobrno.config.CacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.InputStream;
import java.io.ObjectInputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOld.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,7 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.sql.Connection;
import java.sql.PreparedStatement;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOldConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOldConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/JDBCCacheLoaderOldConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig;
/**
* Cache loader configuration for JDBCCacheLoaderOld implementation.
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,7 +25,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/LocalDelegatingCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,7 +22,7 @@
package org.jboss.cache.loader;
import org.jboss.cache.Cache;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -27,14 +27,14 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.config.CacheLoaderConfig;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.CacheStarted;
import org.jboss.cache.notifications.annotation.CacheStopped;
import org.jboss.cache.notifications.annotation.ViewChanged;
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.ViewChangedEvent;
+import org.jboss.starobrno.config.CacheLoaderConfig;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import org.jgroups.Address;
import org.jgroups.View;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreDefaultConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreDefaultConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/SingletonStoreDefaultConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,9 +21,10 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
-import org.jboss.cache.config.Dynamic;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
+import org.jboss.starobrno.config.Dynamic;
+
import java.util.Properties;
/**
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,11 +23,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.loader.tcp.TcpCacheOperations;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/TcpDelegatingCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.loader;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -43,9 +43,9 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.loader.AbstractCacheLoader;
import org.jboss.cache.util.reflect.ReflectionUtil;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.File;
import java.io.IOException;
@@ -553,8 +553,9 @@
throws Exception
{
// JBCACHE-769 -- make a defensive copy
- if (values != null && !(values instanceof HashMap)) {
- values = new HashMap(values);
+ if (values != null && !(values instanceof HashMap))
+ {
+ values = new HashMap(values);
}
/* To update-or-insert, try putNoOverwrite first, then a RMW cycle. */
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/bdbje/BdbjeCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.loader.bdbje;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -33,8 +33,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.FqnComparator;
import org.jboss.cache.Modification;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.loader.AbstractCacheLoader;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.File;
import java.io.IOException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,8 +21,8 @@
*/
package org.jboss.cache.loader.jdbm;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3CacheLoader.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -32,8 +32,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.loader.AbstractCacheLoader;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.io.BufferedInputStream;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3Exception.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3Exception.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3Exception.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.loader.s3;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
/**
* Basic exception class.
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3LoaderConfig.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3LoaderConfig.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/s3/S3LoaderConfig.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,8 +24,8 @@
import net.noderunner.amazon.s3.Bucket;
import net.noderunner.amazon.s3.CallingFormat;
import net.noderunner.amazon.s3.Connection;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import java.lang.reflect.Field;
import java.util.Properties;
Modified: core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/loader/tcp/TcpCacheServer.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
@@ -32,6 +31,7 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.jmx.CacheJmxWrapperMBean;
+import org.jboss.starobrno.CacheException;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -483,7 +483,8 @@
return sb.toString();
}
- protected void handleModifications(List<Modification> modifications) throws CacheException
+ protected void handleModifications(List<Modification> modifications) throws
+ CacheException
{
for (Modification m : modifications)
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/AbstractLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/AbstractLockManager.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/AbstractLockManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,9 +22,9 @@
package org.jboss.cache.lock;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
/**
* Common lock manager functionality
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/LockStrategyFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/LockStrategyFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/LockStrategyFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,11 +21,10 @@
*/
package org.jboss.cache.lock;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Configuration.NodeLockingScheme;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
/**
@@ -52,7 +51,7 @@
@Start(priority = 1)
public void start()
{
- lockingLevel = configuration.getNodeLockingScheme() == NodeLockingScheme.OPTIMISTIC ? IsolationLevel.REPEATABLE_READ : configuration.getIsolationLevel();
+ lockingLevel = configuration.getIsolationLevel();
}
public LockStrategy getLockStrategy()
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/LockingException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/LockingException.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/LockingException.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.lock;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import java.util.Map;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -30,14 +30,14 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
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.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import javax.transaction.TransactionManager;
import java.util.Collection;
Modified: core/branches/flat/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,24 +1,24 @@
-/*
- * 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.lock;
import org.apache.commons.logging.Log;
@@ -27,8 +27,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import java.util.ArrayList;
import java.util.Collection;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -27,10 +27,10 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.CommandsFactory;
-import org.jboss.cache.factories.annotations.Inject;
import static org.jboss.cache.lock.LockType.WRITE;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.starobrno.factories.annotations.Inject;
import java.util.List;
Modified: 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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/lock/TimeoutException.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.lock;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
/**
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/AbstractMarshaller.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -42,16 +42,15 @@
import org.jboss.cache.commands.remote.ReplicateCommand;
import org.jboss.cache.commands.tx.AbstractTransactionCommand;
import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import org.jboss.cache.commands.tx.RollbackCommand;
import org.jboss.cache.commands.write.EvictCommand;
import org.jboss.cache.commands.write.InvalidateCommand;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.io.ByteBuffer;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import org.jgroups.util.Buffer;
import java.io.InputStream;
@@ -150,7 +149,6 @@
//Object[] args = cmd.getParameters();
switch (cmd.getCommandId())
{
- case OptimisticPrepareCommand.METHOD_ID:
case PrepareCommand.METHOD_ID:
// Prepare method has a list of modifications. We will just take the first one and extract.
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,18 +21,17 @@
*/
package org.jboss.cache.marshall;
-import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import org.jboss.cache.Region.Status;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.util.FastCopyHashMap;
import org.jboss.cache.util.Immutables;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.factories.annotations.Inject;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
@@ -342,11 +341,6 @@
out.writeByte(MAGICNUMBER_IPADDRESS);
marshallIpAddress((IpAddress) o, out);
}
- else if (o instanceof DefaultDataVersion)
- {
- out.writeByte(MAGICNUMBER_DEFAULT_DATA_VERSION);
- marshallDefaultDataVersion((DefaultDataVersion) o, out);
- }
else if (o.getClass().equals(ArrayList.class))
{
out.writeByte(MAGICNUMBER_ARRAY_LIST);
@@ -602,9 +596,6 @@
case MAGICNUMBER_IPADDRESS:
retVal = unmarshallIpAddress(in);
return retVal;
- case MAGICNUMBER_DEFAULT_DATA_VERSION:
- retVal = unmarshallDefaultDataVersion(in);
- return retVal;
case MAGICNUMBER_ARRAY:
return unmarshallArray(in, refMap);
case MAGICNUMBER_ARRAY_LIST:
@@ -813,18 +804,6 @@
for (int i = 0; i < listSize; i++) listToPopulate.add(unmarshallObject(in, refMap));
}
- @SuppressWarnings("deprecation")
- protected void marshallDefaultDataVersion(DefaultDataVersion ddv, ObjectOutputStream out) throws Exception
- {
- writeUnsignedLong(out, ddv.getRawVersion());
- }
-
- @SuppressWarnings("deprecation")
- protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception
- {
- return new DefaultDataVersion(readUnsignedLong(in));
- }
-
/**
* Reads a reference from a given stream.
*
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller300.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller300.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/CacheMarshaller300.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.marshall;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import java.io.ObjectOutputStream;
import java.lang.reflect.Array;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -27,11 +27,11 @@
import org.jboss.cache.commands.remote.AnnounceBuddyPoolNameCommand;
import org.jboss.cache.commands.remote.AssignToBuddyGroupCommand;
import org.jboss.cache.commands.remote.RemoveFromBuddyGroupCommand;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
+import org.jboss.starobrno.config.Configuration;
import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.MembershipListener;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionException.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/InactiveRegionException.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.marshall;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
/**
* Thrown by a {@link org.jboss.cache.marshall.AbstractMarshaller} instance when attempting to perform an operation on an inactive region.
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValue.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValue.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValue.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.marshall;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import org.jboss.util.stream.MarshalledValueInputStream;
import java.io.ByteArrayInputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValueMap.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValueMap.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/MarshalledValueMap.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,7 +22,7 @@
package org.jboss.cache.marshall;
import net.jcip.annotations.Immutable;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import java.io.Externalizable;
import java.io.IOException;
Modified: core/branches/flat/src/main/java/org/jboss/cache/marshall/MethodCall.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/MethodCall.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,6 @@
*/
package org.jboss.cache.marshall;
-import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
import java.lang.reflect.Method;
@@ -66,8 +65,6 @@
{
case PrepareCommand.METHOD_ID:
return (Boolean) this.getArgs()[3];
- case OptimisticPrepareCommand.METHOD_ID:
- return (Boolean) this.getArgs()[4];
default:
return false;
}
Modified: 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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/UnmarshalledReferences.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -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.marshall;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import java.util.ArrayList;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/marshall/VersionAwareMarshaller.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -25,11 +25,11 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.io.ByteBuffer;
import org.jboss.cache.io.ExposedByteArrayOutputStream;
import org.jboss.cache.util.Util;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import org.jboss.util.stream.MarshalledValueInputStream;
import java.io.ByteArrayInputStream;
Modified: core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -29,8 +29,8 @@
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.UnversionedNode;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.starobrno.factories.annotations.Start;
import java.util.Map;
Modified: core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -31,13 +30,14 @@
import org.jboss.cache.NodeFactory;
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.lock.LockManager;
import static org.jboss.cache.lock.LockType.WRITE;
import org.jboss.cache.lock.TimeoutException;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
import java.util.Collection;
import java.util.Collections;
Modified: core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/mvcc/NodeReference.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -28,7 +28,6 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
import java.util.Map;
@@ -237,16 +236,6 @@
delegate.removeChildren();
}
- public final void setVersion(DataVersion version)
- {
- delegate.setVersion(version);
- }
-
- public final DataVersion getVersion()
- {
- return delegate.getVersion();
- }
-
public final Fqn getFqn()
{
return delegate.getFqn();
Modified: core/branches/flat/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -29,7 +29,7 @@
import org.jboss.cache.InvocationContext;
import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.CHANGED;
import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.DELETED;
-import org.jboss.cache.optimistic.DataVersioningException;
+import org.jboss.starobrno.CacheException;
/**
* A node delegate that encapsulates repeatable read semantics when writes are initiated, committed or rolled back.
@@ -65,7 +65,7 @@
{
String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("]. Another process has changed the node since we last read it!").toString();
if (log.isWarnEnabled()) log.warn(errormsg + ". Unable to copy node for update.");
- throw new DataVersioningException(errormsg);
+ throw new CacheException(errormsg);
}
}
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/IncorrectCacheListenerException.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.notifications;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
/**
* Thrown when an incorrectly annotated class is added as a cache listener using the {@link org.jboss.cache.Cache#addCacheListener(Object)} API.
Modified: core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,23 +24,23 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.buddyreplication.BuddyGroup;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Destroy;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.annotations.Stop;
import org.jboss.cache.marshall.MarshalledValueMap;
import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.*;
import static org.jboss.cache.notifications.event.Event.Type.*;
import org.jboss.cache.util.Immutables;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Destroy;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
+import org.jboss.starobrno.factories.annotations.Start;
+import org.jboss.starobrno.factories.annotations.Stop;
import org.jgroups.View;
import javax.transaction.Transaction;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,14 +23,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.io.ExposedByteArrayOutputStream;
import org.jboss.cache.statetransfer.DefaultStateTransferManager;
import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jboss.util.stream.MarshalledValueInputStream;
import org.jboss.util.stream.MarshalledValueOutputStream;
import org.jgroups.ExtendedMessageListener;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -28,11 +28,11 @@
import org.jboss.cache.InternalNode;
import org.jboss.cache.Node;
import org.jboss.cache.Version;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
@@ -31,15 +30,16 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
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.cache.notifications.event.NodeModifiedEvent;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.config.Configuration;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.Start;
import java.io.IOException;
import java.io.ObjectInputStream;
Modified: 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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,21 +23,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InternalNode;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.RegionEmptyException;
import org.jboss.cache.RegionManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.InactiveRegionException;
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataMarker;
+import org.jboss.starobrno.CacheException;
+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;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferGenerator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferGenerator.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferGenerator.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -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.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InternalNode;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.Version;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.marshall.NodeData;
-import org.jboss.cache.marshall.NodeDataExceptionMarker;
-
-import java.io.ObjectOutputStream;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
- at Deprecated
-public class LegacyStateTransferGenerator implements StateTransferGenerator
-{
-
- public static final short STATE_TRANSFER_VERSION = Version.getVersionShort("2.0.0.GA");
-
- private Log log = LogFactory.getLog(getClass().getName());
-
- private CacheSPI cache;
-
- private Set<Fqn> internalFqns;
-
- @Inject
- public void inject(CacheSPI cache)
- {
- this.cache = cache;
- }
-
- @Start(priority = 18)
- private void start()
- {
- this.internalFqns = cache.getInternalFqns();
- }
-
- public void generateState(ObjectOutputStream out, Object rootNode, boolean generateTransient,
- boolean generatePersistent, boolean suppressErrors) throws Exception
- {
- Fqn fqn = getFqn(rootNode);
- try
- {
- cache.getMarshaller().objectToObjectStream(STATE_TRANSFER_VERSION, out);
- if (generateTransient)
- {
- //transient + marker
- if (log.isTraceEnabled())
- {
- log.trace("writing transient state for " + fqn);
- }
- marshallTransientState((NodeSPI) rootNode, out);
- delimitStream(out);
-
- if (log.isTraceEnabled())
- {
- log.trace("transient state succesfully written");
- }
-
- //associated + marker
- if (log.isTraceEnabled())
- {
- log.trace("writing associated state");
- }
-
- delimitStream(out);
-
- if (log.isTraceEnabled())
- {
- log.trace("associated state succesfully written");
- }
-
- }
- else
- {
- //we have to write two markers for transient and associated
- delimitStream(out);
- delimitStream(out);
- }
-
- CacheLoader cacheLoader = cache.getCacheLoaderManager() == null ? null : cache.getCacheLoaderManager().getCacheLoader();
- if (cacheLoader != null && generatePersistent)
- {
- if (log.isTraceEnabled())
- {
- log.trace("writing persistent state for " + fqn + ",using " + cache.getCacheLoaderManager().getCacheLoader().getClass());
- }
-
- if (fqn.isRoot())
- {
- cacheLoader.loadEntireState(out);
- }
- else
- {
- cacheLoader.loadState(fqn, out);
- }
-
- if (log.isTraceEnabled())
- {
- log.trace("persistent state succesfully written");
- }
- }
- delimitStream(out);
- }
- catch (Exception e)
- {
- cache.getMarshaller().objectToObjectStream(new NodeDataExceptionMarker(e, cache.getLocalAddress()), out);
- throw e;
- }
- }
-
- private Fqn getFqn(Object o)
- {
- if (o instanceof Node) return ((Node) o).getFqn();
- if (o instanceof InternalNode) return ((InternalNode) o).getFqn();
- throw new IllegalArgumentException();
- }
-
- /**
- * Places a delimiter marker on the stream
- *
- * @param out stream
- * @throws java.io.IOException if there are errs
- */
- protected void delimitStream(ObjectOutputStream out) throws Exception
- {
- cache.getMarshaller().objectToObjectStream(DefaultStateTransferManager.STREAMING_DELIMITER_NODE, out);
- }
-
- /**
- * Do a preorder traversal: visit the node first, then the node's children
- *
- * @param out
- * @throws Exception
- */
- protected void marshallTransientState(NodeSPI node, ObjectOutputStream out) throws Exception
- {
- List<NodeData> nodeData = new LinkedList<NodeData>();
- generateNodeDataList(node, nodeData);
- cache.getMarshaller().objectToObjectStream(nodeData, out, node.getFqn());
- }
-
- protected void generateNodeDataList(NodeSPI<?, ?> node, List<NodeData> list) throws Exception
- {
- if (internalFqns.contains(node.getFqn()))
- {
- return;
- }
-
- Map attrs;
- NodeData nd;
-
- // first handle the current node
- attrs = node.getInternalState(false);
-
- if (attrs.size() == 0)
- {
- nd = new NodeData(node.getFqn());
- }
- else
- {
- nd = new NodeData(node.getFqn(), attrs, true);
- }
-
- list.add(nd);
-
- // then visit the children
- for (NodeSPI child : node.getChildrenDirect()) generateNodeDataList(child, list);
- }
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferIntegrator.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferIntegrator.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferIntegrator.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,423 +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.CacheException;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Node;
-import org.jboss.cache.NodeFactory;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.Region;
-import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.eviction.EvictionEvent;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-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.cache.notifications.event.NodeModifiedEvent;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
- at Deprecated
-public class LegacyStateTransferIntegrator implements StateTransferIntegrator
-{
-
- private static final Log log = LogFactory.getLog(LegacyStateTransferIntegrator.class);
- private static final boolean trace = log.isTraceEnabled();
- private CacheSPI cache;
- private NodeFactory factory;
- private Set<Fqn> internalFqns;
- private Configuration cfg;
- private boolean usePut; // for JBCACHE-131
-
- @Inject
- public void inject(CacheSPI<?, ?> cache, NodeFactory nodefactory, Configuration cfg)
- {
- this.cache = cache;
- this.factory = nodefactory;
- this.cfg = cfg;
- }
-
- @Start(priority = 14)
- public void start()
- {
- this.internalFqns = cache.getInternalFqns();
- usePut = cfg.getCacheLoaderConfig() != null && !cfg.getCacheLoaderConfig().isFetchPersistentState() &&
- !cfg.getCacheLoaderConfig().isShared();
- }
-
- public void integrateState(ObjectInputStream ois, Object target, Fqn targetFqn, boolean integratePersistentState) throws Exception
- {
- // pop version from the stream first!
- short version = (Short) cache.getMarshaller().objectFromObjectStream(ois);
- log.info("Using version " + version);
- integrateTransientState(ois, (NodeSPI) target);
- // read another marker for the dummy associated state
- if (trace) log.trace("Reading marker for nonexistent associated state");
- cache.getMarshaller().objectFromObjectStream(ois);
- if (integratePersistentState) integratePersistentState(ois, targetFqn);
- }
-
- protected void integrateTransientState(ObjectInputStream in, NodeSPI target) throws Exception
- {
- boolean transientSet = false;
- try
- {
- if (log.isTraceEnabled())
- {
- log.trace("integrating transient state for " + target);
- }
-
- integrateTransientState(target, in);
-
- transientSet = true;
-
- if (log.isTraceEnabled())
- {
- log.trace("transient state successfully integrated");
- }
-
- notifyAllNodesCreated(cache.getInvocationContext(), target);
- }
- catch (Exception e)
- {
- throw new CacheException(e);
- }
- finally
- {
- if (!transientSet)
- {
- target.clearDataDirect();
- target.removeChildrenDirect();
- }
- }
- }
-
- protected void integratePersistentState(ObjectInputStream in, Fqn targetFqn) throws Exception
- {
- if (trace) log.trace("Reading persistent state from stream");
- CacheLoaderManager loaderManager = cache.getCacheLoaderManager();
- CacheLoader loader = loaderManager == null ? null : loaderManager.getCacheLoader();
- if (loader == null)
- {
- if (log.isTraceEnabled())
- {
- log.trace("cache loader is null, will not attempt to integrate persistent state");
- }
- }
- else
- {
-
- if (log.isTraceEnabled())
- {
- log.trace("integrating persistent state using " + loader.getClass().getName());
- }
-
- boolean persistentSet = false;
- try
- {
- if (targetFqn.isRoot())
- {
- loader.storeEntireState(in);
- }
- else
- {
- loader.storeState(targetFqn, in);
- }
- persistentSet = true;
- }
- catch (ClassCastException cce)
- {
- log.error("Failed integrating persistent state. One of cacheloaders is not"
- + " adhering to state stream format. See JBCACHE-738.");
- throw cce;
- }
- finally
- {
- if (!persistentSet)
- {
- log.warn("persistent state integration failed, removing all nodes from loader");
- loader.remove(targetFqn);
- }
- else
- {
- if (log.isTraceEnabled())
- {
- log.trace("persistent state integrated successfully");
- }
- }
- }
- }
- }
-
- /**
- * Generates NodeAdded notifications for all nodes of the tree. This is
- * called whenever the tree is initially retrieved (state transfer)
- */
- private void notifyAllNodesCreated(InvocationContext ctx, NodeSPI curr)
- {
- if (curr == null) return;
- ctx.setOriginLocal(false);
- cache.getNotifier().notifyNodeCreated(curr.getFqn(), true, ctx);
- cache.getNotifier().notifyNodeCreated(curr.getFqn(), false, ctx);
- // AND notify that they have been modified!!
- if (!curr.getKeysDirect().isEmpty())
- {
- cache.getNotifier().notifyNodeModified(curr.getFqn(), true, NodeModifiedEvent.ModificationType.PUT_MAP, Collections.emptyMap(), ctx);
- cache.getNotifier().notifyNodeModified(curr.getFqn(), false, NodeModifiedEvent.ModificationType.PUT_MAP, curr.getDataDirect(), ctx);
- }
- ctx.setOriginLocal(true);
-
- Set<NodeSPI> children = curr.getChildrenDirect();
- for (NodeSPI n : children)
- {
- notifyAllNodesCreated(ctx, n);
- }
- }
-
- private void integrateTransientState(NodeSPI target, ObjectInputStream in) throws Exception
- {
- if (trace) log.trace("Reading transient state from stream");
- target.removeChildrenDirect();
-
- List<NodeData> list = readNodesAsList(in);
- if (list != null)
- {
- // if the list was null we read an EOF marker!! So don't bother popping it off the stack later.
- Iterator<NodeData> nodeDataIterator = list.iterator();
-
- // Read the first NodeData and integrate into our target
- if (nodeDataIterator.hasNext())
- {
- NodeData nd = nodeDataIterator.next();
-
- //are there any transient nodes at all?
- if (nd != null && !nd.isMarker())
- {
- Map attributes = nd.getAttributes();
- if (usePut)
- {
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- target.clearData();
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- target.putAll(attributes);
- }
- else
- {
- target.setInternalState(attributes);
- }
-
- // Check whether this is an integration into the buddy backup
- // subtree
- Fqn tferFqn = nd.getFqn();
- Fqn tgtFqn = target.getFqn();
- boolean move = tgtFqn.isChildOrEquals(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)
- && !tferFqn.isChildOrEquals(tgtFqn);
- // If it is an integration, calculate how many levels of offset
- int offset = move ? tgtFqn.size() - tferFqn.size() : 0;
-
- integrateStateTransferChildren(target, offset, nodeDataIterator);
-
- integrateRetainedNodes(target);
- }
- }
-
- // read marker off stack
- if (trace) log.trace("Reading marker from stream");
- cache.getMarshaller().objectFromObjectStream(in);
- }
- }
-
- @SuppressWarnings("unchecked")
- private List<NodeData> readNodesAsList(ObjectInputStream in) throws Exception
- {
- Object obj = cache.getMarshaller().objectFromObjectStream(in);
- if (obj instanceof NodeDataMarker) return null;
-
- return (List<NodeData>) obj;
- }
-
- private NodeData integrateStateTransferChildren(NodeSPI parent, int offset, Iterator<NodeData> nodeDataIterator)
- throws IOException, ClassNotFoundException
- {
- int parent_level = parent.getFqn().size();
- int target_level = parent_level + 1;
- Fqn fqn;
- int size;
- NodeData nd = nodeDataIterator.hasNext() ? nodeDataIterator.next() : null;
- while (nd != null && !nd.isMarker())
- {
- fqn = nd.getFqn();
- // If we need to integrate into the buddy backup subtree,
- // change the Fqn to fit under it
- if (offset > 0)
- {
- fqn = Fqn.fromRelativeFqn(parent.getFqn().getAncestor(offset), fqn);
- }
- size = fqn.size();
- if (size <= parent_level)
- {
- return nd;
- }
- else if (size > target_level)
- {
- throw new IllegalStateException("NodeData " + fqn + " is not a direct child of " + parent.getFqn());
- }
-
- Map attrs = nd.getAttributes();
-
- // We handle this NodeData. Create a TreeNode and
- // integrate its data
- NodeSPI target;
- if (usePut)
- {
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- cache.clearData(fqn);
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- cache.put(fqn, attrs);
- target = cache.getNode(fqn);
- }
- else
- {
- target = factory.createNode(fqn, parent, attrs);
- parent.addChild(fqn.getLastElement(), target);
- // JBCACHE-913
- Region region = cache.getRegion(fqn, false);
- if (region != null && region.getEvictionRegionConfig() != null)
- {
- region.registerEvictionEvent(fqn, EvictionEvent.Type.ADD_NODE_EVENT, attrs == null ? 0 : attrs.size());
- }
- }
-
- // Recursively call, which will walk down the tree
- // and return the next NodeData that's a child of our parent
- nd = integrateStateTransferChildren(target, offset, nodeDataIterator);
- }
- if (nd != null && nd.isExceptionMarker())
- {
- NodeDataExceptionMarker ndem = (NodeDataExceptionMarker) nd;
- throw new CacheException("State provider node " + ndem.getCacheNodeIdentity()
- + " threw exception during loadState", ndem.getCause());
- }
- return null;
- }
-
- private Set<Node> retainInternalNodes(Node target)
- {
- Set<Node> result = new HashSet<Node>();
- Fqn targetFqn = target.getFqn();
- for (Fqn internalFqn : internalFqns)
- {
- if (internalFqn.isChildOf(targetFqn))
- {
- Node internalNode = getInternalNode(target, internalFqn);
- if (internalNode != null)
- {
- result.add(internalNode);
- }
- }
- }
-
- return result;
- }
-
- private Node getInternalNode(Node parent, Fqn internalFqn)
- {
- Object name = internalFqn.get(parent.getFqn().size());
- cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
- Node result = parent.getChild(name);
- if (result != null)
- {
- if (internalFqn.size() < result.getFqn().size())
- {
- // need to recursively walk down the tree
- result = getInternalNode(result, internalFqn);
- }
- }
- return result;
- }
-
- private void integrateRetainedNodes(NodeSPI target)
- {
- Set<Node> retainedNodes = retainInternalNodes(target);
- Fqn rootFqn = target.getFqn();
- for (Node retained : retainedNodes)
- {
- if (retained.getFqn().isChildOf(rootFqn))
- {
- integrateRetainedNode(target, retained);
- }
- }
- }
-
- private void integrateRetainedNode(NodeSPI ancestor, Node descendant)
- {
- Fqn descFqn = descendant.getFqn();
- Fqn ancFqn = ancestor.getFqn();
- Object name = descFqn.get(ancFqn.size());
- NodeSPI child = (NodeSPI) ancestor.getChild(name);
- if (ancFqn.size() == descFqn.size() + 1)
- {
- if (child == null)
- {
- ancestor.addChild(name, descendant);
- }
- else
- {
- log.warn("Received unexpected internal node " + descFqn + " in transferred state");
- }
- }
- else
- {
- if (child == null)
- {
- // Missing level -- have to create empty node
- // This shouldn't really happen -- internal fqns should
- // be immediately under the root
- child = factory.createNode(name, ancestor);
- ancestor.addChild(name, child);
- }
-
- // Keep walking down the tree
- integrateRetainedNode(child, descendant);
- }
- }
-}
\ No newline at end of file
Deleted: core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,208 +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.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.RegionEmptyException;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.lock.LockManager;
-import static org.jboss.cache.lock.LockType.READ;
-import org.jboss.cache.lock.TimeoutException;
-import org.jboss.cache.marshall.InactiveRegionException;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-/**
- * This is to support legacy locking schemes such as Pessimistic and Optimistic locking.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 3.0
- */
- at Deprecated
-public class LegacyStateTransferManager extends DefaultStateTransferManager
-{
- protected LockManager lockManager;
- private boolean usePut; // for JBCACHE-131
-
- @Inject
- public void injectLockManager(LockManager lockManager)
- {
- this.lockManager = lockManager;
- }
-
- @Start(priority = 14)
- public void checkLoaders()
- {
- usePut = configuration.getCacheLoaderConfig() != null && !configuration.getCacheLoaderConfig().isFetchPersistentState() &&
- !configuration.getCacheLoaderConfig().isShared();
- }
-
- @Override
- public void getState(ObjectOutputStream out, Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Exception
- {
- // can't give state for regions currently being activated/inactivated
- boolean canProvideState = (!regionManager.isInactive(fqn) && cache.peek(fqn, false) != null);
-
- if (canProvideState && (fetchPersistentState || fetchTransientState))
- {
- marshaller.objectToObjectStream(true, out);
- long startTime = System.currentTimeMillis();
- NodeSPI rootNode = cache.peek(fqn, false, false);
-
- try
- {
- if (log.isDebugEnabled())
- {
- log.debug("locking the " + fqn + " subtree to return the in-memory (transient) state");
- }
- acquireLocksForStateTransfer(rootNode, timeout, force);
- generator.generateState(out, rootNode, fetchTransientState, fetchPersistentState, suppressErrors);
- if (log.isDebugEnabled())
- {
- log.debug("Successfully generated state in " + (System.currentTimeMillis() - startTime) + " msec");
- }
- }
- finally
- {
- releaseStateTransferLocks(rootNode);
- }
- }
- 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;
- }
- }
-
- /**
- * 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();
-
- acquireLocksForStateTransfer(targetRoot, stateRetrievalTimeout, true);
- /*
- * 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.
- *
- */
- try
- {
- if (log.isDebugEnabled())
- {
- log.debug("starting state integration at node " + targetRoot);
- }
- integrator.integrateState(state, targetRoot, targetRoot.getFqn(), fetchPersistentState);
- if (log.isDebugEnabled())
- {
- log.debug("successfully integrated state in " + (System.currentTimeMillis() - startTime) + " msec");
- }
- }
- finally
- {
- releaseStateTransferLocks(targetRoot);
- }
- }
-
-
- protected void acquireLocksForStateTransfer(NodeSPI root, long timeout, boolean force) throws InterruptedException
- {
- if (usePut) return;
- try
- {
- lockManager.lockAll(root, READ, getLockOwner(), timeout, true);
- }
- catch (TimeoutException te)
- {
- log.error("Caught TimeoutException acquiring locks on region " +
- root.getFqn(), te);
- if (force)
- {
- throw te;
- }
- else
- {
- throw te;
- }
- }
- }
-
- protected void releaseStateTransferLocks(NodeSPI root)
- {
- if (usePut) return;
- try
- {
- lockManager.unlockAll(root, getLockOwner());
- }
- catch (Throwable t)
- {
- log.error("failed releasing locks", t);
- }
- }
-
- private Object getLockOwner()
- {
- Object owner = cache.getCurrentTransaction();
- if (owner == null) owner = Thread.currentThread();
- return owner;
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/AbstractTransactionContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/AbstractTransactionContext.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/AbstractTransactionContext.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -24,9 +24,9 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.config.Option;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
import org.jboss.cache.util.Immutables;
+import org.jboss.starobrno.config.Option;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManagerLookup.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/BatchModeTransactionManagerLookup.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,48 +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.transaction;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.TransactionManager;
-
-
-/**
- * Returns an instance of {@link BatchModeTransactionManager}.
- *
- * @author Bela Ban Sept 5 2003
- * @version $Id$
- * @deprecated Use batching API on Cache instead.
- */
- at Deprecated
-public class BatchModeTransactionManagerLookup implements TransactionManagerLookup
-{
- private Log log = LogFactory.getLog(BatchModeTransactionManagerLookup.class);
-
- public TransactionManager getTransactionManager() throws Exception
- {
- log.warn("Using a deprecated/unsupported transaction manager!");
- return BatchModeTransactionManager.getInstance();
- }
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/OptimisticTransactionContext.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -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.transaction;
-
-import org.jboss.cache.optimistic.TransactionWorkspace;
-import org.jboss.cache.optimistic.TransactionWorkspaceImpl;
-
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-
-/**
- * Subclasses the {@link PessimisticTransactionContext} class to add a {@link TransactionWorkspace}. Used with optimistic locking
- * where each call is assigned a trasnaction and a transaction workspace.
- *
- * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @author <a href="mailto:stevew at jofti.com">Steve Woodcock (stevew at jofti.com)</a>
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class OptimisticTransactionContext extends PessimisticTransactionContext
-{
- private TransactionWorkspace transactionWorkSpace = new TransactionWorkspaceImpl();
-
- public OptimisticTransactionContext(Transaction tx) throws SystemException, RollbackException
- {
- super(tx);
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder(super.toString());
- sb.append("\nworkspace: ").append(transactionWorkSpace);
- return sb.toString();
- }
-
- /**
- * @return Returns the transactionWorkSpace.
- */
- public TransactionWorkspace getTransactionWorkSpace()
- {
- return transactionWorkSpace;
- }
-
- /**
- * @param transactionWorkSpace The transactionWorkSpace to set.
- */
- public void setTransactionWorkSpace(TransactionWorkspace transactionWorkSpace)
- {
- this.transactionWorkSpace = transactionWorkSpace;
- }
-
-}
Deleted: core/branches/flat/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -1,90 +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.transaction;
-
-
-import org.jboss.cache.commands.WriteCommand;
-
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Information associated with a {@link GlobalTransaction} about the transaction state.
- * <p/>
- * A TransactionContext maintains:
- * <ul>
- * <li>Handle to the local Transaction</li>
- * <li>List of {@link org.jboss.cache.commands.WriteCommand}s that make up this transaction</li>
- * <li>List of locks acquired</li>
- * <li>Any transaction-scope options</li>
- * </ul>
- *
- * @author <a href="mailto:bela at jboss.org">Bela Ban</a>
- * @author Manik Surtani
- * @version $Revision$
- * @deprecated will be removed along with optimistic and pessimistic locking.
- */
- at Deprecated
-public class PessimisticTransactionContext extends AbstractTransactionContext
-{
- private List<WriteCommand> allModifications;
-
- public PessimisticTransactionContext(Transaction tx) throws SystemException, RollbackException
- {
- super(tx);
- }
-
- @Override
- public void addLocalModification(WriteCommand command)
- {
- if (command == null) return;
- super.addLocalModification(command);
- if (allModifications == null) allModifications = new LinkedList<WriteCommand>();
- allModifications.add(command);
- }
-
- @Override
- public void addModification(WriteCommand command)
- {
- if (command == null) return;
- super.addModification(command);
- if (allModifications == null) allModifications = new LinkedList<WriteCommand>();
- allModifications.add(command);
- }
-
- public List<WriteCommand> getAllModifications()
- {
- if (allModifications == null) return Collections.emptyList();
- return allModifications;
- }
-
- @Override
- public void reset()
- {
- super.reset();
- allModifications = null;
- }
-}
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,8 +23,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.config.Option;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
+import org.jboss.starobrno.config.Option;
import javax.transaction.Transaction;
import java.util.List;
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionManagerLookup.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -22,7 +22,6 @@
package org.jboss.cache.transaction;
import org.jboss.cache.Cache;
-import org.jboss.cache.config.Configuration;
import javax.transaction.TransactionManager;
Modified: core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/transaction/TransactionTable.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,12 +23,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.RPCManager;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.context.ContextFactory;
+import org.jboss.starobrno.CacheException;
+import org.jboss.starobrno.factories.annotations.Inject;
+import org.jboss.starobrno.factories.annotations.NonVolatile;
import org.jgroups.Address;
import javax.transaction.Status;
Modified: core/branches/flat/src/main/java/org/jboss/cache/util/concurrent/WithinThreadExecutor.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/cache/util/concurrent/WithinThreadExecutor.java 2008-10-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/concurrent/WithinThreadExecutor.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -21,7 +21,7 @@
*/
package org.jboss.cache.util.concurrent;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import java.util.Collection;
import java.util.Collections;
Modified: 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-08 16:24:08 UTC (rev 6884)
+++ core/branches/flat/src/main/java/org/jboss/cache/util/reflect/ReflectionUtil.java 2008-10-08 16:28:04 UTC (rev 6885)
@@ -23,7 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.CacheException;
+import org.jboss.starobrno.CacheException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
More information about the jbosscache-commits
mailing list