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 voidcloseSession()Close session.voiddeleteAlias(DataClayObject dcObject)Method that deletes the alias of an object providedvoiddetachObjectFromSession(ObjectID objectID, ExecutionEnvironmentID hint)Detach object from current session in use, i.e.protected ObjectexecuteRemoteImplementationInternal(DataClayObject objectInWhichToExec, ImplementationID implID, Object[] params)Internal Method that executes an implementation depending on client or server.voidfederateToBackend(DataClayObject dcObject, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)Federate an object with an external dataClayStringgetClassNameInternal(MetaClassID classID)Get class name from ID.HeapManagergetDataClayHeapManager()Get Heap Managerprotected DataClayObjectLoadergetDataClayObjectLoader()Get DataClay object loader.BackendIDgetHint()Get hint of current backend.protected Map<MetaClassID,byte[]>getIfaceBitMaps()Get interface bitmaps.BackendIDgetLocalBackend()Retrieves current default backendDataClayObjectgetOrNewPersistentInstance(MetaClassID classID, ObjectID objectID, BackendID hint)Check if instance exists in Heap or create a new PERSISTENT instance if neededSessionIDgetSessionID()Get session IDvoidinitialize(String logicModuleHost, int logicModulePort, String originHostName)Initialize connections.booleanisDSLib()BackendIDmakePersistent(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.voidsetLocalBackend(BackendID backendID)Sets ID of backend to be identified as LOCAL backend.voidsetSessionInfo(SessionInfo newSessionfo)Set sessionID for clientvoidsynchronize(DataClayObject dcObject, Object[] params, ImplementationID remoteImplID)SynchronizevoidunfederateFromBackend(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:
initializein 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:DataClayRuntimeCheck if instance exists in Heap or create a new PERSISTENT instance if needed- Specified by:
getOrNewPersistentInstancein 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:
getLocalBackendin 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:DataClayRuntimeGet session ID- Specified by:
getSessionIDin classDataClayRuntime- Returns:
- Session ID
-
getDataClayHeapManager
public HeapManager getDataClayHeapManager()
Get Heap Manager- Specified by:
getDataClayHeapManagerin classDataClayRuntime- Returns:
- Heap Manager
-
executeRemoteImplementationInternal
protected Object executeRemoteImplementationInternal(DataClayObject objectInWhichToExec, ImplementationID implID, Object[] params)
Description copied from class:DataClayRuntimeInternal Method that executes an implementation depending on client or server.- Specified by:
executeRemoteImplementationInternalin 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:DataClayRuntimeThis 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:
makePersistentin 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:
isDSLibin classDataClayRuntime- Returns:
- TRUE if library is for DataClay, FALSE for clients.
-
getClassNameInternal
public String getClassNameInternal(MetaClassID classID)
Description copied from class:DataClayRuntimeGet class name from ID.- Specified by:
getClassNameInternalin classDataClayRuntime- Parameters:
classID- ID of class- Returns:
- Class name
-
getHint
public BackendID getHint()
Description copied from class:DataClayRuntimeGet hint of current backend. If client, returns null.- Specified by:
getHintin classDataClayRuntime- Returns:
- ID of current backend.
-
getIfaceBitMaps
protected Map<MetaClassID,byte[]> getIfaceBitMaps()
Description copied from class:DataClayRuntimeGet interface bitmaps.- Specified by:
getIfaceBitMapsin classDataClayRuntime- Returns:
- Interface bitmaps
-
closeSession
public void closeSession()
Close session.
-
getDataClayObjectLoader
protected DataClayObjectLoader getDataClayObjectLoader()
Description copied from class:DataClayRuntimeGet DataClay object loader.- Specified by:
getDataClayObjectLoaderin classDataClayRuntime- Returns:
- Object loader.
-
detachObjectFromSession
public void detachObjectFromSession(ObjectID objectID, ExecutionEnvironmentID hint)
Description copied from class:DataClayRuntimeDetach 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:
detachObjectFromSessionin 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:DataClayRuntimeMethod that deletes the alias of an object provided- Specified by:
deleteAliasin classDataClayRuntime- Parameters:
dcObject- the object
-
federateToBackend
public void federateToBackend(DataClayObject dcObject, ExecutionEnvironmentID externalExecutionEnvironmentID, boolean recursive)
Description copied from class:DataClayRuntimeFederate an object with an external dataClay- Specified by:
federateToBackendin 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:DataClayRuntimeUnfederate an object with an external backend- Specified by:
unfederateFromBackendin 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:DataClayRuntimeSynchronize- Specified by:
synchronizein classDataClayRuntime- Parameters:
dcObject- Object used as a 'portal' to other DS.params- Parameters to sendremoteImplID- ID of implementation to execute
-
-