org.norther.tammi.core.thread
Class DefaultExecutable

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.thread.DefaultExecutable
All Implemented Interfaces:
Serializable, Runnable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, Startable, Executable
Direct Known Subclasses:
DefaultCacheMonitor, DefaultFinalizer

public class DefaultExecutable
extends Adaptee
implements Executable

A default implementation of Executable.

Version:
$Id: DefaultExecutable.java,v 1.7 2009/09/28 15:08:43 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Constructor Summary
DefaultExecutable()
          Constructs a new executable.
DefaultExecutable(boolean multiple)
          Constructs a new executable for multiple threads.
DefaultExecutable(Runnable adaptee)
          Constructs a new executable adapter.
DefaultExecutable(Runnable adaptee, boolean multiple)
          Constructs a new executable adapter for multiple threads.
 
Method Summary
protected  Executor getExecutor()
          Gets the referent of the executor MBean.
 ObjectName getExecutorName()
          Gets the the executor of this executable.
 boolean isStarted()
          Checks whether the startable has been started.
 void postmanaged()
          This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.
 void run()
           
 void setExecutorName(ObjectName executor)
          Sets the executor of this executable.
 void start()
          Starts the MBean.
 void stop()
          Stops the MBean.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExecutable

public DefaultExecutable()
Constructs a new executable.


DefaultExecutable

public DefaultExecutable(boolean multiple)
Constructs a new executable for multiple threads.

Parameters:
multiple - true to allow more than one threads.

DefaultExecutable

public DefaultExecutable(Runnable adaptee)
Constructs a new executable adapter.

Parameters:
adaptee - the adaptee.

DefaultExecutable

public DefaultExecutable(Runnable adaptee,
                         boolean multiple)
Constructs a new executable adapter for multiple threads.

Parameters:
adaptee - the adaptee.
multiple - true to allow more than one threads.
Method Detail

postmanaged

public void postmanaged()
Description copied from interface: Manageable
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.

Specified by:
postmanaged in interface Manageable
Overrides:
postmanaged in class Adaptee

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class Adaptee
Throws:
Exception - if the adaptee refused to be unmanaged.

getExecutorName

public ObjectName getExecutorName()
Description copied from interface: Executable
Gets the the executor of this executable.

Specified by:
getExecutorName in interface Executable
Returns:
the object name of the executor or a query.

setExecutorName

public void setExecutorName(ObjectName executor)
Description copied from interface: Executable
Sets the executor of this executable. If it is not set, the default one will be used.

Note that it will be taken into use after next start.

Specified by:
setExecutorName in interface Executable
Parameters:
executor - the object name of the executor or a query.

isStarted

public boolean isStarted()
Description copied from interface: Startable
Checks whether the startable has been started.

Specified by:
isStarted in interface Startable
Returns:
true if started, otherwise false.

start

public void start()
           throws Exception
Description copied from interface: Startable
Starts the MBean.

Specified by:
start in interface Startable
Throws:
Exception - if start fails.

stop

public void stop()
Description copied from interface: Startable
Stops the MBean.

Specified by:
stop in interface Startable

run

public void run()
Specified by:
run in interface Runnable

getExecutor

protected Executor getExecutor()
Gets the referent of the executor MBean.

Returns:
the referent of the executor MBean.
Throws:
IllegalStateException - if not available.


Copyright © 2004 The Norther Organization. All rights reserved.