Package es.bsc.dataclay.dataservice
Class DataService
- java.lang.Object
-
- es.bsc.dataclay.dataservice.DataService
-
- All Implemented Interfaces:
DataServiceAPI
,CommonManager
public final class DataService extends Object implements DataServiceAPI
This class is responsible to manage data of the objects stored in the system.
-
-
Field Summary
Fields Modifier and Type Field Description String
dsName
DatService name.DataServiceRuntime
runtime
Runtime.
-
Constructor Summary
Constructors Constructor Description DataService(String newdsName, String newdsHostname, int newdsTCPPort, DBHandlerConf dbHandlerconf, DataServiceSrv theownServer)
Instantiates an DataService that uses the DB in the provided path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateTracing(int currentAvailableTaskID)
Activate tracing.void
addLazyTask(ObjectID objectID, LazyTask lazyTask)
Add lazy taskvoid
associateExecutionEnvironment(ExecutionEnvironmentID newexecutionEnvironmentID)
Associate execution environment to this DS.static byte[]
checkGeneratedClass(byte[] classBytes)
void
cleanCaches()
Method that cleans the caches of the manager.void
cleanExecutionClassDirectory()
Deletes all the classes in the execution class directorystatic void
cleanExecutionClasses()
Static function for cleaning paths.void
closeDbHandler()
Close DBHandler.void
closeSessionInDS(SessionID sessionID)
Close session in DS.void
consolidateVersion(SessionID sessionID, ObjectID finalVersionObjectID)
Consolidates object with ID providedvoid
deactivateTracing()
Deactivate Extrae tracingvoid
delete(ExecutionEnvironmentID eeID, ObjectID objectID)
Deletes and object from the database.void
deleteAlias(SessionID sessionID, ObjectID objectID)
Delete alias of object with ID providedvoid
deployClasses(String namespaceName, Map<Tuple<String,MetaClassID>,byte[]> classesToDeploy, Map<String,byte[]> classesAspects, Map<String,byte[]> stubYamls)
Deploys the given class in the path corresponding to the given namespace.void
deployMetaClasses(String namespaceName, Map<String,MetaClass> deploymentPack)
Deploys a series of MetaClass containers to a given namespace.void
detachObjectFromSession(ObjectID objectID, SessionID sessionID)
Detach object from session, i.e.void
disconnectFromOthers()
Disconnect server from others servers.void
enrichClass(String namespaceName, String className, byte[] classToDeploy, byte[] classAspects, byte[] stubYaml)
Enriches the given class in the path corresponding to the given namespace.SerializedParametersOrReturn
executeImplementation(ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, SessionID sessionID)
This function executes a method.void
executeLazyTask(ImplementationID implID, ObjectID paramObjectID, SessionID sessionID, MetaClassID classID)
Execute lazy taskboolean
exists(ObjectID objectID)
Check if the object exists EE memoryboolean
existsInDB(ObjectID objectID)
Check if the object exists in SL or in any EE memory associated to current SLvoid
federate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Federate object with ID provided to external EE specifiedvoid
finishCacheThreads()
Finish cache threads.void
finishClientConnections()
Finish connections in DS.void
gcCollectObjectInternal(DataClayExecutionObject instance)
Update or store object.byte[]
get(ExecutionEnvironmentID eeID, ObjectID objectID)
Get serialized object identified by ObjectIDMetaClassID
getClassIDFromObjectInMemory(ObjectID objectID)
Get ClassID from object in memory.SerializedParametersOrReturn
getCopyOfObject(SessionID sessionID, ObjectID objectID, boolean recursive)
Retrieves the given object and all subobjects as volatile new objects with new OIDsDBHandler
getDbHandler()
Get DbHandler.ExecutionEnvironmentID
getExecutionEnvironmentID()
Returns the backendID of this DS.byte[]
getLocal(ObjectID objectID)
Get from this DBint
getNumObjects()
Get number of objects in SL and all its associated EEsint
getNumObjectsInEE()
Get number of alive objects in current EEint
getNumReferencesTo(ObjectID objectID)
Return number of references pointing to object.List<ObjectWithDataParamOrReturn>
getObjects(SessionID sessionID, Set<ObjectID> objectIDs, Set<ObjectID> alreadyObtainedObjs, boolean recursive, ExecutionEnvironmentID replicaDestBackendID, int updateReplicaLocs)
Get the serialized objects with id providedSet<ObjectID>
getRetainedReferences()
Get IDs of references retained by EE.StorageLocationID
getStorageLocationID()
Returns the backendID of this DS.StorageLocationService
getStorageLocationService()
Only for testing and SL representing a storage location, get storage location service.Map<String,byte[]>
getTraces()
Get Extrae traces (mpits and set files)void
initBackendID(StorageLocationID newbackendID)
Initializes the backend ID of this DataServicevoid
initLocalWithAutoregistration(String logicModuleHost, int tcpLogicModulePort, String dataServiceName)
Perform a local initialization, and perform the autoregisterDataService to the LogicModulevoid
makePersistent(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
This function will deserialize make persistent "parameters" (i.e.Tuple<Map<StorageLocationID,Set<ObjectID>>,Set<ObjectID>>
migrateObjectsToBackends(Map<StorageLocationID,StorageLocation> backends)
Migrate every object of this backend to one of the backends specifiedSet<ObjectID>
moveObjects(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destLocation, boolean recursive)
Move object from this location to the one specifiedObjectID
newPersistentInstance(SessionID sessionID, MetaClassID classID, ImplementationID implementationID, Map<MetaClassID,byte[]> ifaceBitMaps, SerializedParametersOrReturn params)
Create an instance of the class with id provided using constructor with id and params specified and store it.Set<ObjectID>
newReplica(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID, boolean recursive)
This operation creates a new replica of the object with ID provided in the backend specifiedObjectID
newVersion(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID)
This operation creates a new version of the object with ID provided in the backend specifiedvoid
notifyExecutionEnvironmentShutdown()
Notify LM current execution environment leftvoid
notifyFederation(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
New federated object arrives and must be stored in current backend.void
notifyStorageLocationShutdown()
Notify LM current storage location leftvoid
notifyUnfederation(SessionID sessionID, Set<ObjectID> objectIDs)
Unfederate objects with ID provided.void
persistEEInfo()
Store EE information.void
registerPendingObjects()
Register all pending objectsMap<ObjectID,ExecutionEnvironmentID>
removeObjects(SessionID sessionID, Set<ObjectID> objectIDs, boolean recursive, boolean moving, ExecutionEnvironmentID newHint)
This operation removes the objects with IDs provided NOTE: This function is recursive, it is going to other DSs if needed.Object
runImplementation(DataClayObject instance, ImplementationID implID, Object[] params)
This function executes the method specifiedvoid
shutDown()
Shutdown server.void
shutdownUpdate()
Update all objects in memory (or store them if new).void
store(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] bytes)
Store the object.void
storeObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objects, boolean moving, Set<ObjectID> idsWithAlias)
Store objects into Database.void
synchronize(SessionID sessionID, ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, ExecutionEnvironmentID callingBackend)
This function synchronizes changes in object fieldvoid
unfederate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Unfederate object with ID provided to external EE specifiedvoid
unregisterFromLogicModule()
Unregister the data service from the logic module.void
update(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] newbytes, boolean dirty)
Updates an object identified by the ID provided with the new values provided.void
updateObject(SessionID sessionID, ObjectID intoObjectID, SerializedParametersOrReturn fromObject)
Method that updates an object (into) with contents obtained from object (from)void
updateRefs(Map<ObjectID,Integer> updateCounterRefs)
Update counters of references.void
upsertObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectIDsAndBytes)
Updates objects or insert if they do not exist with the values in objectBytes.static void
validateClass(org.objectweb.asm.ClassReader reader, ClassLoader loader)
void
waitForExecutionEnvironmentsToFinish()
Wait for all execution environments associated to current data service to finish and return
-
-
-
Field Detail
-
dsName
public final String dsName
DatService name.
-
runtime
public DataServiceRuntime runtime
Runtime.
-
-
Constructor Detail
-
DataService
public DataService(String newdsName, String newdsHostname, int newdsTCPPort, DBHandlerConf dbHandlerconf, DataServiceSrv theownServer)
Instantiates an DataService that uses the DB in the provided path.- Parameters:
newdsName
- DataService namenewdsHostname
- DataService host namenewdsTCPPort
- DataService tcp portdbHandlerconf
- Configuration of the DbHandler to use by the manager.theownServer
- Reference to server instance using this DataService implementation.
-
-
Method Detail
-
persistEEInfo
public void persistEEInfo()
Store EE information.
-
initLocalWithAutoregistration
public void initLocalWithAutoregistration(String logicModuleHost, int tcpLogicModulePort, String dataServiceName) throws Exception
Perform a local initialization, and perform the autoregisterDataService to the LogicModule- Parameters:
logicModuleHost
- Logic Module hosttcpLogicModulePort
- Logic Module portdataServiceName
- DS name- Throws:
Exception
- If an error occurs during this process
-
getStorageLocationID
public StorageLocationID getStorageLocationID()
Returns the backendID of this DS.- Returns:
- ID of the backend assigned to this DS.
-
getExecutionEnvironmentID
public ExecutionEnvironmentID getExecutionEnvironmentID()
Returns the backendID of this DS.- Returns:
- ID of the backend assigned to this DS.
-
initBackendID
public void initBackendID(StorageLocationID newbackendID)
Description copied from interface:DataServiceAPI
Initializes the backend ID of this DataService- Specified by:
initBackendID
in interfaceDataServiceAPI
- Parameters:
newbackendID
- ID of the backend
-
associateExecutionEnvironment
public void associateExecutionEnvironment(ExecutionEnvironmentID newexecutionEnvironmentID)
Description copied from interface:DataServiceAPI
Associate execution environment to this DS.- Specified by:
associateExecutionEnvironment
in interfaceDataServiceAPI
- Parameters:
newexecutionEnvironmentID
- ID to associate
-
deployMetaClasses
public void deployMetaClasses(String namespaceName, Map<String,MetaClass> deploymentPack)
Description copied from interface:DataServiceAPI
Deploys a series of MetaClass containers to a given namespace.- Specified by:
deployMetaClasses
in interfaceDataServiceAPI
- Parameters:
namespaceName
- Name of the namespace classes belongs to.deploymentPack
- A map containing name of the class and the MetaClass container.
-
checkGeneratedClass
public static byte[] checkGeneratedClass(byte[] classBytes)
-
validateClass
public static void validateClass(org.objectweb.asm.ClassReader reader, ClassLoader loader)
-
deployClasses
public void deployClasses(String namespaceName, Map<Tuple<String,MetaClassID>,byte[]> classesToDeploy, Map<String,byte[]> classesAspects, Map<String,byte[]> stubYamls)
Description copied from interface:DataServiceAPI
Deploys the given class in the path corresponding to the given namespace.- Specified by:
deployClasses
in interfaceDataServiceAPI
- Parameters:
namespaceName
- Name of the namespace classes belongs to.classesToDeploy
- bytecode of the classes to be deployed.classesAspects
- bytes of the aspects of this classstubYamls
- Stub yamls.
-
enrichClass
public void enrichClass(String namespaceName, String className, byte[] classToDeploy, byte[] classAspects, byte[] stubYaml)
Description copied from interface:DataServiceAPI
Enriches the given class in the path corresponding to the given namespace.- Specified by:
enrichClass
in interfaceDataServiceAPI
- Parameters:
namespaceName
- Name of the namespace which class belongs to.className
- Name of the class to deployclassToDeploy
- bytecode of the class to be deployed.classAspects
- bytes of the aspects of this classstubYaml
- Stub yaml
-
newPersistentInstance
public ObjectID newPersistentInstance(SessionID sessionID, MetaClassID classID, ImplementationID implementationID, Map<MetaClassID,byte[]> ifaceBitMaps, SerializedParametersOrReturn params)
Description copied from interface:DataServiceAPI
Create an instance of the class with id provided using constructor with id and params specified and store it.- Specified by:
newPersistentInstance
in interfaceDataServiceAPI
- Parameters:
sessionID
- Session ID to useclassID
- Id of the class to useimplementationID
- ID of the implementation of the constructorifaceBitMaps
- Interface bitmaps (for parameters)params
- Parameters- Returns:
- ObjectID of the persisted instance.
-
storeObjects
public void storeObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objects, boolean moving, Set<ObjectID> idsWithAlias)
Description copied from interface:DataServiceAPI
Store objects into Database.- Specified by:
storeObjects
in interfaceDataServiceAPI
- Parameters:
sessionID
- SessionID sessionIDobjects
- Serialized objects to store (still volatile parameters)moving
- If true, indicates that objects are being moved from another DS.idsWithAlias
- Objects with alias
-
makePersistent
public void makePersistent(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
Description copied from interface:DataServiceAPI
This function will deserialize make persistent "parameters" (i.e. object to persist and subobjects if needed) into dataClay memory heap using the same design as for volatile parameters. Eventually, dataClay GC will collect them, and then they will be registered in LogicModule if needed (if objects were created with alias, they must have metadata already).- Specified by:
makePersistent
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of session of make persistent callobjectsToPersist
- objects to store.
-
federate
public void federate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Description copied from interface:DataServiceAPI
Federate object with ID provided to external EE specified- Specified by:
federate
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the session sending the objectobjectID
- ID of the object to federateexternalExecutionEnvironmentID
- ID of external execution environment to federaterecursive
- Indicates if all sub-objects must be replicated as well.
-
notifyFederation
public void notifyFederation(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectsToPersist)
Description copied from interface:DataServiceAPI
New federated object arrives and must be stored in current backend.- Specified by:
notifyFederation
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the session sending the objectobjectsToPersist
- Data of the object to persist
-
unfederate
public void unfederate(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Description copied from interface:DataServiceAPI
Unfederate object with ID provided to external EE specified- Specified by:
unfederate
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the sessionobjectID
- ID of the object to unfederateexternalExecutionEnvironmentID
- ID of external execution environment to unfederaterecursive
- Indicates if all sub-objects must be unfederated as well.
-
notifyUnfederation
public void notifyUnfederation(SessionID sessionID, Set<ObjectID> objectIDs)
Description copied from interface:DataServiceAPI
Unfederate objects with ID provided.- Specified by:
notifyUnfederation
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the session.objectIDs
- ID of the objects to unfederate.
-
executeImplementation
public SerializedParametersOrReturn executeImplementation(ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, SessionID sessionID)
Description copied from interface:DataServiceAPI
This function executes a method.- Specified by:
executeImplementation
in interfaceDataServiceAPI
- Parameters:
objectID
- ID of the object with the information to use by the implementationimplID
- Implementation ID of operation to executeparams
- Serialized parameter values used while invoking the operationsessionID
- ID of the session of the execution- Returns:
- Serialized operation result (all objects serialized, sepparately).
-
runImplementation
public Object runImplementation(DataClayObject instance, ImplementationID implID, Object[] params)
This function executes the method specified- Parameters:
instance
- Instance in which to executeimplID
- Information about the operation to executeparams
- Parameter values used while invoking the operation- Returns:
- Serialized operation result.
-
synchronize
public void synchronize(SessionID sessionID, ObjectID objectID, ImplementationID implID, SerializedParametersOrReturn params, ExecutionEnvironmentID callingBackend)
Description copied from interface:DataServiceAPI
This function synchronizes changes in object field- Specified by:
synchronize
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the session of the executionobjectID
- ID of the object with the information to use by the implementationimplID
- Implementation ID of operation to executeparams
- Serialized parameter values used while invoking the operationcallingBackend
- ID of calling backend or Null if called by client
-
shutdownUpdate
public void shutdownUpdate()
Update all objects in memory (or store them if new). Function called at shutdown.
-
upsertObjects
public void upsertObjects(SessionID sessionID, List<ObjectWithDataParamOrReturn> objectIDsAndBytes)
Description copied from interface:DataServiceAPI
Updates objects or insert if they do not exist with the values in objectBytes. NOTE: This function is recursive, it is going to other DSs if needed.- Specified by:
upsertObjects
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of session needed.objectIDsAndBytes
- Map of objects to update.
-
getCopyOfObject
public SerializedParametersOrReturn getCopyOfObject(SessionID sessionID, ObjectID objectID, boolean recursive)
Description copied from interface:DataServiceAPI
Retrieves the given object and all subobjects as volatile new objects with new OIDs- Specified by:
getCopyOfObject
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the current sessionobjectID
- ID of the object to retrieverecursive
- retrieve a copy of the whole object copying also its subobjects or only the main object- Returns:
- a copy of the object
-
updateObject
public void updateObject(SessionID sessionID, ObjectID intoObjectID, SerializedParametersOrReturn fromObject)
Description copied from interface:DataServiceAPI
Method that updates an object (into) with contents obtained from object (from)- Specified by:
updateObject
in interfaceDataServiceAPI
- Parameters:
sessionID
- id of the session requesting this methodintoObjectID
- id of the object to put contents intofromObject
- object to get contents from
-
getObjects
public List<ObjectWithDataParamOrReturn> getObjects(SessionID sessionID, Set<ObjectID> objectIDs, Set<ObjectID> alreadyObtainedObjs, boolean recursive, ExecutionEnvironmentID replicaDestBackendID, int updateReplicaLocs)
Description copied from interface:DataServiceAPI
Get the serialized objects with id provided- Specified by:
getObjects
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of sessionobjectIDs
- IDs of the objects to getalreadyObtainedObjs
- IDs of already obtained objectsrecursive
- Indicates if, per each object to get, also obtain its associated objects.replicaDestBackendID
- Destination backend of objects being obtained for replicaupdateReplicaLocs
- If 1, provided replica dest backend id must be added to replica locs of obtained objects If 2, provided replica dest backend id must be removed from replica locs If 0, replicaDestBackendID field is ignored- Returns:
- Map of serialized object where key is the objectID. Object is not serialized if flag getOnlyRefs=true
-
removeObjects
public Map<ObjectID,ExecutionEnvironmentID> removeObjects(SessionID sessionID, Set<ObjectID> objectIDs, boolean recursive, boolean moving, ExecutionEnvironmentID newHint)
Description copied from interface:DataServiceAPI
This operation removes the objects with IDs provided NOTE: This function is recursive, it is going to other DSs if needed.- Specified by:
removeObjects
in interfaceDataServiceAPI
- Parameters:
sessionID
- Session IDobjectIDs
- ID of the objects to removerecursive
- Indicates if remove is recursive or not.moving
- Indicates remove is caused by a movement of an object.newHint
- New hint in case of move.- Returns:
- IDs of the objects removed and their backends.
-
newReplica
public Set<ObjectID> newReplica(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID, boolean recursive)
Description copied from interface:DataServiceAPI
This operation creates a new replica of the object with ID provided in the backend specified- Specified by:
newReplica
in interfaceDataServiceAPI
- Parameters:
sessionID
- SessionobjectID
- ID of the objectdestBackendID
- ID of destination backendrecursive
- Indicates if all sub-objects must be replicated as well.- Returns:
- ids of replicated objects
-
newVersion
public ObjectID newVersion(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destBackendID)
Description copied from interface:DataServiceAPI
This operation creates a new version of the object with ID provided in the backend specified- Specified by:
newVersion
in interfaceDataServiceAPI
- Parameters:
sessionID
- SessionobjectID
- ID of the objectdestBackendID
- ID of destination backend- Returns:
- ID of the version created
-
consolidateVersion
public void consolidateVersion(SessionID sessionID, ObjectID finalVersionObjectID)
Description copied from interface:DataServiceAPI
Consolidates object with ID provided- Specified by:
consolidateVersion
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of sessionfinalVersionObjectID
- ID of the object of the version
-
migrateObjectsToBackends
public Tuple<Map<StorageLocationID,Set<ObjectID>>,Set<ObjectID>> migrateObjectsToBackends(Map<StorageLocationID,StorageLocation> backends)
Description copied from interface:DataServiceAPI
Migrate every object of this backend to one of the backends specified- Specified by:
migrateObjectsToBackends
in interfaceDataServiceAPI
- Parameters:
backends
- Specifications of the backends- Returns:
- For each backend specified, the set of IDs of migrated objects (ands their new handler IDs) from this backend to it. Also return the objects that could not be migrated at all.
-
moveObjects
public Set<ObjectID> moveObjects(SessionID sessionID, ObjectID objectID, ExecutionEnvironmentID destLocation, boolean recursive)
Description copied from interface:DataServiceAPI
Move object from this location to the one specified- Specified by:
moveObjects
in interfaceDataServiceAPI
- Parameters:
sessionID
- Session IDobjectID
- ID of the object to movedestLocation
- Destination locationrecursive
- Indicates if all sub-objects (in this location or others) must be moved as well.- Returns:
- Set of moved objects
-
getClassIDFromObjectInMemory
public MetaClassID getClassIDFromObjectInMemory(ObjectID objectID)
Description copied from interface:DataServiceAPI
Get ClassID from object in memory. Used in case the object is still pending to register and Hints point to this DS.- Specified by:
getClassIDFromObjectInMemory
in interfaceDataServiceAPI
- Parameters:
objectID
- ID of the object- Returns:
- Class ID of the object
-
gcCollectObjectInternal
public void gcCollectObjectInternal(DataClayExecutionObject instance)
Update or store object.- Parameters:
instance
- Object to update in DB.
-
registerPendingObjects
public void registerPendingObjects()
Register all pending objects- Specified by:
registerPendingObjects
in interfaceDataServiceAPI
-
addLazyTask
public void addLazyTask(ObjectID objectID, LazyTask lazyTask)
Add lazy task- Parameters:
objectID
- ID of the objectlazyTask
- Lazy task
-
executeLazyTask
public void executeLazyTask(ImplementationID implID, ObjectID paramObjectID, SessionID sessionID, MetaClassID classID)
Execute lazy task- Parameters:
implID
- ID of the task to executeparamObjectID
- ID of the parametersessionID
- ID of the sessionclassID
- ID of the class
-
exists
public boolean exists(ObjectID objectID)
Description copied from interface:DataServiceAPI
Check if the object exists EE memory- Specified by:
exists
in interfaceDataServiceAPI
- Parameters:
objectID
- ID of the object to check- Returns:
- TRUE if the object exists in EE memory.
-
closeSessionInDS
public void closeSessionInDS(SessionID sessionID)
Description copied from interface:DataServiceAPI
Close session in DS. Used to notify that some objects are not longer 'retained' by sessions.- Specified by:
closeSessionInDS
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of session.
-
detachObjectFromSession
public void detachObjectFromSession(ObjectID objectID, SessionID sessionID)
Description copied from interface:DataServiceAPI
Detach object from session, i.e. remove reference from session provided to object, "dear garbage-collector, the session is not using the object anymore"- Specified by:
detachObjectFromSession
in interfaceDataServiceAPI
- Parameters:
objectID
- ID of the objectsessionID
- ID of the session not using the object anymore
-
deleteAlias
public void deleteAlias(SessionID sessionID, ObjectID objectID)
Description copied from interface:DataServiceAPI
Delete alias of object with ID provided- Specified by:
deleteAlias
in interfaceDataServiceAPI
- Parameters:
sessionID
- ID of the session deleting the aliasobjectID
- ID of the object to delete the alias from
-
existsInDB
public boolean existsInDB(ObjectID objectID)
Description copied from interface:DataServiceAPI
Check if the object exists in SL or in any EE memory associated to current SL- Specified by:
existsInDB
in interfaceDataServiceAPI
- Parameters:
objectID
- ID of the object to check- Returns:
- TRUE if the object either exists in SL disk or in EE memory.
-
store
public void store(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] bytes)
Description copied from interface:DataServiceAPI
Store the object.- Specified by:
store
in interfaceDataServiceAPI
- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the objectbytes
- Bytes of the object
-
getLocal
public byte[] getLocal(ObjectID objectID)
Get from this DB- Parameters:
objectID
- ID of the object- Returns:
- Bytes of object
-
get
public byte[] get(ExecutionEnvironmentID eeID, ObjectID objectID)
Description copied from interface:DataServiceAPI
Get serialized object identified by ObjectID- Specified by:
get
in interfaceDataServiceAPI
- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the object- Returns:
- Bytes of the serialized object with ID provided.
-
update
public void update(ExecutionEnvironmentID eeID, ObjectID objectID, byte[] newbytes, boolean dirty)
Description copied from interface:DataServiceAPI
Updates an object identified by the ID provided with the new values provided.- Specified by:
update
in interfaceDataServiceAPI
- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the object.newbytes
- New byte valuesdirty
- dirty Indicates object has been modified. If false, it means that bytes only contains reference counting information. DESIGN NOTE: in order to be able to find out which references where removed in complex objects (arrays, collections) GlobalGc decreases all pointed references in a Get procedure and increase them again (except removed ones) during update. While in EE, objects have memory references so they cannot be removed neither.
-
delete
public void delete(ExecutionEnvironmentID eeID, ObjectID objectID)
Description copied from interface:DataServiceAPI
Deletes and object from the database.- Specified by:
delete
in interfaceDataServiceAPI
- Parameters:
eeID
- ID of the EE triggering the callobjectID
- ID of the object to delete
-
updateRefs
public void updateRefs(Map<ObjectID,Integer> updateCounterRefs)
Description copied from interface:DataServiceAPI
Update counters of references.- Specified by:
updateRefs
in interfaceDataServiceAPI
- Parameters:
updateCounterRefs
- Update counter of references.
-
getRetainedReferences
public Set<ObjectID> getRetainedReferences()
Description copied from interface:DataServiceAPI
Get IDs of references retained by EE.- Specified by:
getRetainedReferences
in interfaceDataServiceAPI
- Returns:
- References retained by EE (sessions, alias...)
-
cleanExecutionClassDirectory
public void cleanExecutionClassDirectory()
Description copied from interface:DataServiceAPI
Deletes all the classes in the execution class directory- Specified by:
cleanExecutionClassDirectory
in interfaceDataServiceAPI
-
cleanExecutionClasses
public static void cleanExecutionClasses()
Static function for cleaning paths. Static so can be called even if DS is not running.
-
cleanCaches
public void cleanCaches()
Description copied from interface:CommonManager
Method that cleans the caches of the manager. Used on testing.- Specified by:
cleanCaches
in interfaceCommonManager
-
getDbHandler
public DBHandler getDbHandler()
Get DbHandler. Used for testing purposes.- Returns:
- DbHandler.
-
closeDbHandler
public void closeDbHandler()
Description copied from interface:DataServiceAPI
Close DBHandler.- Specified by:
closeDbHandler
in interfaceDataServiceAPI
-
activateTracing
public void activateTracing(int currentAvailableTaskID)
Description copied from interface:DataServiceAPI
Activate tracing.- Specified by:
activateTracing
in interfaceDataServiceAPI
- Parameters:
currentAvailableTaskID
- Current starting task ID in Extrae
-
deactivateTracing
public void deactivateTracing()
Description copied from interface:DataServiceAPI
Deactivate Extrae tracing- Specified by:
deactivateTracing
in interfaceDataServiceAPI
-
getTraces
public Map<String,byte[]> getTraces()
Description copied from interface:DataServiceAPI
Get Extrae traces (mpits and set files)- Specified by:
getTraces
in interfaceDataServiceAPI
- Returns:
- Extrae traces (mpits and set files)
-
finishCacheThreads
public void finishCacheThreads()
Finish cache threads.
-
finishClientConnections
public void finishClientConnections()
Finish connections in DS.- Throws:
Exception
- if some exception occurs
-
unregisterFromLogicModule
public void unregisterFromLogicModule()
Unregister the data service from the logic module.
-
shutDown
public void shutDown()
Description copied from interface:DataServiceAPI
Shutdown server. Called from Logic Module.- Specified by:
shutDown
in interfaceDataServiceAPI
-
disconnectFromOthers
public void disconnectFromOthers()
Description copied from interface:DataServiceAPI
Disconnect server from others servers. Called from Logic Module.- Specified by:
disconnectFromOthers
in interfaceDataServiceAPI
-
getNumReferencesTo
public int getNumReferencesTo(ObjectID objectID)
Return number of references pointing to object.- Parameters:
objectID
- ID of object- Returns:
- Number of references pointing to object
-
getStorageLocationService
public StorageLocationService getStorageLocationService()
Only for testing and SL representing a storage location, get storage location service.- Returns:
- storageLocation service
-
notifyExecutionEnvironmentShutdown
public void notifyExecutionEnvironmentShutdown()
Notify LM current execution environment left
-
notifyStorageLocationShutdown
public void notifyStorageLocationShutdown()
Notify LM current storage location left
-
waitForExecutionEnvironmentsToFinish
public void waitForExecutionEnvironmentsToFinish()
Wait for all execution environments associated to current data service to finish and return
-
getNumObjectsInEE
public int getNumObjectsInEE()
Description copied from interface:DataServiceAPI
Get number of alive objects in current EE- Specified by:
getNumObjectsInEE
in interfaceDataServiceAPI
- Returns:
- number of alive objects in current EE
-
getNumObjects
public int getNumObjects()
Description copied from interface:DataServiceAPI
Get number of objects in SL and all its associated EEs- Specified by:
getNumObjects
in interfaceDataServiceAPI
- Returns:
- number of objects in SL and all its associated EEs
-
-