Author: manik.surtani(a)jboss.com
Date: 2008-05-14 13:05:33 -0400 (Wed, 14 May 2008)
New Revision: 5849
Modified:
core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
Log:
Fixed version setting
Modified: core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-05-14 15:35:28 UTC (rev
5848)
+++ core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-05-14 17:05:33 UTC (rev
5849)
@@ -18,7 +18,6 @@
import org.jboss.cache.optimistic.TransactionWorkspace;
import org.jboss.cache.optimistic.WorkspaceNode;
import org.jboss.cache.optimistic.WorkspaceNodeImpl;
-import org.jboss.cache.transaction.TransactionTable;
import java.util.Map;
@@ -32,7 +31,6 @@
private CacheSPI<K, V> cache;
private boolean optimistic;
private Configuration configuration;
- private TransactionTable transactionTable;
private InvocationContextContainer invocationContextContainer;
private InterceptorChain interceptorChain;
private CommandsFactory commandsFactory;
@@ -63,13 +61,12 @@
}
@Inject
- private void injectDependencies(CacheSPI<K, V> cache, Configuration
configuration, TransactionTable transactionTable,
+ private void injectDependencies(CacheSPI<K, V> cache, Configuration
configuration,
InvocationContextContainer
invocationContextContainer,
InterceptorChain interceptorChain, CommandsFactory
commandsFactory, LockStrategyFactory lockStrategyFactory)
{
this.cache = cache;
this.configuration = configuration;
- this.transactionTable = transactionTable;
this.invocationContextContainer = invocationContextContainer;
this.interceptorChain = interceptorChain;
this.commandsFactory = commandsFactory;
@@ -109,7 +106,7 @@
// Too slow to have these autowired for now. Look at manually wiring them.
nid.initialize(configuration, invocationContextContainer, componentRegistry,
interceptorChain);
nid.injectDependencies(cache);
- un.injectDependencies(cache, transactionTable, commandsFactory,
lockStrategyFactory);
+ un.injectDependencies(cache, commandsFactory, lockStrategyFactory);
// componentRegistry.wireDependencies(nid);
// componentRegistry.wireDependencies(un);
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-05-14 15:35:28 UTC
(rev 5848)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-05-14 17:05:33 UTC
(rev 5849)
@@ -16,7 +16,6 @@
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import java.util.Collections;
import java.util.HashMap;
@@ -51,7 +50,6 @@
* A reference of the CacheImpl instance.
*/
private transient CacheSPI cache;
- private transient TransactionTable transactionTable;
/**
* Map of general data keys to values.
@@ -117,10 +115,9 @@
this.delegate = delegate;
}
- public void injectDependencies(CacheSPI spi, TransactionTable transactionTable,
CommandsFactory commandsFactory, LockStrategyFactory lockStrategyFactory)
+ public void injectDependencies(CacheSPI spi, CommandsFactory commandsFactory,
LockStrategyFactory lockStrategyFactory)
{
this.cache = spi;
- this.transactionTable = transactionTable;
this.commandsFactory = commandsFactory;
this.lockStrategyFactory = lockStrategyFactory;
init();
Modified: core/trunk/src/main/java/org/jboss/cache/VersionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/VersionedNode.java 2008-05-14 15:35:28 UTC
(rev 5848)
+++ core/trunk/src/main/java/org/jboss/cache/VersionedNode.java 2008-05-14 17:05:33 UTC
(rev 5849)
@@ -27,7 +27,7 @@
public class VersionedNode<K, V> extends UnversionedNode<K, V>
{
private static final String DATA_VERSION_INTERNAL_KEY =
"_JBOSS_INTERNAL_OPTIMISTIC_DATA_VERSION";
- private DataVersion version;
+ private DataVersion version; // make sure this is NOT initialized to anything, even a
null! Since the UnversionedNode constructor may set this value based on a data version
passed along in the data map.
/**
* Although this object has a reference to the CacheImpl, the optimistic
@@ -39,9 +39,9 @@
protected VersionedNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data,
CacheSPI<K, V> cache)
{
super(fqn.getLastElement(), fqn, data, false, cache);
+ if (version == null) version = DefaultDataVersion.ZERO;
if (parent == null && !fqn.isRoot()) throw new
NullPointerException("parent");
this.parent = parent;
- this.version = DefaultDataVersion.ZERO;
log = LogFactory.getLog(VersionedNode.class);
}
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-05-14
15:35:28 UTC (rev 5848)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-05-14
17:05:33 UTC (rev 5849)
@@ -27,7 +27,6 @@
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionEntry;
-import org.jboss.cache.transaction.TransactionTable;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
@@ -50,7 +49,6 @@
{
private CacheLoaderConfig loaderConfig = null;
private TransactionManager txMgr = null;
- private TransactionTable txTable = null;
private HashMap txStores = new HashMap();
private Map<GlobalTransaction, Set<Fqn>> preparingTxs = new
ConcurrentHashMap<GlobalTransaction, Set<Fqn>>();
private long cacheStores = 0;
@@ -65,13 +63,12 @@
}
@Inject
- protected void init(DataContainer dataContainer, CacheLoaderManager loaderManager,
TransactionManager txManager, TransactionTable txTable, CacheLoaderConfig clConfig)
+ protected void init(DataContainer dataContainer, CacheLoaderManager loaderManager,
TransactionManager txManager, CacheLoaderConfig clConfig)
{
// never inject a CacheLoader at this stage - only a CacheLoaderManager, since the
CacheLoaderManager only creates a CacheLoader instance when it @Starts.
this.loaderManager = loaderManager;
this.loaderConfig = clConfig;
txMgr = txManager;
- this.txTable = txTable;
this.dataContainer = dataContainer;
}
@@ -104,7 +101,6 @@
{
if (inTransaction())
{
- if (trace) log.trace("transactional so don't put stuff in the cloader
yet.");
if (ctx.isTxHasMods())
{
// this is a commit call.
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-05-14
15:35:28 UTC (rev 5848)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-05-14
17:05:33 UTC (rev 5849)
@@ -82,7 +82,6 @@
@Override
public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
throws Throwable
{
- GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(ctx);
WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace,
false, true);
if (workspaceNode != null)
@@ -97,7 +96,6 @@
@Override
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand
command) throws Throwable
{
- GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(ctx);
WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace,
true, true);
if (workspaceNode != null)
@@ -120,7 +118,6 @@
@Override
public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
throws Throwable
{
- GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(ctx);
WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace,
true, true);
if (workspaceNode != null)
@@ -144,7 +141,6 @@
@Override
public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws
Throwable
{
- GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(ctx);
WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace,
true, true);
if (ctx.isOriginLocal() && ctx.getOptionOverrides() != null &&
ctx.getOptionOverrides().getDataVersion() != null)
@@ -163,7 +159,6 @@
@Override
public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
throws Throwable
{
- GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(ctx);
WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace,
true, true);
@@ -179,7 +174,6 @@
@Override
public Object visitRemoveDataCommand(InvocationContext ctx, RemoveDataCommand command)
throws Throwable
{
- GlobalTransaction gtx = getGlobalTransaction(ctx);
TransactionWorkspace workspace = getTransactionWorkspace(ctx);
WorkspaceNode workspaceNode = fetchWorkspaceNode(ctx, command.getFqn(), workspace,
true, true);
if (workspaceNode != null)
@@ -345,11 +339,8 @@
private void addToModificationList(ReversibleCommand command, InvocationContext ctx)
{
Option opt = ctx.getOptionOverrides();
- if (opt == null || !opt.isCacheModeLocal())
- {
- ctx.getTransactionEntry().addModification(command);
- if (log.isDebugEnabled()) log.debug("Adding command " + command +
" to modification list");
- }
+ ctx.getTransactionEntry().addModification(command);
+ if (log.isDebugEnabled()) log.debug("Adding command " + command + "
to modification list");
}
// -----------------------------------------------------------------