org.norther.tammi.core.thread
Class DefaultThreadedExecutor

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.thread.AbstractExecutor
          extended by org.norther.tammi.core.thread.DefaultThreadedExecutor
All Implemented Interfaces:
Serializable, Executor, ExecutorService, EventListener, NotificationBroadcaster, NotificationEmitter, NotificationListener, Manageable, MBeanDelegate, Startable, ThreadedExecutor
Direct Known Subclasses:
DefaultPooledExecutor

public class DefaultThreadedExecutor
extends AbstractExecutor
implements ThreadedExecutor, NotificationListener

A default implementation of ThreadedExecutor.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultThreadedExecutor()
          Constructs a new threaded executor.
 
Method Summary
protected  ExecutorService getExecutor()
          Gets the implementation of the executor.
 ObjectName getThreadFactoryName()
          Gets the thread factory of this executor.
 void handleNotification(Notification notif, Object handback)
          Handles notifications from the embedded thread factory.
protected  ExecutorService newExecutor()
          Creates the implementation of the executor.
 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 setThreadFactoryName(ObjectName factory)
          Sets the thread factory of this executor.
 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.thread.AbstractExecutor
awaitTermination, execute, getActiveCount, getCompletedTaskCount, getTaskCount, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isStarted, isTerminated, shutdown, shutdownNow, start, stop, submit, submit, submit
 
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
 
Methods inherited from interface org.norther.tammi.core.thread.Executor
getActiveCount, getCompletedTaskCount, getTaskCount
 
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit
 
Methods inherited from interface java.util.concurrent.Executor
execute
 
Methods inherited from interface org.norther.tammi.core.base.Startable
isStarted, start, stop
 

Constructor Detail

DefaultThreadedExecutor

public DefaultThreadedExecutor()
Constructs a new threaded executor.

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 AbstractExecutor

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 AbstractExecutor
Throws:
Exception - if the adaptee refused to be unmanaged.

getThreadFactoryName

public ObjectName getThreadFactoryName()
Description copied from interface: ThreadedExecutor
Gets the thread factory of this executor.

Specified by:
getThreadFactoryName in interface ThreadedExecutor
Returns:
the name of the factory or a query.

setThreadFactoryName

public void setThreadFactoryName(ObjectName factory)
Description copied from interface: ThreadedExecutor
Sets the thread factory of this executor.

Specified by:
setThreadFactoryName in interface ThreadedExecutor
Parameters:
factory - the name of the factory or a query.

handleNotification

public void handleNotification(Notification notif,
                               Object handback)
Handles notifications from the embedded thread factory.

Specified by:
handleNotification in interface NotificationListener
Parameters:
notif - the notification.
handback - not used.

getExecutor

protected ExecutorService getExecutor()
Description copied from class: AbstractExecutor
Gets the implementation of the executor.

Overrides:
getExecutor in class AbstractExecutor
Returns:
the executor implementation or null if not started.

newExecutor

protected ExecutorService newExecutor()
Description copied from class: AbstractExecutor
Creates the implementation of the executor.

Specified by:
newExecutor in class AbstractExecutor
Returns:
the executor implementation.


Copyright © 2004 The Norther Organization. All rights reserved.