com.amazon.carbonado.capability
Interface ShutdownCapability

All Superinterfaces:
Capability
All Known Implementing Classes:
AbstractRepository

public interface ShutdownCapability
extends Capability

Capability for repositories that require special attention with the Java virtual machine exits.

Author:
Brian S O'Neill

Method Summary
 boolean isAutoShutdownEnabled()
          Returns true if repository has a shutdown hook registered to automatically call shutdown when the virtual machine exits.
 void setAutoShutdownEnabled(boolean enabled)
          Request to enable or disable the automatic shutdown hook.
 void shutdown()
          Similar to calling close on a repository, except should only be called when the virtual machine is in the process of shutting down.
 

Method Detail

isAutoShutdownEnabled

boolean isAutoShutdownEnabled()
Returns true if repository has a shutdown hook registered to automatically call shutdown when the virtual machine exits.


setAutoShutdownEnabled

void setAutoShutdownEnabled(boolean enabled)
Request to enable or disable the automatic shutdown hook. Repository may ignore this request if shutdown is in progress.

Throws:
SecurityException - if caller does not have permission

shutdown

void shutdown()
Similar to calling close on a repository, except should only be called when the virtual machine is in the process of shutting down. Calling close may cause spurious exceptions to be thrown by other threads which may be interacting with the repository. Shutdown tries to reduce these exceptions from being thrown by effectively suspending any threads which continue to interact with this repository. For this reason, this method should only ever be called during a virtual machine shutdown.

Repositories may choose to implement this method by simply calling close. There is no guarantee that shutdown will reduce exceptions, and it might not suspend any threads. Also, repositories that require proper shutdown should automatically register runtime hooks, and so this method usually doesn't need to be called manually.

Throws:
SecurityException - if caller does not have permission


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.