Reader small image

You're reading from  Java EE 7 Development with NetBeans 8

Product typeBook
Published inJan 2015
Reading LevelIntermediate
PublisherPackt
ISBN-139781783983520
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
David R Heffelfinger
David R Heffelfinger
author image
David R Heffelfinger

David Heffelfinger is the Chief Technology Officer of Ensode Technology, LLC, a software consulting firm based in the greater Washington DC area. He has been architecting, designing, and developing software professionally since 1995, and has been using Java as his primary programming language since 1996. He has worked on many large-scale projects for several clients including the US Department of Homeland Security, Freddie Mac, Fannie Mae, and the US Department of Defense. He also has a Masters degree in Software Engineering from Southern Methodist University. David is Editor-in-Chief of Ensode.net (http://www.ensode.net), a website about Java, Linux, and other technology topics.
Read more about David R Heffelfinger

Right arrow

The EJB Timer service


Stateless session beans and message-driven beans (another type of EJB discussed later in the book) can have a method that is executed automatically at regular intervals. This functionality is useful if we want to execute some logic periodically (once a week, every day, every other hour, and so on) without having to explicitly call any methods. This functionality is achieved by the EJB Timer service.

In order to use the EJB Timer service, we need to use the @Schedule annotation to specify when our method will be called. NetBeans provides a handy wizard that we can use to help us in the process.

The next step in the wizard allows us to select several options.

We can implement our bean either as a stateless or as a singleton session bean. We can also choose to create either a local or a remote interface. Local interfaces are optional, and remote interfaces are required only if we need to access our session bean from a different JVM. So, in our example, we choose not to create...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Java EE 7 Development with NetBeans 8
Published in: Jan 2015Publisher: PacktISBN-13: 9781783983520

Author (1)

author image
David R Heffelfinger

David Heffelfinger is the Chief Technology Officer of Ensode Technology, LLC, a software consulting firm based in the greater Washington DC area. He has been architecting, designing, and developing software professionally since 1995, and has been using Java as his primary programming language since 1996. He has worked on many large-scale projects for several clients including the US Department of Homeland Security, Freddie Mac, Fannie Mae, and the US Department of Defense. He also has a Masters degree in Software Engineering from Southern Methodist University. David is Editor-in-Chief of Ensode.net (http://www.ensode.net), a website about Java, Linux, and other technology topics.
Read more about David R Heffelfinger