Example on Timer Service

Contents:

Introduction

This is a simple example to illustrate the usage of Timer MBeans .Timer MBeans are used to send notifications at specific dates and times.
__________________________________________________________________________________________________________________________

Overview

The main file StandardJmxAgent.java has 3 adaptors (HTTP/RMI/CORBA) registered with the MBeanServer. Thus stating that the SimpleClass standard-mbean can be managed by HTTP/RMI/CORBA adaptors. It also includes the HttpConnector.
__________________________________________________________________________________________________________________________

Getting Started :

Source files

Following are the source files generated,

Compilation

To compile the source files go to WebNMS/JavaAgent/examples/jmx/timer directory in the command prompt and type,

         compile *.java [Windows] or
         sh compile sh *.java [Linux/Solaris]

This will compile the source files in the respective directory.

Running the Agent

To start the agent go to WebNMS/JavaAgent/examples/jmx/timer directory in the command prompt and

1. Use run.bat or run.sh

          By default,
                  (a) RMI registry service will be started at port 1099
                  (b) CORBA naming service will be started at port 1050
 
2. The file StandardJmxAgent.java has the code to instantiate the timer.

3. The notifications to be sent should be added to the Timer .

4. The timer checks the notifications and sends the notifications.

5. In this example, one notification is added so that it occurs thrice for a specific period of time.
 

Testing

The notification details are printed on the console.
__________________________________________________________________________________________________________________________

Copyright (c) 2009  ZOHO Corp. All Rights Reserved.