net.sourceforge.acelogger.execution.manager
Class EmptyExecutorManager

java.lang.Object
  extended by net.sourceforge.acelogger.execution.manager.EmptyExecutorManager
All Implemented Interfaces:
ExecutorManager, Identifiable

public class EmptyExecutorManager
extends Object
implements ExecutorManager

A implementation of ExecutorManager that do nothing.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Constructor Summary
EmptyExecutorManager(String identifier)
          Constructs a new EmptyExecutorManager with the supplied identifier.
 
Method Summary
 boolean awaitTermination(long terminationTimeout)
          Waits the execution of pending tasks in this executor manager.
 void execute(Runnable command)
          Executes the given command within this executor.
 void executeAll(List<Runnable> commands)
          Executes the given commands within this executor, one by one.
 String getIdentifier()
          Gets a String that identifies this object.
 boolean isTerminated()
          Returns true if this executor manager has ended its execution scheduling.
 boolean orderProperShutdown()
          Orders the proper shutdown of this executor manager, this is accomplished in most of the implementations by waiting all pending tasks or a given timeout.
 List<Runnable> terminateAndRetrieveTasks()
          Terminates this executor manager, return a list of tasks that were not executed after a proper shutdown was ordered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyExecutorManager

public EmptyExecutorManager(String identifier)
Constructs a new EmptyExecutorManager with the supplied identifier.

Parameters:
identifier - A string that identifies this executor manager.
Since:
1.0.0
Method Detail

getIdentifier

public final String getIdentifier()
Gets a String that identifies this object.

Specified by:
getIdentifier in interface Identifiable
Returns:
The identifier of this object.

execute

public void execute(Runnable command)
Executes the given command within this executor. This method should block until the command execution or not, this will depend on the implementation.

Specified by:
execute in interface ExecutorManager
Parameters:
command - The task to be executed.

executeAll

public void executeAll(List<Runnable> commands)
Executes the given commands within this executor, one by one. This method should block until the command execution or not, this will depend on the implementation.

Specified by:
executeAll in interface ExecutorManager
Parameters:
commands - A list of tasks to be executed.

isTerminated

public boolean isTerminated()
Returns true if this executor manager has ended its execution scheduling.

Specified by:
isTerminated in interface ExecutorManager
Returns:
True if the executor manager was shutdown; False otherwise.

orderProperShutdown

public boolean orderProperShutdown()
Orders the proper shutdown of this executor manager, this is accomplished in most of the implementations by waiting all pending tasks or a given timeout.

Specified by:
orderProperShutdown in interface ExecutorManager
Returns:
True if the executor shutdown process was successful; False otherwise.

awaitTermination

public boolean awaitTermination(long terminationTimeout)
Waits the execution of pending tasks in this executor manager. This method must be called after ordering a proper shutdown.

Specified by:
awaitTermination in interface ExecutorManager
Parameters:
terminationTimeout - The maximum time (in ms) to wait for remaining tasks to execute.
Returns:
True if the executor finished processing all of it's tasks; False if timeout was reached during the wait.
See Also:
ExecutorManager.orderProperShutdown()

terminateAndRetrieveTasks

public List<Runnable> terminateAndRetrieveTasks()
Terminates this executor manager, return a list of tasks that were not executed after a proper shutdown was ordered. This method should be called preferably after waiting for the tasks to execute.

Specified by:
terminateAndRetrieveTasks in interface ExecutorManager
Returns:
A list containing the tasks pending execution.
See Also:
ExecutorManager.orderProperShutdown(), ExecutorManager.awaitTermination(long)


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.