Skip to main content

Working with EJB timers in a Grizzly Comet callback

6 replies [Last post]
Anonymous

I'm trying to implement some cleanup code in the onInterrupt() callback
of my CometHandler. The code is supposed to go through the EJB timers
and cancel some of them. However I'm getting the following exception
when trying to invoke timer.getInfo() method:

java.lang.IllegalStateException: Invocation cannot be null
at
com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.jav
a:197)
at
com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
... (my callback here)

Any idea what can be a workaround?

/Leonid

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jeanfrancois Arcand

Salut,

Marina Vatkina wrote:
> Are you trying to use EJB timers without EJBs?

I think the issue Leonid is facing happens because the calling thread
doesn't contains the threads local information GlassFish is normally
adding to a synchronous call. Since this is an asynchronous call, the
thread locals are not set and since the Timer uses those, hence the
exception. For Servlet 3.0 (which add Comet) that scenario will be
handled, but for Grizzly Comet it is a limitation right now, hence I'm
not sure I can propose a solution.

A+

-- Jeanfrancois

>
> thanks,
> -marina
>
> Leonid Mokrushin wrote:
>> I'm trying to implement some cleanup code in the onInterrupt() callback
>> of my CometHandler. The code is supposed to go through the EJB timers
>> and cancel some of them. However I'm getting the following exception
>> when trying to invoke timer.getInfo() method:
>>
>> java.lang.IllegalStateException: Invocation cannot be null
>> at
>> com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.jav
>> a:197)
>> at
>> com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
>> ... (my callback here)
>>
>> Any idea what can be a workaround?
>>
>> /Leonid
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

jewel_kader

Hello,

Probably, I am facing same problem. I have a POJO which access local
interface of the EJB through jndi lookup. It works fine when called from
inside a Servlet but fails when called from CometHandler.onInterrupt method.
Any solution?

Thanks,

Jewel

Jeanfrancois Arcand-2 wrote:
>
> Salut,
>
> Marina Vatkina wrote:
>> Are you trying to use EJB timers without EJBs?
>
> I think the issue Leonid is facing happens because the calling thread
> doesn't contains the threads local information GlassFish is normally
> adding to a synchronous call. Since this is an asynchronous call, the
> thread locals are not set and since the Timer uses those, hence the
> exception. For Servlet 3.0 (which add Comet) that scenario will be
> handled, but for Grizzly Comet it is a limitation right now, hence I'm
> not sure I can propose a solution.
>
> A+
>
> -- Jeanfrancois
>
>
>
>>
>> thanks,
>> -marina
>>
>> Leonid Mokrushin wrote:
>>> I'm trying to implement some cleanup code in the onInterrupt() callback
>>> of my CometHandler. The code is supposed to go through the EJB timers
>>> and cancel some of them. However I'm getting the following exception
>>> when trying to invoke timer.getInfo() method:
>>>
>>> java.lang.IllegalStateException: Invocation cannot be null
>>> at
>>> com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.jav
>>> a:197)
>>> at
>>> com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
>>> ... (my callback here)
>>>
>>> Any idea what can be a workaround?
>>>
>>> /Leonid
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>
>

--
View this message in context: http://www.nabble.com/Working-with-EJB-timers-in-a-Grizzly-Comet-callbac...
Sent from the java.net - glassfish users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

jewel_kader

Hi,

Currently I am using following workaround,

Inside CometHandler.onInterrupt() I am invoking EJB through a remote
interface (retried during initialization) but I guess this is not the right
solution, because the grizzly and ejb stuffs are in same jvm so, there
should be a way to access the local interface.

Thanks,

Jewel

jewel_kader wrote:
>
> Hello,
>
> Probably, I am facing same problem. I have a POJO which access local
> interface of the EJB through jndi lookup. It works fine when called from
> inside a Servlet but fails when called from CometHandler.onInterrupt
> method. Any solution?
>
> Thanks,
>
> Jewel
>
>
> Jeanfrancois Arcand-2 wrote:
>>
>> Salut,
>>
>> Marina Vatkina wrote:
>>> Are you trying to use EJB timers without EJBs?
>>
>> I think the issue Leonid is facing happens because the calling thread
>> doesn't contains the threads local information GlassFish is normally
>> adding to a synchronous call. Since this is an asynchronous call, the
>> thread locals are not set and since the Timer uses those, hence the
>> exception. For Servlet 3.0 (which add Comet) that scenario will be
>> handled, but for Grizzly Comet it is a limitation right now, hence I'm
>> not sure I can propose a solution.
>>
>> A+
>>
>> -- Jeanfrancois
>>
>>
>>
>>>
>>> thanks,
>>> -marina
>>>
>>> Leonid Mokrushin wrote:
>>>> I'm trying to implement some cleanup code in the onInterrupt() callback
>>>> of my CometHandler. The code is supposed to go through the EJB timers
>>>> and cancel some of them. However I'm getting the following exception
>>>> when trying to invoke timer.getInfo() method:
>>>>
>>>> java.lang.IllegalStateException: Invocation cannot be null
>>>> at
>>>> com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.jav
>>>> a:197)
>>>> at
>>>> com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
>>>> ... (my callback here)
>>>>
>>>> Any idea what can be a workaround?
>>>>
>>>> /Leonid
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Working-with-EJB-timers-in-a-Grizzly-Comet-callbac...
Sent from the java.net - glassfish users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Jeanfrancois Arcand

Salut,

jewel_kader wrote:
> Hi,
>
> Currently I am using following workaround,
>
> Inside CometHandler.onInterrupt() I am invoking EJB through a remote
> interface (retried during initialization) but I guess this is not the right
> solution, because the grizzly and ejb stuffs are in same jvm so, there
> should be a way to access the local interface.

The issue is normally Glassfish InvokationManager bind some information
on a thread local (It's almost 7 year since I touched ejb impl so I
might say something stupid :-)) and that information is required in
order to use local interface. When Grizzly Comet execute the
onInterrupt() it doesn't have access for that data. It is probably
possible to support it...file an RFE here:

https://grizzly.dev.java.net/issues/

and I will try to look at it.

Thanks

-- Jeanfrancois

>
> Thanks,
>
> Jewel
>
>
> jewel_kader wrote:
>> Hello,
>>
>> Probably, I am facing same problem. I have a POJO which access local
>> interface of the EJB through jndi lookup. It works fine when called from
>> inside a Servlet but fails when called from CometHandler.onInterrupt
>> method. Any solution?
>>
>> Thanks,
>>
>> Jewel
>>
>>
>> Jeanfrancois Arcand-2 wrote:
>>> Salut,
>>>
>>> Marina Vatkina wrote:
>>>> Are you trying to use EJB timers without EJBs?
>>> I think the issue Leonid is facing happens because the calling thread
>>> doesn't contains the threads local information GlassFish is normally
>>> adding to a synchronous call. Since this is an asynchronous call, the
>>> thread locals are not set and since the Timer uses those, hence the
>>> exception. For Servlet 3.0 (which add Comet) that scenario will be
>>> handled, but for Grizzly Comet it is a limitation right now, hence I'm
>>> not sure I can propose a solution.
>>>
>>> A+
>>>
>>> -- Jeanfrancois
>>>
>>>
>>>
>>>> thanks,
>>>> -marina
>>>>
>>>> Leonid Mokrushin wrote:
>>>>> I'm trying to implement some cleanup code in the onInterrupt() callback
>>>>> of my CometHandler. The code is supposed to go through the EJB timers
>>>>> and cancel some of them. However I'm getting the following exception
>>>>> when trying to invoke timer.getInfo() method:
>>>>>
>>>>> java.lang.IllegalStateException: Invocation cannot be null
>>>>> at
>>>>> com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.jav
>>>>> a:197)
>>>>> at
>>>>> com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
>>>>> ... (my callback here)
>>>>>
>>>>> Any idea what can be a workaround?
>>>>>
>>>>> /Leonid
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>>> For additional commands, e-mail: users-help@glassfish.dev.java.net
>>>
>>>
>>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Marina Vatkina

Are you trying to use EJB timers without EJBs?

thanks,
-marina

Leonid Mokrushin wrote:
> I'm trying to implement some cleanup code in the onInterrupt() callback
> of my CometHandler. The code is supposed to go through the EJB timers
> and cancel some of them. However I'm getting the following exception
> when trying to invoke timer.getInfo() method:
>
> java.lang.IllegalStateException: Invocation cannot be null
> at
> com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.jav
> a:197)
> at
> com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
> ... (my callback here)
>
> Any idea what can be a workaround?
>
> /Leonid
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Leonid Mokrushin

I think so, even though I have the reference to the TimerService (since
my Comet handler is defined in the EJB), the onInterrupt() method is
executed from within Grizzly. What would be the best way to "emulate"
EJB invocation from the Comet handler in this case?

/Leonid

> -----Original Message-----
> From: Marina.Vatkina@Sun.COM [mailto:Marina.Vatkina@Sun.COM]
> Sent: Friday, October 10, 2008 23:06
> To: users@glassfish.dev.java.net
> Subject: Re: Working with EJB timers in a Grizzly Comet callback
>
> Are you trying to use EJB timers without EJBs?
>
> thanks,
> -marina
>
> Leonid Mokrushin wrote:
> > I'm trying to implement some cleanup code in the onInterrupt()
> > callback of my CometHandler. The code is supposed to go through the
> > EJB timers and cancel some of them. However I'm getting the
> following
> > exception when trying to invoke timer.getInfo() method:
> >
> > java.lang.IllegalStateException: Invocation cannot be null
> > at
> >
> com.sun.ejb.containers.TimerWrapper.checkCallPermission(TimerWrapper.j
> > av
> > a:197)
> > at
> > com.sun.ejb.containers.TimerWrapper.getInfo(TimerWrapper.java:132)
> > ... (my callback here)
> >
> > Any idea what can be a workaround?
> >
> > /Leonid
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> > For additional commands, e-mail: users-help@glassfish.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net