• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Invocation of a TimerService

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Can anybody explain me the exact sequence of events that should take place for the invocation of a timer service. What is a setSessionContext method. I don't find it anywhere in the api.

With Regards
Deepthi
 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Copied from internet -
The SessionContext interface provides access to the runtime session context that the container provides for a session enterprise Bean instance. The container passes the SessionContext interface to an instance after the instance has been created. The session context remains associated with the instance for the lifetime of the instance.

Copied from internet -
The setSessionContext() method of the SessionContext interface is used by the container to pass a reference to the bean’s session context. The container calls this method after an instance of the bean is created. The bean uses the reference to interact with the container during its life.

SessionContext.html

EJBContext.html, must see.

Exmple


 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand your question correctly about Timer, you want to know how Timer works. Right ? I didn't get your question correctly I apologize.

Timer can be two types, programmatic and automatic.
For Programmatic Timer, you inject TimerService in your Bean and create Timer programmatically using one of the 4 createTimer methods of TimerService.

When Bean instantiates and come to the point where it can create timer, it creates Timer instance and Timer executes timeout callback method as specified while creating timer.

For Automatic Timer, we can use @Scheduler. You can specify when you want to run a particular task in schedule. Timer gets created automatically.
Timer doesn't die with Bean. Once it gets created and bean dies still Timer can execute in the server.

Below URL has some more good information on timer.

Timers in EJB3


Thanks.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prasad Kumbhare wrote:If I understand your question correctly about Timer, you want to know how Timer works. Right ? I didn't get your question correctly I apologize.

Timer can be two types, programmatic and automatic.
For Programmatic Timer, you inject TimerService in your Bean and create Timer programmatically using one of the 4 createTimer methods of TimerService.

When Bean instantiates and come to the point where it can create timer, it creates Timer instance and Timer executes timeout callback method as specified while creating timer.

For Automatic Timer, we can use @Scheduler. You can specify when you want to run a particular task in schedule. Timer gets created automatically.
Timer doesn't die with Bean. Once it gets created and bean dies still Timer can execute in the server.

Below URL has some more good information on timer.

Timers in EJB3


Thanks.


Well,that is really interesting and useful what you did say about Schedulers, but that is part of EJB 3.1 and hence out of SCBCD 5.0 scope, do you agree?
I meant topic starter probably asked about times in 3.0 only.
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic