users@glassfish.java.net

RE: ejb3 Timer Serializable

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Fri, 7 Aug 2009 13:52:54 -0400

please read this tutorial of pass-by-reference
http://docs.sun.com/app/docs/doc/820-4337/beavo?l=en&a=view
pass-by-reference


Specifies the passing method used by a servlet or enterprise
bean calling a remote interface method in another bean that is colocated
within the same process.




If false (the default if this element
is not present), this application uses pass-by-value semantics.




If true, this application uses
pass-by-reference semantics.






Note –
The pass-by-reference element only
applies to remote calls. As defined in the EJB 2.1 specification,
section 5.4, calls to local interfaces use pass-by-reference semantics.


If the pass-by-reference element is set to
its default value of false, the passing semantics
for calls to remote interfaces comply with the EJB 2.1 specification,
section 5.4. If set to true, remote calls involve
pass-by-reference semantics instead of pass-by-value semantics, contrary
to this specification.


Portable programs cannot assume
that a copy of the object is made during such a call, and thus that
it’s safe to modify the original. Nor can they assume that a
copy is not made, and thus that changes to the object are visible
to both caller and callee. When this element is set to true,
parameters and return values should be considered read-only. The behavior
of a program that modifies such parameters or return values is undefined.




When a servlet or enterprise bean calls a remote interface method
in another bean that is colocated within the same process, by default
the Enterprise Server makes copies of all the call parameters in order
to preserve the pass-by-value semantics. This increases the call overhead
and decreases performance.


However, if the calling method does not change the object being
passed as a parameter, it is safe to pass the object itself without
making a copy of it. To do this, set the pass-by-reference value to true.


The setting of this element in the sun-application.xml file
applies to all EJB modules in the application. For an individually
deployed EJB module, you can set the same element in the sun-ejb-jar.xml file. If pass-by-reference is used at
both the bean and application level, the bean level takes precedence.

> To: users_at_glassfish.dev.java.net
> Subject: ejb3 Timer Serializable
>
> In my Stateless bean, I have a method marked with @Timeout where I perform activities based on the timer expired.
>
> @Timeout
> public void onExpiration(Timer timer)
> {
> }
>
> I see this in the logs and want to know if there is any way to avoid it.
>
> <The Remote interface method: 'public abstract void com.loyalty.scheduler.ejb.SchedulerIntf.onExpiration(javax.ejb.Timer)' in EJB 'SchedulerEJB' contains a parameter of type: 'javax.ejb.Timer' which is not Serializable. Though the EJB 'SchedulerEJB' has call-by-reference set to false, this parameter is not Serializable and hence will be passed by reference. A parameter can be passed using call-by-value only if the parameter type is Serializable.>
>
> thanks
> shyamala.
> [Message sent by forum member 'shyamals' (shyamals)]
>
> http://forums.java.net/jive/thread.jspa?messageID=359455
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>

_________________________________________________________________
Get free photo software from Windows Live
http://www.windowslive.com/online/photos?ocid=PID23393::T:WLMTAGL:ON:WL:en-US:SI_PH_software:082009