org.ops4j.peaberry.util.decorators
Class StickyDecorator<S>
java.lang.Object
org.ops4j.peaberry.util.decorators.StickyDecorator<S>
- All Implemented Interfaces:
- ImportDecorator<S>
public final class StickyDecorator<S>
- extends Object
- implements ImportDecorator<S>
An ImportDecorator that caches the first valid service instance and
uses that until it becomes invalid. The decorator then calls the reset task
to see if it should reset the cache and get a new service instance.
If no reset task is provided, the service instance cache is never reset.
Note: sticky decorators only really make sense for single services.
- Author:
- mcculls@gmail.com (Stuart McCulloch)
|
Method Summary |
|
decorate(Import<T> service)
Decorate the given imported service. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StickyDecorator
public StickyDecorator(Callable<Boolean> resetTask)
decorate
public <T extends S> Import<T> decorate(Import<T> service)
- Description copied from interface:
ImportDecorator
- Decorate the given imported service.
- Specified by:
decorate in interface ImportDecorator<S>
- Parameters:
service - imported service handle
- Returns:
- decorated service handle
Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.