net.sf.mybatchfwk.jmx
Class ManagedBatchService

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by net.sf.mybatchfwk.jmx.ManagedBatchService
All Implemented Interfaces:
javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ManagedBatchServiceMBean

public class ManagedBatchService
extends javax.management.NotificationBroadcasterSupport
implements ManagedBatchServiceMBean

Default implementation of the MBean interface

Author:
Jérôme Bertèche (cyberteche@users.sourceforge.net)

Field Summary
protected static java.lang.String[] STATES_LABELS
           
 
Constructor Summary
ManagedBatchService(BatchService batchService)
          Register the batch service to the JMX MBean server
 
Method Summary
 java.util.Date getBeginDate()
          Return the begin date of the execution
 java.util.Date getEndDate()
          Return the end date of the execution
 long getNumberOfCompletedTasks()
          Return the number of completed tasks
 long getNumberOfFailedTasks()
          Return the number of failed tasks
 java.lang.String getState()
          Return the current batch state
 void notifyBatchState(BatchService.STATE newState)
          Send a JMX notification that contains the new state of the batch
 void pause()
          Pause operation.
 void restart()
          Restart operation.
 void resume()
          Resume operation.
 void shutdown()
          Shutdown operation.
 void shutdownNow()
          Shutdown now operation.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATES_LABELS

protected static final java.lang.String[] STATES_LABELS
Constructor Detail

ManagedBatchService

public ManagedBatchService(BatchService batchService)
                    throws javax.management.MalformedObjectNameException,
                           java.lang.NullPointerException,
                           javax.management.InstanceAlreadyExistsException,
                           javax.management.MBeanRegistrationException,
                           javax.management.NotCompliantMBeanException
Register the batch service to the JMX MBean server

Parameters:
batchService -
Throws:
java.lang.NullPointerException
javax.management.MalformedObjectNameException
javax.management.NotCompliantMBeanException
javax.management.MBeanRegistrationException
javax.management.InstanceAlreadyExistsException
Method Detail

pause

public void pause()
           throws java.lang.Exception
Description copied from interface: ManagedBatchServiceMBean
Pause operation.
Suspends the execution of the batch/executor/schedule services.
Required batch state: running

Specified by:
pause in interface ManagedBatchServiceMBean
Throws:
java.lang.Exception - if the state of the batch cannot permit this operation.

resume

public void resume()
            throws java.lang.Exception
Description copied from interface: ManagedBatchServiceMBean
Resume operation.
Resume the execution of the batch/executor/schedule services.
Required batch state: sleeping, waiting for launch, waiting for shutdown

Specified by:
resume in interface ManagedBatchServiceMBean
Throws:
java.lang.Exception - if the state of the batch cannot permit this operation.

shutdown

public void shutdown()
              throws java.lang.Exception
Description copied from interface: ManagedBatchServiceMBean
Shutdown operation.
Stop the execution of the batch. Wait for the execution of the submitted tasks before to terminate.
Required batch state: all

Specified by:
shutdown in interface ManagedBatchServiceMBean
Throws:
java.lang.Exception - if the state of the batch cannot permit this operation.

shutdownNow

public void shutdownNow()
                 throws java.lang.Exception
Description copied from interface: ManagedBatchServiceMBean
Shutdown now operation.
Stop the execution of the batch immediately.
Warning: the running tasks will be stopped abruptly.
Required batch state: all

Specified by:
shutdownNow in interface ManagedBatchServiceMBean
Throws:
java.lang.Exception - if the state of the batch cannot permit this operation.

restart

public void restart()
             throws java.lang.Exception
Description copied from interface: ManagedBatchServiceMBean
Restart operation.
Restart the execution of the batch.
Required batch state: waiting for shutdown

Specified by:
restart in interface ManagedBatchServiceMBean
Throws:
java.lang.Exception - if the state of the batch cannot permit this operation.

getState

public java.lang.String getState()
Description copied from interface: ManagedBatchServiceMBean
Return the current batch state

Specified by:
getState in interface ManagedBatchServiceMBean
Returns:

getBeginDate

public java.util.Date getBeginDate()
Description copied from interface: ManagedBatchServiceMBean
Return the begin date of the execution

Specified by:
getBeginDate in interface ManagedBatchServiceMBean
Returns:

getEndDate

public java.util.Date getEndDate()
Description copied from interface: ManagedBatchServiceMBean
Return the end date of the execution

Specified by:
getEndDate in interface ManagedBatchServiceMBean
Returns:

getNumberOfCompletedTasks

public long getNumberOfCompletedTasks()
Description copied from interface: ManagedBatchServiceMBean
Return the number of completed tasks

Specified by:
getNumberOfCompletedTasks in interface ManagedBatchServiceMBean
Returns:

getNumberOfFailedTasks

public long getNumberOfFailedTasks()
Description copied from interface: ManagedBatchServiceMBean
Return the number of failed tasks

Specified by:
getNumberOfFailedTasks in interface ManagedBatchServiceMBean
Returns:

notifyBatchState

public void notifyBatchState(BatchService.STATE newState)
Send a JMX notification that contains the new state of the batch

Parameters:
newState -


Copyright © 2006 null. All Rights Reserved.