javax.cache
Interface Lifecycle

All Known Subinterfaces:
Cache<K,V>

public interface Lifecycle

Cache resources may have non-trivial initialisation and disposal procedures. As such it is unrealistic to expect them to be avaiable for service after object creation.

This interface defines a lifecycle for these resources and associates a Status with each.

The Status of a newly created resource is Status.UNITIALISED.

Since:
1.7
Author:
Greg Luck

Method Summary
 Status getStatus()
          Returns the cache status.
 void start()
          Notifies providers to start themselves.
 void stop()
          Providers may be doing all sorts of exotic things and need to be able to clean up on stop.
 

Method Detail

start

void start()
           throws CacheException
Notifies providers to start themselves.

This method is called during the resource's start method after it has changed it's status to alive. Cache operations are legal in this method. At the completion of this method invocation getStatus() must return Status.STARTED.

Throws:
CacheException

stop

void stop()
          throws CacheException
Providers may be doing all sorts of exotic things and need to be able to clean up on stop.

Cache operations are illegal after this method is called. A IllegalStateException will be thrown if an operation is performed on CacheManager or any contained Cache while they are stopping or are a stopped.

Resources will change status to Status.STOPPING when this method is called. Once they are stopped they will change status to Status.STOPPED.

Throws:
CacheException

getStatus

Status getStatus()
Returns the cache status.

Returns:
one of Status


true