Package es.bsc.dataclay.commonruntime
Class ClientRuntime
- java.lang.Object
-
- es.bsc.dataclay.commonruntime.DataClayRuntime
-
- es.bsc.dataclay.commonruntime.ClientRuntime
-
public final class ClientRuntime extends DataClayRuntime
This class contains functions for users to interact with DataClay.
-
-
Field Summary
-
Fields inherited from class es.bsc.dataclay.commonruntime.DataClayRuntime
aliasCache, dataClayHeapManager, dataClayObjLoader, DEBUG_ENABLED, hits, lockerPool, LOGGER, logicModule, metaDataCache, misses, threadPool, underDeserializationVolatiles, volatileParametersBeingSend
-
-
Constructor Summary
Constructors Constructor Description ClientRuntime()
Constructor for Mock tests.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeSession()
Close session.void
deleteAlias(DataClayObject dcObject)
Method that deletes the alias of an object providedvoid
detachObjectFromSession(ObjectID objectID, ExecutionEnvironmentID hint)
Detach object from current session in use, i.e.protected Object
executeRemoteImplementationInternal(DataClayObject objectInWhichToExec, ImplementationID implID, Object[] params)
Internal Method that executes an implementation depending on client or server.void
federateToBackend(DataClayObject dcObject, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Federate an object with an external dataClayString
getClassNameInternal(MetaClassID classID)
Get class name from ID.HeapManager
getDataClayHeapManager()
Get Heap Managerprotected DataClayObjectLoader
getDataClayObjectLoader()
Get DataClay object loader.BackendID
getHint()
Get hint of current backend.protected Map<MetaClassID,byte[]>
getIfaceBitMaps()
Get interface bitmaps.BackendID
getLocalBackend()
Retrieves current default backendDataClayObject
getOrNewPersistentInstance(MetaClassID classID, ObjectID objectID, BackendID hint)
Check if instance exists in Heap or create a new PERSISTENT instance if neededSessionID
getSessionID()
Get session IDvoid
initialize(String logicModuleHost, int logicModulePort, String originHostName)
Initialize connections.boolean
isDSLib()
BackendID
makePersistent(DataClayObject dcObject, BackendID optionalDestBackendID, boolean recursive, String alias)
This method creates a new Persistent Object using the provided stub instance and, if indicated, all its associated objects also Logic module API used for communicationList<ObjectWithDataParamOrReturn>
serializeMakePersistent(BackendID location, DataClayObject objectToPersist, Map<MetaClassID,byte[]> ifaceBitMaps, boolean recursive)
Serialize for make persistent.void
setLocalBackend(BackendID backendID)
Sets ID of backend to be identified as LOCAL backend.void
setSessionInfo(SessionInfo newSessionfo)
Set sessionID for clientvoid
synchronize(DataClayObject dcObject, Object[] params, ImplementationID remoteImplID)
Synchronizevoid
unfederateFromBackend(DataClayObject dcObject, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Unfederate an object with an external backend-
Methods inherited from class es.bsc.dataclay.commonruntime.DataClayRuntime
activateTracing, activateTracingInDataClayServices, addSessionReference, addToHeap, addVolatileUnderDeserialization, callExecuteToDS, checkAndGetSession, checkConnectionAndParams, chooseLocation, cleanLockers, consolidateVersion, deactivateTracing, deactivateTracingInDataClayServices, deleteAlias, deserializeIntoHeap, deserializeParams, deserializeReturn, executeRemoteImplementation, executeRemoteTask, existsInHeap, federateAllObjects, federateObject, finishConnections, flushAll, getAllBackendsNames, getAllExecutionEnvironmentsAtDataClay, getAllExecutionEnvironmentsAtHost, getAllExecutionEnvironmentsInfo, getAllLocations, getBackendIDFromAlias, getBackendIDFromObjectID, getBackendsWithName, getClassName, getCommonGrpcClient, getCopyOfObject, getDataClayID, getDataSetIDFromObject, getDSNameOfHint, getExecutionEnvironmentInfo, getExternalDataClayID, getExternalDataClayInfo, getFromHeap, getLocation, getLogicModuleAPI, getNumObjects, getObjectByAlias, getObjectByAlias, getObjectIDFromAlias, getObjectInfoByAlias, getObjectMetadata, getOrNewAndLoadVolatile, getPersistedObjectByOID, getRemoteDSAPI, getRemoteExecutionEnvironment, getTracesInDataClayServices, heapSize, importModelsFromExternalDataClay, isInitialized, lock, migrateFederatedObjects, moveObject, newRemotePersistentInstance, newReplica, newVersion, numLoadedObjs, numLockers, objectExistsInDataClay, registerExternalDataClay, registerExternalDataClayOverrideAuthority, removeFromHeap, removeObjectMetadataFromCache, removeVolatilesUnderDeserialization, serializeParams, serializeReturn, setDataSetID, setInitialized, setObjectReadOnly, setObjectReadWrite, unfederateAllObjects, unfederateAllObjectsWithAllDCs, unfederateObject, unfederateObjectWithAllDCs, unlock, updateObject, updateObjectID, waitForAsyncRequestToFinish
-
-
-
-
Method Detail
-
initialize
public void initialize(String logicModuleHost, int logicModulePort, String originHostName) throws Exception
Initialize connections.- Overrides:
initialize
in classDataClayRuntime
- Parameters:
logicModuleHost
- Name of the host of the logic modulelogicModulePort
- Port of the logic moduleoriginHostName
- Name of the host using the lib.- Throws:
Exception
- if connection could not be done for some reason.
-
getOrNewPersistentInstance
public DataClayObject getOrNewPersistentInstance(MetaClassID classID, ObjectID objectID, BackendID hint)
Description copied from class:DataClayRuntime
Check if instance exists in Heap or create a new PERSISTENT instance if needed- Specified by:
getOrNewPersistentInstance
in classDataClayRuntime
- Parameters:
classID
- ID of the class in case it is needed (not need to query) if null, look for class id in metadata.objectID
- ID of objecthint
- Can be null. Hint in case object is a volatile in another DS and we need information.- Returns:
- Instance
-
setLocalBackend
public void setLocalBackend(BackendID backendID)
Sets ID of backend to be identified as LOCAL backend.- Parameters:
backendID
- ID of LOCAL backend.
-
getLocalBackend
public BackendID getLocalBackend()
Retrieves current default backend- Specified by:
getLocalBackend
in classDataClayRuntime
- Returns:
-
setSessionInfo
public void setSessionInfo(SessionInfo newSessionfo)
Set sessionID for client- Parameters:
newSessionfo
- Info of session
-
getSessionID
public SessionID getSessionID()
Description copied from class:DataClayRuntime
Get session ID- Specified by:
getSessionID
in classDataClayRuntime
- Returns:
- Session ID
-
getDataClayHeapManager
public HeapManager getDataClayHeapManager()
Get Heap Manager- Specified by:
getDataClayHeapManager
in classDataClayRuntime
- Returns:
- Heap Manager
-
executeRemoteImplementationInternal
protected Object executeRemoteImplementationInternal(DataClayObject objectInWhichToExec, ImplementationID implID, Object[] params)
Description copied from class:DataClayRuntime
Internal Method that executes an implementation depending on client or server.- Specified by:
executeRemoteImplementationInternal
in classDataClayRuntime
- Parameters:
objectInWhichToExec
- Object in which to execimplID
- Implementation IDparams
- Parameters- Returns:
- the result of execution.
-
makePersistent
public BackendID makePersistent(DataClayObject dcObject, BackendID optionalDestBackendID, boolean recursive, String alias)
Description copied from class:DataClayRuntime
This method creates a new Persistent Object using the provided stub instance and, if indicated, all its associated objects also Logic module API used for communication- Specified by:
makePersistent
in classDataClayRuntime
- Parameters:
dcObject
- Instance to make persistentoptionalDestBackendID
- Indicates which is the destination backendrecursive
- Indicates if make persistent is recursivealias
- Alias for the object- Returns:
- ID of the backend in which te object was persisted.
-
serializeMakePersistent
public final List<ObjectWithDataParamOrReturn> serializeMakePersistent(BackendID location, DataClayObject objectToPersist, Map<MetaClassID,byte[]> ifaceBitMaps, boolean recursive)
Serialize for make persistent.- Parameters:
location
- Where objects will be storedobjectToPersist
- Object to persistifaceBitMaps
- Interface bitmapsrecursive
- Indicates if sub-objects must be serialized also.- Returns:
- Serialized parameters
-
isDSLib
public boolean isDSLib()
- Specified by:
isDSLib
in classDataClayRuntime
- Returns:
- TRUE if library is for DataClay, FALSE for clients.
-
getClassNameInternal
public String getClassNameInternal(MetaClassID classID)
Description copied from class:DataClayRuntime
Get class name from ID.- Specified by:
getClassNameInternal
in classDataClayRuntime
- Parameters:
classID
- ID of class- Returns:
- Class name
-
getHint
public BackendID getHint()
Description copied from class:DataClayRuntime
Get hint of current backend. If client, returns null.- Specified by:
getHint
in classDataClayRuntime
- Returns:
- ID of current backend.
-
getIfaceBitMaps
protected Map<MetaClassID,byte[]> getIfaceBitMaps()
Description copied from class:DataClayRuntime
Get interface bitmaps.- Specified by:
getIfaceBitMaps
in classDataClayRuntime
- Returns:
- Interface bitmaps
-
closeSession
public void closeSession()
Close session.
-
getDataClayObjectLoader
protected DataClayObjectLoader getDataClayObjectLoader()
Description copied from class:DataClayRuntime
Get DataClay object loader.- Specified by:
getDataClayObjectLoader
in classDataClayRuntime
- Returns:
- Object loader.
-
detachObjectFromSession
public void detachObjectFromSession(ObjectID objectID, ExecutionEnvironmentID hint)
Description copied from class:DataClayRuntime
Detach object from current session in use, i.e. remove reference from current session provided to object, "dear garbage-collector, current session is not using the object anymore"- Specified by:
detachObjectFromSession
in classDataClayRuntime
- Parameters:
objectID
- ID of the object to detachhint
- Hint of the object to detach (can be null)
-
deleteAlias
public void deleteAlias(DataClayObject dcObject)
Description copied from class:DataClayRuntime
Method that deletes the alias of an object provided- Specified by:
deleteAlias
in classDataClayRuntime
- Parameters:
dcObject
- the object
-
federateToBackend
public void federateToBackend(DataClayObject dcObject, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Description copied from class:DataClayRuntime
Federate an object with an external dataClay- Specified by:
federateToBackend
in classDataClayRuntime
- Parameters:
dcObject
- object to federateexternalExecutionEnvironmentID
- id of the external execution environment idrecursive
- Indicates if subobjects should be federated as well
-
unfederateFromBackend
public void unfederateFromBackend(DataClayObject dcObject, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Description copied from class:DataClayRuntime
Unfederate an object with an external backend- Specified by:
unfederateFromBackend
in classDataClayRuntime
- Parameters:
dcObject
- object to unfederateexternalExecutionEnvironmentID
- id of the external execution environment idrecursive
- Indicates if subobjects should be unfederated as well
-
synchronize
public final void synchronize(DataClayObject dcObject, Object[] params, ImplementationID remoteImplID)
Description copied from class:DataClayRuntime
Synchronize- Specified by:
synchronize
in classDataClayRuntime
- Parameters:
dcObject
- Object used as a 'portal' to other DS.params
- Parameters to sendremoteImplID
- ID of implementation to execute
-
-