org.ops4j.peaberry.cache
Class AbstractServiceImport<T>

java.lang.Object
  extended by org.ops4j.peaberry.cache.AbstractServiceImport<T>
All Implemented Interfaces:
Comparable<Import<T>>, Import<T>

public abstract class AbstractServiceImport<T>
extends Object
implements Import<T>, Comparable<Import<T>>

Partial Import implementation with generation based caching.

Author:
mcculls@gmail.com (Stuart McCulloch)

Constructor Summary
protected AbstractServiceImport()
           
 
Method Summary
protected abstract  T acquireService()
           
 boolean available()
          Is the service instance available?
 T get()
          Start using the imported service instance.
protected abstract  boolean hasRankingChanged()
           
protected abstract  void releaseService(T o)
           
static void setCacheGeneration(int newGeneration)
           
 void unget()
          Stop using the imported service instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ops4j.peaberry.Import
attributes
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractServiceImport

protected AbstractServiceImport()
Method Detail

get

public final T get()
Description copied from interface: Import
Start using the imported service instance.

Specified by:
get in interface Import<T>
Returns:
service instance

unget

public final void unget()
Description copied from interface: Import
Stop using the imported service instance.

Specified by:
unget in interface Import<T>

available

public final boolean available()
Description copied from interface: Import
Is the service instance available?

Specified by:
available in interface Import<T>
Returns:
true if the service is available, otherwise false

setCacheGeneration

public static final void setCacheGeneration(int newGeneration)

acquireService

protected abstract T acquireService()

hasRankingChanged

protected abstract boolean hasRankingChanged()

releaseService

protected abstract void releaseService(T o)


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.