tag:robotlegs.tenderapp.com,2009-10-18:/discussions/solutions/17-issue-with-multiple-modules-executing-a-shared-commandRobotlegs: Discussion 2018-10-18T16:35:32Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/102583592011-09-28T01:58:24Z2011-09-28T02:05:17ZIssue With Multiple Modules Executing A Shared Command<div><p>Hey everybody ,</p>
<p>Apologies ahead of time if this has been covered elsewhere but
just wanted to put this out there in case anyone else runs into
it.</p>
<p>My dev team and I ran into a tricky issue today that stumped us
for quite some time. We have a fairly involved web app , the acts
as a bootstrap , and loads modules. We are using RL , Signals , and
a covariance utility. What we saw was this,</p>
<p>Bootstrap Loads Module 1.<br>
Module 1 has a shared command mapped to in the bootstrap that gets
executed , which is pulled of the loader property.<br>
The shared command executes a uniquely referenced command from
within the newly loaded module.<br>
The unique command in each module is named the same thing for
consistency.<br>
Bootstrap Loads Module 2 , but when its same command gets executed
its was executing module1's command.</p>
<p>The Command in question is unique to each module , so it seemed
an impossibility that the first one executed again. However what
was occuring , is that because we are using Maven Archetypes to
create our projects , the top Level MXML file in both modules was
called , Module.mxml.</p>
<p>This generally isnt a problem because of FQCN , however , in the
case of the top level package , there is no unique path to
differentiate one command from the other. So command map was
executing the first , and always the first. I think because this
check</p>
<p><code>verifyCommandClass(commandClass);</code></p>
<p>was considering the second command to be the same as the
first.</p>
<p>So the solution seems to be , if you are chaining commands , and
sharing injectors across module , and if you call the command map
directly to execute internal commands on that injector , make
certain you give your top level , application class a unique
name.</p>
<p>At any rate , i dont think it was any problem of RL , just
perhaps an oversight on our part. Still time consuming. Hope this
helps someone.</p>
<p>-adam</p></div>vertigo.index