Author: manik.surtani(a)jboss.com
Date: 2008-04-30 12:22:10 -0400 (Wed, 30 Apr 2008)
New Revision: 5776
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/invocation/NodeInvocationDelegate.java
Log:
Further optimisations around not using the component registry to autowire frequently
created objects such as nodes
Modified: core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-04-30 16:10:12 UTC (rev
5775)
+++ core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-04-30 16:22:10 UTC (rev
5776)
@@ -7,14 +7,17 @@
package org.jboss.cache;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.CommandsFactory;
import org.jboss.cache.factories.ComponentFactory;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
+import org.jboss.cache.interceptors.InterceptorChain;
+import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.invocation.NodeInvocationDelegate;
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;
@@ -25,10 +28,14 @@
*/
public class NodeFactory<K, V> extends ComponentFactory
{
- private ComponentRegistry componentRegistry;
private CacheSPI<K, V> cache;
private boolean optimistic;
private Configuration configuration;
+ private TransactionTable transactionTable;
+ private InvocationContextContainer invocationContextContainer;
+ private LifecycleManager lifecycleManager;
+ private InterceptorChain interceptorChain;
+ private CommandsFactory commandsFactory;
@Override
protected <T> T construct(String componentName, Class<T> componentType)
@@ -55,11 +62,17 @@
}
@Inject
- private void injectDependencies(CacheSPI<K, V> cache, Configuration
configuration, ComponentRegistry componentRegistry)
+ private void injectDependencies(CacheSPI<K, V> cache, Configuration
configuration, TransactionTable transactionTable,
+ InvocationContextContainer invocationContextContainer,
LifecycleManager lifecycleManager,
+ InterceptorChain interceptorChain, CommandsFactory
commandsFactory)
{
this.cache = cache;
this.configuration = configuration;
- this.componentRegistry = componentRegistry;
+ this.transactionTable = transactionTable;
+ this.invocationContextContainer = invocationContextContainer;
+ this.lifecycleManager = lifecycleManager;
+ this.interceptorChain = interceptorChain;
+ this.commandsFactory = commandsFactory;
}
/**
@@ -91,6 +104,12 @@
// always assume that new nodes do not have data loaded
un.setDataLoaded(false);
NodeInvocationDelegate<K, V> nid = new NodeInvocationDelegate(un);
+
+ // Too slow to have these autowired for now. Look at manually wiring them.
+ nid.initialize(configuration, invocationContextContainer, lifecycleManager,
interceptorChain);
+ nid.injectDependencies(cache);
+ un.injectDependencies(cache, transactionTable, commandsFactory);
+
componentRegistry.wireDependencies(nid);
componentRegistry.wireDependencies(un);
// back ref
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-04-30 16:10:12 UTC
(rev 5775)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-04-30 16:22:10 UTC
(rev 5776)
@@ -11,8 +11,6 @@
import static org.jboss.cache.AbstractNode.NodeFlags.*;
import org.jboss.cache.commands.write.CreateNodeCommand;
import org.jboss.cache.factories.CommandsFactory;
-import org.jboss.cache.factories.annotations.CacheInjectionMethods;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.lock.IdentityLock;
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.optimistic.DataVersion;
@@ -34,7 +32,6 @@
* @since 2.0.0
*/
@SuppressWarnings("unchecked")
-@CacheInjectionMethods
public class UnversionedNode<K, V> extends AbstractNode<K, V>
{
/**
@@ -106,11 +103,10 @@
this.delegate = delegate;
}
- @Inject
- private void injectDependencies(CacheSPI spi, TransactionTable impl, CommandsFactory
commandsFactory)
+ public void injectDependencies(CacheSPI spi, TransactionTable transactionTable,
CommandsFactory commandsFactory)
{
this.cache = spi;
- this.transactionTable = impl;
+ this.transactionTable = transactionTable;
this.commandsFactory = commandsFactory;
}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-04-30
16:10:12 UTC (rev 5775)
+++
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-04-30
16:22:10 UTC (rev 5776)
@@ -8,7 +8,6 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.UnversionedNode;
import org.jboss.cache.config.Option;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -41,8 +40,7 @@
return node;
}
- @Inject
- private void injectDependencies(CacheSPI spi)
+ public void injectDependencies(CacheSPI spi)
{
this.spi = spi;
}
Show replies by date