Package net.anotheria.asg.service
Interface InMemoryService<T extends ASGService>
-
- Type Parameters:
T-
public interface InMemoryService<T extends ASGService>A service that holds all the data in memory. An InMemoryService can operate in different modes. Access to the mode definition and configuration is provided by this interface.- Version:
- $Id: $Id
- Author:
- lrosenberg
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears all data if the instance is unpaired.voidpairTo(T instance)Pairs this instance to another service.voidreadFrom(T anInstance)Reads the data from a given instance.voidsynchBack()Synchs the data back to the paired instance.voidsynchTo(T anInstance)Synches current data to a service instance.voidunpair(T instance)Unpairs the service.
-
-
-
Method Detail
-
pairTo
void pairTo(T instance) throws ASGRuntimeException
Pairs this instance to another service. The paired instanceof the service shouldn't be used directly anymore (until unpaired). Pairing is useful if you want to perform bulk write operations and let them be written back to the original service. Pairing will force all current data to be thrown away.- Parameters:
instance- a T object.- Throws:
ASGRuntimeException- if any.
-
unpair
void unpair(T instance) throws ASGRuntimeException
Unpairs the service. Only previously paired service can be unpaired.- Parameters:
instance- a T object.- Throws:
ASGRuntimeException- if any.
-
synchBack
void synchBack() throws ASGRuntimeExceptionSynchs the data back to the paired instance. Should be called before unpairing.- Throws:
ASGRuntimeException- if any.
-
readFrom
void readFrom(T anInstance) throws ASGRuntimeException
Reads the data from a given instance. Only possible if unpaired.- Parameters:
anInstance- a T object.- Throws:
ASGRuntimeException- if any.
-
synchTo
void synchTo(T anInstance) throws ASGRuntimeException
Synches current data to a service instance. The results are quite unpredictable.- Parameters:
anInstance- a T object.- Throws:
ASGRuntimeException- if any.
-
clear
void clear() throws ASGRuntimeExceptionClears all data if the instance is unpaired.- Throws:
ASGRuntimeException- if any.
-
-