users@glassfish.java.net

Re: Using EJBs in CometHandler (GlassFish 2 UR2)

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 17 Jul 2008 11:39:00 -0400

Salut,

glassfish_at_javadesktop.org wrote:
> What's the prefered way to call EJBs in a CometHandler? EJBs can be injected in servlets, but I do not know a way to inject them in CometHandler objects

It depends where you are creating your CometHandler. If you creates it
inside a Servlet, then you can probably "attach" it using the
CometHandler.attach().

.
>
> Is it valid to just use the EJBs objects from the servlet?

Yes it should.

There may be problems because the CometHandler's life cycle is
independent from the servlet. So doing a JNDI look up it probably the
more robust approach (though it's less convenient)?

I guess you need to do the lookup before you call addCometListener() as
doing the lookup after might gives strange results...note that last time
I touched EJB was in 2002, so I might be wrong :-)

>
> Injection in CometHandler would be nice...

Agree...at the time I wrote the Comet stuff, I don't think the GlassFish
team would have let me add Injection ;-) Now that Comet is more an dmore
used, for sure this is on the radar. I'm not ready yet to push the
project on the spotlight, but Atmosphere.dev.java.net is the Grizzly
Comet 2.0, and that one will support Injection.

Hope that help.

-- Jeanfrancois



> [Message sent by forum member 'markusoj' (markusoj)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287123
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>