[jboss-user] [Beginner's Corner] - How do I enable pass-by-reference for EJB3 in JBoss AS container?

Jerry Simone do-not-reply at jboss.com
Tue Mar 23 16:32:31 EDT 2010


Jerry Simone [http://community.jboss.org/people/jlsimone] replied to the discussion

"How do I enable pass-by-reference for EJB3 in JBoss AS container?"

To view the discussion, visit: http://community.jboss.org/message/533583#533583

--------------------------------------------------------------
I  just now discovered that there might be an alternate solution to my particular problem, that is passing the initialization state to an EJB in the same JVM using pass by reference instead of pass by value. On another discussion thread, I was asking about initializing the state of of a stateful EJB. I was given an example solution/alternative which I have modified. The modified example is shown below.
 
interface MyLocal {
   MyRemote create(String state);
}
interface MyRemote{
   void doWork();
 
class MyBean implement MyRemote, MyLocal {
   MyRemote create(String state) {
      this.state = state;
      return ctx.getBusinessObject(MyRemote.class);
   }
   
   void doWork(){
      // do something
   }
}
 
This example allows me to use EJBx to create EJBy in the same JVM. I use the local interface, initialize the state of EJBy, passing the state by reference. The create method of EJBy creates the remote interface which is ultimately passed back to the remote client. 

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/533583#533583]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100323/d6fd6568/attachment.html 


More information about the jboss-user mailing list