On 25 Mar 2009, at 19:23, Galder Zamarreno wrote:
Hi,
I'm looking at RemoteCommandFactory in Infinispan as part as mapping
the marshalling stuff to JBoss Marshalling and here's something that
has confused me:
fromStream() method says:
* Creates an un-initialized command. Un-initialized in the sense
that parameters will be set, but any components
* specific to the cache in question will not be set.
* <p/>
* You would typically set these parameters using {@link
org
.infinispan
.commands
.CommandsFactory#initializeReplicableCommand(ReplicableCommand)}
* <p/>
And then you do the following:
case StateTransferControlCommand.METHOD_ID:
command = new StateTransferControlCommand();
((StateTransferControlCommand) command).init(rpcManager);
break;
Shouldn't ((StateTransferControlCommand) command).init(rpcManager)
go into
org
.infinispan
.commands
.CommandsFactory#initializeReplicableCommand(ReplicableCommand).
initializeReplicableCommand() javadoc says:
* Initializes a {@link org.infinispan.commands.ReplicableCommand} read
from * a data stream with components specific to the target cache
instance.
The rpcManager seems to be one those components?
No. The RPCManager is scoped as GLOBAL:
https://svn.jboss.org/repos/infinispan/trunk/src/main/java/org/infinispan...
Refer to the @Scope annotation on the interface.
But I understand your confusion here. We should either:
1. Change the Javadocs on fromStream() to be more explicit, i.e.,
only dependent components of GLOBAL scope are injected. NAMED_CACHE
scope components are only injected later with
CommandsFactory.initializeReplicableCommand().
2. Remove the injection in fromStream(); have
CommandsFactory.initializeReplicableCommand() handle all of the
injection, of GLOBAL and NAMED_CACHE scoped components.
I have no problem with 2, if it makes your integration easier. In
fact, I actually think 2 is probably cleaner.
Cheers
--
Manik Surtani
Lead, JBoss Cache
http://www.jbosscache.org
manik(a)jboss.org