com.iparelan.util
Interface ConcurrencyTools.Shutdownable

Enclosing class:
ConcurrencyTools

public static interface ConcurrencyTools.Shutdownable

A Shutdownable is an execution resource than can be shutdown for termination.

Shutdownable is to execution resources as Closeable is to I/O resources.

This type is the result of applying the "Extract Interface" refactoring to the portion of ExecutorService concerned with shutdown and termination.

See Also:
"Refactoring," Martin Fowler, "Extract Interface", ExecutorService

Nested Class Summary
static class ConcurrencyTools.Shutdownable.ShutdownClosingPolicy
          Specifies the policy to execute when shutdown() is called.
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
 void shutdown()
          "Gracefully" shuts down the execution resources held by this Shutdownable.
 List<Runnable> shutdownNow()
          Abruptly shuts down the execution resources held by this Shutdownable.
 

Method Detail

shutdown

void shutdown()
"Gracefully" shuts down the execution resources held by this Shutdownable.

Throws:
InterruptedException - Iff the execution resources held by this Shutdownable could not be shutdown. Subtypes are free to specify whether subsequent invocations of shutdown() may succeed after a failed invocation.
See Also:
ExecutorService

shutdownNow

List<Runnable> shutdownNow()
Abruptly shuts down the execution resources held by this Shutdownable. Think "kill -9".

Throws:
InterruptedException - Iff the execution resources held by this Shutdownable could not be shutdown. Subtypes are free to specify whether subsequent invocations of shutdown() may succeed after a failed invocation.
See Also:
ExecutorService

isShutdown

boolean isShutdown()
See Also:
ExecutorService

isTerminated

boolean isTerminated()
See Also:
ExecutorService

awaitTermination

boolean awaitTermination(long timeout,
                         TimeUnit unit)
See Also:
ExecutorService


Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.