I like Chris' idea.
However, to avoid the complexities of pooling, try wrapping your MQ Series
API with a stateless session bean. You can than obtain the resource
connection in the MQSeriesBean in its setSessionContext method and
disconnect it in the ejbRemove( ) method of the statless session bean. Than
use this stateless session bean from your stateful session bean.
This will work providing your EJB server uses instance pooling and
implements these methods according to the specification. Using this design,
your stateless session beans can themselves become your MQ series pool.
Richard Monson-Haefel
Author, Enterprise JavaBeans (O'Reilly)
-----Original Message-----
From: Chris Raber
To: [EMAIL PROTECTED]
Sent: 3/22/99 10:13 AM
Subject: Re: EJB Activation/Passivation.
Well, it's probably cheating in terms of the spec (and possibly not
portable
as a result), but you could create a separate "connection pool" service
for
these MQ series connections, and have your session bean allocate and
de-allocate instances from the pool per session bean invocation. This
way no
state needs to be passivated/activated.
We have customers that have done this sort of thing for CICS connections
with good success.
-Chris.
> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, March 22, 1999 10:29 AM
> To: [EMAIL PROTECTED]
> Subject: EJB Activation/Passivation.
>
> I am writing an EJB that uses MQSeries.
>
> The bean is a stateful session bean.
>
> Since MQ series is an external resource and the classes are not
> serializable
> during passivation I close the connections and set the objects to
null.
> Then, when the bean is activated, I reconnect to MQ Series.
>
> These beans are used over a long period of time during which
> activation/passivation occurs many times.
>
> I would like to be able to create the connection once. Use the
connection
> for an extended period of time. Then close the connection.
>
> In regards to the stateful session bean the EJB spec. says:
>
> "In advanced cases, a session Bean's conversational state may contain
open
> resources. Examples of this are: open files, open sockets, and open
> database
> cursors. It is not possible for a container to retain open resources
while
> a
> session Bean is passivated. A developer of such a session Bean must
close
> and open the resources using the ejbPassivate and ejbActivate
> notifications."
>
> However in regards to the entity bean the spec. says:
>
> "The ejbPassivate() method gives the enterprise Bean the chance to
release
> any resources that should not be held while the instance is in the
pool
> (these resources typically had been allocated during the ejbActivate()
> method)."
>
>
> Is there any way that I can avoid reconnecting each time the bean is
> passivated/activated?
>
> Do the same rules regarding open resources for session beans apply to
> entity
> beans?
>
>
> Thanks,
>
> Phillip Schroder
> Senior Software Engineer
> Carreker-Antinori, Inc
>
> [EMAIL PROTECTED]
>
>
========================================================================
==
> =
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff EJB-INTEREST". For general help, send email
to
> [EMAIL PROTECTED] and include in the body of the message "help".
========================================================================
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".