<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 27 Mar 2009, at 17:39, Galder Zamarreno wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><br>Manik Surtani wrote:<br><blockquote type="cite">On 25 Mar 2009, at 19:23, Galder Zamarreno wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Hi,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">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:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">fromStream() method says:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Creates an un-initialized command. Un-initialized in the sense that parameters will be set, but any components<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* specific to the cache in question will not be set.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* <p/><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* You would typically set these parameters using {@link org.infinispan.commands.CommandsFactory#initializeReplicableCommand(ReplicableCommand)} <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* <p/><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">And then you do the following:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> case StateTransferControlCommand.METHOD_ID:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> command = new StateTransferControlCommand();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> ((StateTransferControlCommand) command).init(rpcManager);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> break;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Shouldn't ((StateTransferControlCommand) command).init(rpcManager) go into org.infinispan.commands.CommandsFactory#initializeReplicableCommand(ReplicableCommand). <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">initializeReplicableCommand() javadoc says:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">* Initializes a {@link org.infinispan.commands.ReplicableCommand} read from * a data stream with components specific to the target cache instance.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The rpcManager seems to be one those components?<br></blockquote></blockquote><blockquote type="cite">No. The RPCManager is scoped as GLOBAL:<br></blockquote><blockquote type="cite"> <a href="https://svn.jboss.org/repos/infinispan/trunk/src/main/java/org/horizon/remoting/RPCManager.java">https://svn.jboss.org/repos/infinispan/trunk/src/main/java/org/infinispan/remoting/RPCManager.java</a> Refer to the @Scope annotation on the interface.<br></blockquote><blockquote type="cite">But I understand your confusion here. We should either:<br></blockquote><blockquote type="cite">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().<br></blockquote><blockquote type="cite">2. Remove the injection in fromStream(); have CommandsFactory.initializeReplicableCommand() handle all of the injection, of GLOBAL and NAMED_CACHE scoped components.<br></blockquote><blockquote type="cite">I have no problem with 2, if it makes your integration easier. In fact, I actually think 2 is probably cleaner.<br></blockquote><br>I've looked into this and it looked simpler saying than actually doing it. The problem here is that StateTransferControlCommand is dealt in a very different way to the rest of ReplicableCommands that extend CacheRPCCommand.</div></blockquote><div><br></div><div>Ah, yes.</div><br><blockquote type="cite"><div>CommandAwareRpcDispatcher.handle shows <a href="http://pastebin.com/m446036c4">http://pastebin.com/m446036c4</a> and the problem is that perform() is called directly for StateTransferControlCommand before any initialisation could be done. That's why the RPCManager was set during unmarshalling.<br><br>I still think that StateTransferControlCommand, being a ReplicableCommand, should be allowed to go through CommandsFactory.initializeReplicableCommand() but CommandAwareRpcDispatcher.handle does not have access to command factory and neither the global registry of components.</div></blockquote><div><br></div><div>I suppose we then leave it such that global components are injected by the RemoteCommandFactory then, as it originally was?</div><br><blockquote type="cite"><div><br><br>Ideally, I'd like to see something this being doable: <a href="http://pastebin.com/m3f403e2">http://pastebin.com/m3f403e2</a><br><br>However, I dunno whether it's doable or make sense.<br><br>Currently, CommandsFactory.initializeReplicableCommand() call happens within InboundInvocationHandlerImpl.handle(CacheRPCCommand).<br><br>Thoughts? I suppose I could always fallback on 1 but I don't like different commands being treated in a different way. Ideally, all replicable commands received would be instantiated in the marshaller, and they would all be initialised in the same place.<br><br><blockquote type="cite">Cheers<br></blockquote><blockquote type="cite">-- <br></blockquote><blockquote type="cite">Manik Surtani<br></blockquote><blockquote type="cite">Lead, JBoss Cache<br></blockquote><blockquote type="cite"><a href="http://www.jbosscache.org">http://www.jbosscache.org</a><br></blockquote><blockquote type="cite"><a href="mailto:manik@jboss.org">manik@jboss.org</a><br></blockquote><br>-- <br>Galder Zamarreņo<br>Sr. Software Maintenance Engineer<br>JBoss, a division of Red Hat<br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-infinispantal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-infinispantal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div>Lead, JBoss Cache</div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a><br><a href="mailto:manik@jboss.org" target="_blank">manik@jboss.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>