org.norther.tammi.core.thread
Class DefaultTimeout

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.thread.DefaultScheduler
          extended by org.norther.tammi.core.thread.DefaultTimeout
All Implemented Interfaces:
Serializable, EventListener, NotificationBroadcaster, NotificationEmitter, NotificationListener, ScheduledTimer, Manageable, MBeanDelegate, Startable, Scheduler, Timeout

public class DefaultTimeout
extends DefaultScheduler
implements Timeout

A default implementation of Timeout.

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
DefaultTimeout()
          Constructs a new scheduler.
 
Method Summary
 Future close(Closeable target, long timeout, boolean interrupt)
          Closes the given closeable after a timeout.
 Future close(ServerSocket socket, long timeout, boolean interrupt)
          Closes the given server socket after a timeout.
 Future close(Socket socket, long timeout, boolean interrupt)
          Closes the given socket after a timeout.
 Future execute(Callable command, long timeout)
          Executes the given callable command after a timeout.
 Future execute(Runnable command, long timeout)
          Executes the given command after a timeout.
 boolean isLoggingEnabled()
          Checks whether timeout logging of this scheduler is enabled.
 void setLoggingEnabled(boolean flag)
          Sets whether timoeut logging of this scheduler is enabled.
 
Methods inherited from class org.norther.tammi.core.thread.DefaultScheduler
executeAfterDelay, executeAfterDelay, executeAt, executeAt, executePeriodically, executePeriodically, executePeriodically, getExecutor, getExecutorName, getIdleCommand, getIdleDelay, getThreadFactoryName, getTimer, handleNotification, isIdleSupported, isStarted, postmanaged, setExecutorName, setIdleCommand, setIdleDelay, setThreadFactoryName, start, stop, unmanaged
 
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.Timeout
getExecutorName, getThreadFactoryName, setExecutorName, setThreadFactoryName
 
Methods inherited from interface org.norther.tammi.core.base.Startable
isStarted, start, stop
 

Constructor Detail

DefaultTimeout

public DefaultTimeout()
Constructs a new scheduler.

Method Detail

isLoggingEnabled

public boolean isLoggingEnabled()
Description copied from interface: Timeout
Checks whether timeout logging of this scheduler is enabled.

Specified by:
isLoggingEnabled in interface Timeout
Returns:
true if logging is enabled, false otherwise.

setLoggingEnabled

public void setLoggingEnabled(boolean flag)
Description copied from interface: Timeout
Sets whether timoeut logging of this scheduler is enabled.

Specified by:
setLoggingEnabled in interface Timeout
Parameters:
flag - true if logging is enabled, false otherwise.

execute

public Future execute(Runnable command,
                      long timeout)
Description copied from interface: Timeout
Executes the given command after a timeout.

Specified by:
execute in interface Timeout
Parameters:
command - the runnable to execute.
timeout - the timeout in msecs.
Returns:
a future task.

execute

public Future execute(Callable command,
                      long timeout)
Description copied from interface: Timeout
Executes the given callable command after a timeout.

Specified by:
execute in interface Timeout
Parameters:
command - the callable to execute.
timeout - the timeout in msecs.
Returns:
a future task.

close

public Future close(ServerSocket socket,
                    long timeout,
                    boolean interrupt)
Description copied from interface: Timeout
Closes the given server socket after a timeout.

Specified by:
close in interface Timeout
Parameters:
socket - the socket to close.
timeout - the timeout in msecs.
interrupt - interrupt this thread before closing if true.
Returns:
a future task.

close

public Future close(Socket socket,
                    long timeout,
                    boolean interrupt)
Description copied from interface: Timeout
Closes the given socket after a timeout.

Specified by:
close in interface Timeout
Parameters:
socket - the socket to close.
timeout - the timeout in msecs.
interrupt - interrupt this thread before closing if true.
Returns:
a future task.

close

public Future close(Closeable target,
                    long timeout,
                    boolean interrupt)
Description copied from interface: Timeout
Closes the given closeable after a timeout.

Specified by:
close in interface Timeout
Parameters:
target - the closeable to close.
timeout - the timeout in msecs.
interrupt - interrupt this thread before closing if true.
Returns:
a future task.


Copyright © 2004 The Norther Organization. All rights reserved.