openejb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gurkan Erdogdu <cgurkanerdo...@gmail.com>
Subject Re: testing, @Local/@Remote
Date Tue, 09 Feb 2010 11:31:57 GMT
Hello;

@Local is used for calling EJB methods inside Application Server (For
example, your web application artifacts(servlets) running inside Web
Container makes calls to @Local EJBs running inside EJB container. Both of
web and ejb container contained in the sample application server). You are
not able to call @Local EJBs from outside of the application server, for
example from Remote Java Swing Client running in different JVM from
Application Server. In @Local mode, EJB method parameters are passed by
reference, means that any change/update to the method parameters in called
EJB method are reflected on the calling side (client).

@Remote is used for calling EJB methods inside/outside of the Application
Server. EJB method parameters are passed by value, means that values are
Marhsalled/UnMarshalled between JVM boundaries. Even if caller lives in same
application server, parameters are marshalled/unmarshalled. Therefore there
is always a performance penalty. (Note : Some application servers may
optimize @Remote calls inside application servers!, even if it does, still
not performancable as @Local).

Hope this helps!

Thanks;

--Gurkan


2010/2/9 joe <fischauto333@yahoo.de>

> Hi,
>
> I am quite new to OpenEJB and EJB3 in general, so many things are nebulous
> for me.
>
> What's the right strategy for unit testing EJBs?
>
> My understanding is the following:
> For testing i should use the embedded EJB container.
>
> I guessed to make an EJB locally testable it has to implement an interface
> annotated with @Local.
> But it seems i am wrong. My EJBs methods are also invokeable even if they
> implement an interface annotated
> with @Remote.
>
> So in general Remote-EJBs are locally invokeable? if yes whats the @Local
> for?
> Just to make EJB methods not invokeable for remote clients?
>
> in the "Simple Stateless Example" (
> http://openejb.apache.org/3.0/simple-stateless-example.html)
> two interfaces (with identical signatures) are used one with implicit
> @Local and one with @Remote annotation.
> Why, maybe some use case?
>
>


-- 
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message