Package emissary.place.sample
Class CachePlace
- java.lang.Object
-
- emissary.place.ServiceProviderPlace
-
- emissary.place.sample.CachePlace
-
- All Implemented Interfaces:
IServiceProviderPlace
,ServiceProviderPlaceMBean
public class CachePlace extends ServiceProviderPlace
This place just keeps a reference to the last 10 payload objects it has seen. The number is configurable. It allows processed to look back over a group of payloads.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<IBaseDataObject>
cache
protected int
cacheSize
-
Fields inherited from class emissary.place.ServiceProviderPlace
configG, configLocs, denyList, dirPlace, heavyDutyMethodImplemented, keys, kff, localDirPlace, logger, myKey, placeLocation, placeName, processMethodImplemented, serviceCost, serviceDescription, serviceQuality, slogger
-
Fields inherited from interface emissary.place.IServiceProviderPlace
SPROUT_KEY
-
-
Constructor Summary
Constructors Constructor Description CachePlace(String cfgInfo)
The static standalone (test) constructorCachePlace(String cfgInfo, String dir, String placeLoc)
The remote constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
evictedPayload(IBaseDataObject d)
int
getCacheLimit()
int
getCacheSize()
IBaseDataObject
pop()
void
process(IBaseDataObject d)
Consume a DataObject, and return a transformed one.void
shutDown()
Stop all threads if any.-
Methods inherited from class emissary.place.ServiceProviderPlace
addKey, addServiceProxy, agentProcessCall, agentProcessHeavyDuty, agentProcessHeavyDuty, changesPrimaryView, configureServicePlace, createsExtractedRecords, deregisterFromDirectory, dumpPlaceStats, dumpRunningConfig, getAgent, getAlternateViewsModified, getDirectoryEntry, getFileTypes, getKey, getKeys, getOutputForms, getParametersModified, getPlaceName, getPlaceStats, getPrimaryProxy, getProxies, getResourceLimitMillis, getRunningConfig, getTld, initKff, isDenied, loadConfigurator, loadConfigurator, loadConfigurator, nextKeys, nukeMyProxies, processHeavyDuty, register, register, registerWithDirectory, rehash, removeKey, removeServiceProxy, setLogger, setupPlace, setupPlace, sproutsChildren, toString, unbindFromNamespace, verifyProcessImplementationProvided
-
-
-
-
Field Detail
-
cacheSize
protected int cacheSize
-
cache
protected List<IBaseDataObject> cache
-
-
Constructor Detail
-
CachePlace
public CachePlace(String cfgInfo, String dir, String placeLoc) throws IOException
The remote constructor- Throws:
IOException
-
CachePlace
public CachePlace(String cfgInfo) throws IOException
The static standalone (test) constructor- Throws:
IOException
-
-
Method Detail
-
process
public void process(IBaseDataObject d)
Consume a DataObject, and return a transformed one.- Specified by:
process
in interfaceIServiceProviderPlace
- Overrides:
process
in classServiceProviderPlace
- Parameters:
d
- the payload to be processed
-
evictedPayload
protected void evictedPayload(IBaseDataObject d)
-
getCacheLimit
public int getCacheLimit()
-
getCacheSize
public int getCacheSize()
-
pop
@Nullable public IBaseDataObject pop()
-
shutDown
public void shutDown()
Description copied from class:ServiceProviderPlace
Stop all threads if any. Can be overridden by, deregister from directory, and remove from the namespace. derived classes if needed- Specified by:
shutDown
in interfaceIServiceProviderPlace
- Overrides:
shutDown
in classServiceProviderPlace
-
-