|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.test.FarragoObjectCacheTest.RentalCarAgency
private class FarragoObjectCacheTest.RentalCarAgency
RentalCarAgency exemplifies a cache of reusable objects.
Field Summary | |
---|---|
private boolean |
exclusiveRentals
|
private FarragoObjectCache |
fleet
|
private FarragoCompoundAllocation |
owner
|
Constructor Summary | |
---|---|
FarragoObjectCacheTest.RentalCarAgency(boolean exclusiveRentals,
long maxTires)
Creates a new agency. |
Method Summary | |
---|---|
void |
decommissionEntireFleet()
Decommissions all cars in the fleet; subsequent requests will require creation of new cars. |
long |
getTiresInFleet()
|
void |
initializeEntry(Object key,
FarragoObjectCache.UninitializedEntry entry)
Initializes a cache entry. |
boolean |
isExclusive()
|
boolean |
isStale(Object value)
Tests a cached object for staleness. |
(package private) FarragoObjectCacheTest.RentalCarAgreement |
rentCar(String description)
Rents out a car of a given description. |
(package private) void |
returnCar(FarragoObjectCacheTest.RentalCarAgreement agreement)
Records that a customer has returned a car, terminating the agreement. |
void |
shutDown()
Shuts down this agency and verifies that its business affairs were cleanly terminated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private FarragoCompoundAllocation owner
private FarragoObjectCache fleet
private boolean exclusiveRentals
Constructor Detail |
---|
FarragoObjectCacheTest.RentalCarAgency(boolean exclusiveRentals, long maxTires)
exclusiveRentals
- if true, cars are rented out exclusively; if
false, cars can be shared by customers as long as the description of
the car is the same (more like hailing a cab and sharing the ride)maxTires
- maximum number of tires which can exist in fleet at
any one timeMethod Detail |
---|
FarragoObjectCacheTest.RentalCarAgreement rentCar(String description)
description
- of car to rent
void returnCar(FarragoObjectCacheTest.RentalCarAgreement agreement)
agreement
- agreement to be terminatedpublic void initializeEntry(Object key, FarragoObjectCache.UninitializedEntry entry)
FarragoObjectCache.CachedObjectFactory
initializeEntry
in interface FarragoObjectCache.CachedObjectFactory
key
- key of the object to be constructedentry
- to initialize by calling its FarragoObjectCache.UninitializedEntry.initialize(java.lang.Object, long, boolean)
method; failing to call initialize
will lead to a subsequent assertion (unless an exception is thrown to
indicate initialization failure)public boolean isStale(Object value)
FarragoObjectCache.CachedObjectFactory
isStale
in interface FarragoObjectCache.CachedObjectFactory
public long getTiresInFleet()
public void decommissionEntireFleet()
public boolean isExclusive()
public void shutDown()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |