org.norther.tammi.core.thread
Interface Timeout

All Superinterfaces:
Startable
All Known Implementing Classes:
DefaultTimeout

public interface Timeout
extends Startable

A specific scheduler for executing timeout commands.

Author:
Ilkka Priha

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.
 ObjectName getExecutorName()
          Gets the the executor of this timeout.
 ObjectName getThreadFactoryName()
          Gets the thread factory of this timeout.
 boolean isLoggingEnabled()
          Checks whether timeout logging of this scheduler is enabled.
 void setExecutorName(ObjectName executor)
          Sets the executor of this timeout.
 void setLoggingEnabled(boolean flag)
          Sets whether timoeut logging of this scheduler is enabled.
 void setThreadFactoryName(ObjectName factory)
          Sets the thread factory of this timeout.
 
Methods inherited from interface org.norther.tammi.core.base.Startable
isStarted, start, stop
 

Method Detail

isLoggingEnabled

boolean isLoggingEnabled()
Checks whether timeout logging of this scheduler is enabled.

Returns:
true if logging is enabled, false otherwise.

setLoggingEnabled

void setLoggingEnabled(boolean flag)
Sets whether timoeut logging of this scheduler is enabled.

Parameters:
flag - true if logging is enabled, false otherwise.

getThreadFactoryName

ObjectName getThreadFactoryName()
Gets the thread factory of this timeout.

Returns:
the name of the factory or a query.

setThreadFactoryName

void setThreadFactoryName(ObjectName factory)
Sets the thread factory of this timeout.

Parameters:
factory - the name of the factory or a query.

getExecutorName

ObjectName getExecutorName()
Gets the the executor of this timeout.

Returns:
the object name of the executor or a query.

setExecutorName

void setExecutorName(ObjectName executor)
Sets the executor of this timeout. If it is not set, the default one will be used.

Parameters:
executor - the object name of the executor or a query.

execute

Future execute(Runnable command,
               long timeout)
Executes the given command after a timeout.

Parameters:
command - the runnable to execute.
timeout - the timeout in msecs.
Returns:
a future task.
Throws:
NullPointerException - for missing resources.
IllegalStateException - if not registered and started.

execute

Future execute(Callable command,
               long timeout)
Executes the given callable command after a timeout.

Parameters:
command - the callable to execute.
timeout - the timeout in msecs.
Returns:
a future task.
Throws:
NullPointerException - for missing resources.
IllegalStateException - if not registered and started.

close

Future close(ServerSocket socket,
             long timeout,
             boolean interrupt)
Closes the given server socket after a timeout.

Parameters:
socket - the socket to close.
timeout - the timeout in msecs.
interrupt - interrupt this thread before closing if true.
Returns:
a future task.
Throws:
NullPointerException - for missing resources.
IllegalStateException - if not registered and started.

close

Future close(Socket socket,
             long timeout,
             boolean interrupt)
Closes the given socket after a timeout.

Parameters:
socket - the socket to close.
timeout - the timeout in msecs.
interrupt - interrupt this thread before closing if true.
Returns:
a future task.
Throws:
NullPointerException - for missing resources.
IllegalStateException - if not registered and started.

close

Future close(Closeable target,
             long timeout,
             boolean interrupt)
Closes the given closeable after a timeout.

Parameters:
target - the closeable to close.
timeout - the timeout in msecs.
interrupt - interrupt this thread before closing if true.
Returns:
a future task.
Throws:
NullPointerException - for missing resources.
IllegalStateException - if not registered and started.


Copyright © 2004 The Norther Organization. All rights reserved.