Class DataClayRuntime

  • Direct Known Subclasses:
    ClientRuntime, DataServiceRuntime

    public abstract class DataClayRuntime
    extends Object
    This class contains functions to interact with DataClay. This is an abstract class in order to provide same functionalities to calls done from client-side and the ones done from a backend side.
    • Field Detail

      • LOGGER

        public static final org.apache.logging.log4j.Logger LOGGER
        Logger.
      • DEBUG_ENABLED

        public static final boolean DEBUG_ENABLED
        Indicates if debug is enabled.
      • logicModule

        protected LogicModuleAPI logicModule
        Logic Module API for communication.
      • dataClayHeapManager

        protected HeapManager dataClayHeapManager
        DataClay Heap manager to manage GC, reference counting, lockers and others.
      • lockerPool

        protected final LockerPool lockerPool
        Pool of lockers.
      • volatileParametersBeingSend

        protected final Set<ObjectID> volatileParametersBeingSend
        Set of object ids of volatile parameters that were send but did not arrive to any node yet.
      • misses

        public int misses
      • hits

        public int hits
    • Constructor Detail

      • DataClayRuntime

        protected DataClayRuntime()
        Constructor.
    • Method Detail

      • initialize

        protected void initialize​(String logicModuleHost,
                                  int logicModulePort,
                                  String originHostName)
                           throws Exception
        Initialize session and connections.
        Parameters:
        logicModuleHost - Name of the host of the logic module
        logicModulePort - Port of the logic module
        originHostName - Name of the host using the lib.
        Throws:
        Exception - if connection could not be done for some reason.
      • getLogicModuleAPI

        public final LogicModuleAPI getLogicModuleAPI()
        Get the logic module API.
        Returns:
        The logic module API
      • getAllExecutionEnvironmentsInfo

        public final Map<ExecutionEnvironmentID,​ExecutionEnvironment> getAllExecutionEnvironmentsInfo​(CommonMessages.Langs lang,
                                                                                                            boolean forceUpdateCache)
        Get all execution environments information.
        Parameters:
        lang - Language
        forceUpdateCache - Indicates cache must be forcibly updated
        Returns:
        All execution locations information
      • getExecutionEnvironmentInfo

        public final ExecutionEnvironment getExecutionEnvironmentInfo​(BackendID execLocationID)
        Get ExecutionEnvironment information
        Parameters:
        execLocationID - Execution location ID
        Returns:
        Execution location information
      • getAllExecutionEnvironmentsAtHost

        public Map<BackendID,​ExecutionEnvironment> getAllExecutionEnvironmentsAtHost​(CommonMessages.Langs lang,
                                                                                           String hostname)
        Get all execution environments in provided host
        Parameters:
        lang - Language
        hostname - Host name
        Returns:
        Set of execution environments in provided host
      • getAllExecutionEnvironmentsAtDataClay

        public Map<ExecutionEnvironmentID,​ExecutionEnvironment> getAllExecutionEnvironmentsAtDataClay​(CommonMessages.Langs lang,
                                                                                                            DataClayInstanceID dataClayInstanceID,
                                                                                                            boolean forceUpdate)
        Get all execution environments in provided dataClay instance
        Parameters:
        lang - Language
        dataClayInstanceID - ID of dataClay to check
        forceUpdate - Indicates exec envs must be updated
        Returns:
        Set of execution environments in provided dataClay instance
      • getAllBackendsNames

        public Set<String> getAllBackendsNames​(CommonMessages.Langs lang,
                                               boolean forceUpdateCache)
        Get all backend names
        Parameters:
        lang - Language
        forceUpdateCache - Indicates cache must be forcibly updated
        Returns:
        All backed names information
      • getBackendsWithName

        public Set<BackendID> getBackendsWithName​(CommonMessages.Langs lang,
                                                  String backendName)
        Get exec. environments with name provided
        Parameters:
        lang - Language
        backendName - Name of backend
        Returns:
        All backends with name provided
      • getBackendIDFromObjectID

        public final ExecutionEnvironmentID getBackendIDFromObjectID​(ObjectID objectID)
        Get execution location
        Parameters:
        objectID - ID of the object connected.
        Returns:
        ExecutionEnvironmentID by hash
      • getRemoteExecutionEnvironment

        public final DataServiceAPI getRemoteExecutionEnvironment​(BackendID execLocationID)
        Get remote execution environment
        Parameters:
        execLocationID - ID of remote execution environment
        Returns:
        Remote execution environment
      • getRemoteDSAPI

        public DataServiceAPI getRemoteDSAPI​(ExecutionEnvironmentID execLocationID)
        Get remote execution environment
        Parameters:
        execLocationID - ID of remote execution environment
        Returns:
        Remote execution environment
      • getExternalDataClayInfo

        public DataClayInstance getExternalDataClayInfo​(DataClayInstanceID extDataClayID)
        Get external dataClay info
        Parameters:
        extDataClayID - id of the external dataClay instance
        Returns:
        info of the external dataClay instance
      • registerExternalDataClay

        public DataClayInstanceID registerExternalDataClay​(String dcHost,
                                                           Integer dcPort)
        Method that registers the info of a dataClay instance
        Parameters:
        dcHost - entry port host of the external dataClay
        dcPort - entry point port of the external dataClay
        Returns:
        ID of external registered dataClay.
      • registerExternalDataClayOverrideAuthority

        public DataClayInstanceID registerExternalDataClayOverrideAuthority​(AccountID adminAccountID,
                                                                            PasswordCredential adminCredential,
                                                                            String dcHost,
                                                                            int dcPort,
                                                                            String authority)
        ADMIN usage only. Method that registers the info of a dataClay instance but with overriden authority for SSL connections.
        Parameters:
        adminAccountID - admin account id
        adminCredential - admin credentials
        dcHost - entry port host of the external dataClay
        dcPort - entry point port of the external dataClay
        authority - authority to use
        Returns:
        ID of external registered dataClay.
      • getExternalDataClayID

        public DataClayInstanceID getExternalDataClayID​(String hostname,
                                                        int port)
        Get external dataClay info
        Parameters:
        hostname - host name of the external dataClay instance
        port - port of the external dataClay instance.
        Returns:
        info of the external dataClay instance
      • getDataClayID

        public DataClayInstanceID getDataClayID()
        Get ID of the current instance of dataClay
        Returns:
        the dataClay ID
      • getHint

        public abstract BackendID getHint()
        Get hint of current backend. If client, returns null.
        Returns:
        ID of current backend.
      • finishConnections

        public final void finishConnections()
        Finish connections to server
      • getObjectMetadata

        public final MetaDataInfo getObjectMetadata​(ObjectID objectID)
        Get the IDs of the backends in which the object identified by the stub instance provided is located and the classname of the object.
        Parameters:
        objectID - ID of the object
        Returns:
        Object metadata.
      • removeObjectMetadataFromCache

        public final void removeObjectMetadataFromCache​(ObjectID objectID)
        Remove metadata of object from cache
        Parameters:
        objectID - ID of the object
      • getCopyOfObject

        public final DataClayObject getCopyOfObject​(ObjectID oid,
                                                    boolean recursive)
        Retrieves a copy of the specified object and all its subobjects
        Parameters:
        oid - id of the object to be retrieved
        recursive - retrieve a copy of the whole object copying also its subobjects or only the main object
        Returns:
        a volatile instance of the object
      • updateObject

        public final void updateObject​(ObjectID into,
                                       DataClayObject from)
        Updates a specific object (into) with the fields of another one (from)
        Parameters:
        into - target object where data is put
        from - object containing the data to put
      • addVolatileUnderDeserialization

        public void addVolatileUnderDeserialization​(Collection<ObjectWithDataParamOrReturn> volatileSet)
        All volatiles provided are under deserialization. This function solves problems of 'hashcode' and other special functions needed during deserializations. See executeImpl.
        Parameters:
        volatileSet - Volatiles under deserialization.
      • removeVolatilesUnderDeserialization

        public void removeVolatilesUnderDeserialization​(Collection<ObjectWithDataParamOrReturn> volatileSet)
        Remove volatiles under deserialization.
        Parameters:
        volatileSet - Volatiles under deserialization.
      • getOrNewAndLoadVolatile

        public DataClayObject getOrNewAndLoadVolatile​(MetaClassID classID,
                                                      ObjectID objectID,
                                                      BackendID hint,
                                                      ObjectWithDataParamOrReturn objWithData,
                                                      Map<MetaClassID,​byte[]> ifaceBitMaps)
        Get from Heap or create a new volatile in EE and load data on it.
        Parameters:
        classID - ID of class of the object
        objectID - ID of the object
        hint - Hint of the object
        objWithData - Data of the object
        ifaceBitMaps - Interface bitmaps
        Returns:
        Loaded volatile instance in EE.
      • getSessionID

        public abstract SessionID getSessionID()
        Get session ID
        Returns:
        Session ID
      • checkConnectionAndParams

        public final void checkConnectionAndParams​(String[] paramNames,
                                                   Object[] params)
        Check connection and parameters
        Parameters:
        paramNames - Names of parameters
        params - Parameters to check
      • checkAndGetSession

        public final SessionID checkAndGetSession​(String[] paramNames,
                                                  Object[] params)
        Check parameters and connections and session
        Parameters:
        paramNames - Names of parameters
        params - Parameters to check
        Returns:
        Session ID
      • getObjectInfoByAlias

        public final Triple<ObjectID,​MetaClassID,​BackendID> getObjectInfoByAlias​(String alias)
        Method that gets info of an object given its ID if the object is accessible by using the given sesion.
        Parameters:
        alias - alias of the object
        Returns:
        Currently id of object and hint.
      • getObjectByAlias

        public final DataClayObject getObjectByAlias​(String alias)
        Method that gets an object given its alias.
        Parameters:
        alias - alias of the object
        Returns:
        The object identified by alias provided
      • getObjectByAlias

        public final DataClayObject getObjectByAlias​(String alias,
                                                     MetaClassID metaClassID,
                                                     boolean safe)
        Method that gets an object given its alias and metaclass id.
        Parameters:
        alias - alias of the object
        metaClassID - if of the object's metaclass
        safe - if true, check that alias exists
        Returns:
        The object identified by the proved alias and metaclass.
      • deleteAlias

        public final void deleteAlias​(String alias)
        Method that deletes the alias of an object
        Parameters:
        alias - alias of the object to be removed
      • deleteAlias

        public abstract void deleteAlias​(DataClayObject dcObject)
        Method that deletes the alias of an object provided
        Parameters:
        dcObject - the object
      • getDataSetIDFromObject

        public final DataSetID getDataSetIDFromObject​(ObjectID oid)
        Method that gets DataSetID from an object with id provided
        Parameters:
        oid - ID of the object
        Returns:
        DataSet of the object
      • getClassNameInternal

        public abstract String getClassNameInternal​(MetaClassID classID)
        Get class name from ID.
        Parameters:
        classID - ID of class
        Returns:
        Class name
      • getClassName

        public final String getClassName​(MetaClassID classID)
        Get class name from ID
        Parameters:
        classID - Class ID
        Returns:
        Class name
      • newVersion

        public final Tuple<ObjectID,​BackendID> newVersion​(ObjectID objectID,
                                                                ExecutionEnvironmentID objectHint,
                                                                MetaClassID classID,
                                                                DataSetID dataSetID,
                                                                BackendID optDestBackendID,
                                                                String optDestHostname)
        Creates a persistent new version of an object and its subobjects (always recursive). If a Backend is provided the object is versioned to this backend, otherwise it is versioned to any backend
        Parameters:
        objectID - ID of the object
        objectHint - object hint
        classID - ID of the class of the object
        dataSetID - ID of the dataset of the object
        optDestBackendID - ID of the backend in which to store the version the object (optional)
        optDestHostname - Hostname of the backend in which to replicate the object (optional)
        Returns:
        Version ID and destination backend ID
      • consolidateVersion

        public final void consolidateVersion​(ObjectID versionOID,
                                             ExecutionEnvironmentID objectHint)
        Makes the object with finalVersionID the definitive version of the object with originalObjectID. The original version is deleted.
        Parameters:
        versionOID - ID of version object to consolidate
        objectHint - object hint
      • newReplica

        public final BackendID newReplica​(ObjectID objectID,
                                          BackendID objectHint,
                                          BackendID optDestBackendID,
                                          String optDestHostname,
                                          boolean recursive)
        Replicates an object. If a Backend is provided the object is replicated to this backend, otherwise it is replicated to any backend
        Parameters:
        objectID - ID of the object
        objectHint - object hint
        optDestBackendID - ID of the backend in which to replicate the object (optional)
        optDestHostname - Hostname of the backend in which to replicate the object (optional)
        recursive - Indicates if we should also replicate all sub-objects or not.
        Returns:
        The ID of the backend in which the replica was created or NULL if some error is thrown.
      • moveObject

        public final void moveObject​(ObjectID objectID,
                                     MetaClassID classID,
                                     BackendID hint,
                                     BackendID srcBackendID,
                                     BackendID destBackendID,
                                     boolean recursive)
        Move the replica of an object from one backend to another.
        Parameters:
        objectID - ID of the object
        classID - Class ID of the object
        hint - Hint of the object
        srcBackendID - ID of the backend containing the replica
        destBackendID - ID of the destination backend
        recursive - Indicates if movement must be recursive or not.
      • setObjectReadOnly

        public final void setObjectReadOnly​(ObjectID objectID,
                                            MetaClassID classID,
                                            BackendID hint)
        Set a persistent object as read only Logic module API used for communication
        Parameters:
        objectID - ID of the object
        classID - Class ID of the object
        hint - Hint of the object
      • setObjectReadWrite

        public final void setObjectReadWrite​(ObjectID objectID,
                                             MetaClassID classID,
                                             BackendID hint)
        Set a persistent object as read write
        Parameters:
        objectID - ID of the object
        classID - Class ID of the object
        hint - Hint of the object
      • getLocation

        public final BackendID getLocation​(ObjectID objectID)
        Get the ID of some backend in which the object identified by the stub instance provided is located
        Parameters:
        objectID - ID of the object
        Returns:
        ID of some backend in which the object is located or NULL if some error is thrown.
      • getAllLocations

        public final Set<BackendID> getAllLocations​(ObjectID objectID)
        Get the IDs of the backends in which the object identified by the stub instance provided is located.
        Parameters:
        objectID - ID of the object
        Returns:
        IDs of the backends in which the object is located or NULL if some error is thrown.
      • getDSNameOfHint

        public final String getDSNameOfHint​(BackendID hint)
        Get name of node associated to hint.
        Parameters:
        hint - Hint
        Returns:
        name of node associated to hint
      • serializeParams

        public final SerializedParametersOrReturn serializeParams​(DataClayObject objectInWhichToExec,
                                                                  Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                                  ImplementationID implID,
                                                                  Object[] params,
                                                                  boolean forUpdate,
                                                                  BackendID hintVolatiles)
        Serialize parameters.
        Parameters:
        objectInWhichToExec - Object in which to run method that needs serialization of parameters
        ifaceBitMaps - Interface bitmaps
        implID - ImplementationID
        params - Parameters or return to serialize
        forUpdate - Indicates whether this serialization is for an update or not
        hintVolatiles - Hint to set to volatiles
        Returns:
        Serialized parameters
      • serializeReturn

        public final SerializedParametersOrReturn serializeReturn​(DataClayObject objectInWhichToExec,
                                                                  Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                                  ImplementationID implID,
                                                                  Object ret)
        Serialize parameters.
        Parameters:
        objectInWhichToExec - Object in which to run method that needs serialization of parameters
        ifaceBitMaps - Interface bitmaps
        implID - ImplementationID
        ret - Return to serialize
        Returns:
        Serialized parameters
      • deserializeParams

        public final Object[] deserializeParams​(DataClayObject objectInWhichToExec,
                                                Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                ImplementationID implID,
                                                SerializedParametersOrReturn serializedParams)
        Deserialize parameters.
        Parameters:
        objectInWhichToExec - Object in which to run method that needs deserialization of parameters.
        ifaceBitMaps - Interface bitmaps
        implID - ImplementationID
        serializedParams - Parameters to deserialize
        Returns:
        Serialized parameters
      • deserializeIntoHeap

        public final Object[] deserializeIntoHeap​(Map<MetaClassID,​byte[]> ifaceBitMaps,
                                                  List<ObjectWithDataParamOrReturn> serializedParams)
        Deserialize int heap objects provided for a make persistent call.
        Parameters:
        ifaceBitMaps - Interface bitmaps
        serializedParams - Objects to deserialize
        Returns:
        the deserialized parameters
      • deserializeReturn

        public final Object deserializeReturn​(DataClayObject objectInWhichToExec,
                                              Map<MetaClassID,​byte[]> ifaceBitMaps,
                                              ImplementationID implID,
                                              SerializedParametersOrReturn serializedReturn)
        Deserialize return.
        Parameters:
        objectInWhichToExec - Object in which to run method that needs deserialization of return.
        ifaceBitMaps - Interface bitmaps
        implID - ImplementationID
        serializedReturn - Return to deserialize
        Returns:
        Deserialized return
      • executeRemoteImplementationInternal

        protected abstract Object executeRemoteImplementationInternal​(DataClayObject objectInWhichToExec,
                                                                      ImplementationID implID,
                                                                      Object[] params)
        Internal Method that executes an implementation depending on client or server.
        Parameters:
        objectInWhichToExec - Object in which to exec
        implID - Implementation ID
        params - Parameters
        Returns:
        the result of execution.
      • executeRemoteImplementation

        public final Object executeRemoteImplementation​(DataClayObject objectInWichToExec,
                                                        String implIDStr,
                                                        Object[] params)
        Method that executes an implementation.
        Parameters:
        objectInWichToExec - Object in which to exec
        implIDStr - Implementation ID as string
        params - Parameters
        Returns:
        the result of execution.
      • getIfaceBitMaps

        protected abstract Map<MetaClassID,​byte[]> getIfaceBitMaps()
        Get interface bitmaps.
        Returns:
        Interface bitmaps
      • callExecuteToDS

        public final Object callExecuteToDS​(DataClayObject dcObject,
                                            Object[] params,
                                            ImplementationID remoteImplID,
                                            BackendID remoteLocationID,
                                            boolean usingHint)
        Execute a remote implementation in Location specified.
        Parameters:
        dcObject - Object used as a 'portal' to other DS.
        params - Parameters to send
        remoteImplID - ID of implementation to execute
        remoteLocationID - Location in which to execute
        usingHint - TRUE if using hint.
        Returns:
        Result of execution.
      • synchronize

        public abstract void synchronize​(DataClayObject dcObject,
                                         Object[] params,
                                         ImplementationID remoteImplID)
        Synchronize
        Parameters:
        dcObject - Object used as a 'portal' to other DS.
        params - Parameters to send
        remoteImplID - ID of implementation to execute
      • executeRemoteTask

        public final Object executeRemoteTask​(ObjectID objectID,
                                              String className,
                                              String operationNameAndSignature,
                                              Object[] params,
                                              BackendID target)
        Method that executes an implementation
        Parameters:
        objectID - ID of the object
        className - Name of the class of the object
        operationNameAndSignature - Name and Signature of the operation to be executed
        params - parameters for the operation
        target - the backend where the execution must be performed
        Returns:
        the resulting object corresponding to the execution of the operation if it succeeds. null otherwise.
        if the method is void, it returns null also but no ERROR is prompt.
      • getOrNewPersistentInstance

        public abstract DataClayObject getOrNewPersistentInstance​(MetaClassID classID,
                                                                  ObjectID objectID,
                                                                  BackendID hint)
        Check if instance exists in Heap or create a new PERSISTENT instance if needed
        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 object
        hint - Can be null. Hint in case object is a volatile in another DS and we need information.
        Returns:
        Instance
      • newRemotePersistentInstance

        public final ObjectID newRemotePersistentInstance​(MetaClassID classID,
                                                          StubInfo stubInfo,
                                                          ImplementationID implID,
                                                          Object[] params,
                                                          BackendID locID)
        Create a new instance in a remote server and persist it.
        Parameters:
        classID - ID of the class of the instance to create
        stubInfo - Stub information
        implID - ID of the implementation of the constructor
        params - Parameters to send to constructor
        locID - (optional) Storage Location/ Execution Environment in which to store object.
        Returns:
        ObjectID of persisted instance.
      • makePersistent

        public abstract 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 communication
        Parameters:
        dcObject - Instance to make persistent
        optionalDestBackendID - Indicates which is the destination backend
        recursive - Indicates if make persistent is recursive
        alias - Alias for the object
        Returns:
        ID of the backend in which te object was persisted.
      • federateObject

        public void federateObject​(DataClayObject dcObject,
                                   DataClayInstanceID externalDataClayID,
                                   boolean recursive)
        Federate an object with an external dataClay
        Parameters:
        dcObject - object to federate
        externalDataClayID - id of the external dataClay ID
        recursive - Indicates if subobjects should be federated as well
      • federateToBackend

        public abstract void federateToBackend​(DataClayObject dcObject,
                                               ExecutionEnvironmentID externalExecutionEnvironmentID,
                                               boolean recursive)
        Federate an object with an external dataClay
        Parameters:
        dcObject - object to federate
        externalExecutionEnvironmentID - id of the external execution environment id
        recursive - Indicates if subobjects should be federated as well
      • unfederateObject

        public void unfederateObject​(DataClayObject dcObject,
                                     DataClayInstanceID externalDataClayID,
                                     boolean recursive)
        Unfederate an object with an external dataClay
        Parameters:
        dcObject - object to unfederate
        externalDataClayID - id of the external dataClay
        recursive - Indicates if subobjects should be unfederated as well
      • unfederateFromBackend

        public abstract void unfederateFromBackend​(DataClayObject dcObject,
                                                   ExecutionEnvironmentID externalExecutionEnvironmentID,
                                                   boolean recursive)
        Unfederate an object with an external backend
        Parameters:
        dcObject - object to unfederate
        externalExecutionEnvironmentID - id of the external execution environment id
        recursive - Indicates if subobjects should be unfederated as well
      • unfederateObjectWithAllDCs

        public void unfederateObjectWithAllDCs​(DataClayObject dcObject,
                                               boolean recursive)
        Unfederate an object with all external dataClays
        Parameters:
        dcObject - object to unfederate
        recursive - Indicates if subobjects should be federated as well
      • unfederateAllObjects

        public void unfederateAllObjects​(DataClayInstanceID extDataClayID)
        Unfederate all objects belonging/federated with external dataClay with id provided
        Parameters:
        extDataClayID - External dataClay ID
      • unfederateAllObjectsWithAllDCs

        public void unfederateAllObjectsWithAllDCs()
        Unfederate all objects belonging/federated with ANY external dataClay
      • federateAllObjects

        public void federateAllObjects​(DataClayInstanceID destinationDataClayID)
        Federate all dataClay objects from specified current dataClay destination dataclay.
        Parameters:
        destinationDataClayID - Destination dataclay id
      • importModelsFromExternalDataClay

        public void importModelsFromExternalDataClay​(String externalNamespace,
                                                     DataClayInstanceID extDataClayID)
        Import classes in namespace specified from an external dataClay
        Parameters:
        externalNamespace - External namespace to get
        extDataClayID - External dataClay ID
      • migrateFederatedObjects

        public void migrateFederatedObjects​(DataClayInstanceID originDataClayID,
                                            DataClayInstanceID destinationDataClayID)
        Migrate (unfederate and federate) all current dataClay objects from specified external dataclay di to destination dataclay.
        Parameters:
        originDataClayID - Origin dataclay id
        destinationDataClayID - Destination dataclay id
      • setDataSetID

        public final void setDataSetID​(ObjectID objectID,
                                       DataSetID newDataSetID)
        Set DataSet ID
        Parameters:
        objectID - ID of the object
        newDataSetID - New DataSetID
      • getPersistedObjectByOID

        public final DataClayObject getPersistedObjectByOID​(ObjectID objectID,
                                                            MetaClassID classID,
                                                            BackendID hint)
        Recovers Object from OID and class ID
        Parameters:
        objectID - ObjectID of the object
        classID - ClassID of the object. Can be NULL. Null class ID makes dataClay to ask for object Mdata.
        hint - Hint of the object. Can be NULL if no hint.
        Returns:
        Instance of the object.
      • waitForAsyncRequestToFinish

        public final void waitForAsyncRequestToFinish()
        Wait for asynchronous requests to finish.
      • getDataClayHeapManager

        public abstract HeapManager getDataClayHeapManager()
        Get Heap Manager
        Returns:
        Heap Manager
      • removeFromHeap

        public final void removeFromHeap​(ObjectID objectID)
        Remove reference from Heap. Even if we remove it from the heap, the object won't be Garbage collected by JavaGC till HeapManager flushes the object and releases it.
        Parameters:
        objectID - ID of the object
      • addToHeap

        public final void addToHeap​(DataClayObject dcObject)
        Add to Heap
        Parameters:
        dcObject - the object
      • objectExistsInDataClay

        public boolean objectExistsInDataClay​(ObjectID objectID)
        Check if object exists in dataClay.
        Parameters:
        objectID - ID of the object
        Returns:
        TRUE if object exists. FALSE otherwise.
      • getNumObjects

        public int getNumObjects()
        Get number of objects in dataClay
      • getFromHeap

        public DataClayObject getFromHeap​(ObjectID objectID)
        Get from Heap
        Parameters:
        objectID - ID of the object
        Returns:
        The object in Heap or null if not present
      • existsInHeap

        public final boolean existsInHeap​(ObjectID objectID)
        Check if there is an object with ID provided.
        Parameters:
        objectID - ID of the object.
        Returns:
        TRUE if exists in memory. FALSE otherwise.
      • detachObjectFromSession

        public abstract void detachObjectFromSession​(ObjectID objectID,
                                                     ExecutionEnvironmentID hint)
        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"
        Parameters:
        objectID - ID of the object to detach
        hint - Hint of the object to detach (can be null)
      • flushAll

        public final void flushAll()
        ADVANCED FUNCTION. Try not to use it. This function flushes all objects in Heap.
      • heapSize

        public final int heapSize()
        Get number of objects in heap.
        Returns:
        Heap size.
      • numLoadedObjs

        public final int numLoadedObjs()
        Get number of loaded objects in heap.
        Returns:
        number of loaded objects in heap.
      • activateTracingInDataClayServices

        public final void activateTracingInDataClayServices()
        Activate tracing in dataClay services
      • deactivateTracingInDataClayServices

        public final void deactivateTracingInDataClayServices()
        Dectivate tracing
      • activateTracing

        public final void activateTracing​(boolean initializeWrapper)
        Activate tracing
      • deactivateTracing

        public final void deactivateTracing​(boolean finalizeWrapper)
        Deactivate tracing
      • getTracesInDataClayServices

        public final void getTracesInDataClayServices()
        Get traces in dataClay services and store it in current workspace
      • getCommonGrpcClient

        public final CommonGrpcClient getCommonGrpcClient()
        Returns:
        GRPC client.
      • getDataClayObjectLoader

        protected abstract DataClayObjectLoader getDataClayObjectLoader()
        Get DataClay object loader.
        Returns:
        Object loader.
      • lock

        public final void lock​(ObjectID objectID)
        Lock object
        Parameters:
        objectID - ID of object
      • unlock

        public final void unlock​(ObjectID objectID)
        Unlock object
        Parameters:
        objectID - ID of object
      • cleanLockers

        public final void cleanLockers()
        Clean lockers
      • numLockers

        public final int numLockers()
        Get number of lockers
        Returns:
        Number of lockers
      • isDSLib

        public abstract boolean isDSLib()
        Returns:
        TRUE if library is for DataClay, FALSE for clients.
      • getLocalBackend

        public abstract BackendID getLocalBackend()
        Returns:
        the 'LOCAL' location if defined
      • addSessionReference

        public void addSessionReference​(ObjectID objectID)
        ONLY for EE. Add +1 reference associated to thread session
        Parameters:
        objectID - ID of the object
      • isInitialized

        public boolean isInitialized()
        Indicates if runtime was initialized or not
        Returns:
        TRUE if runtime is initialized. FALSE otherwise.
      • setInitialized

        public void setInitialized​(boolean theinitialized)
        Set initialized flag
        Parameters:
        theinitialized - Value to set
      • getObjectIDFromAlias

        public static ObjectID getObjectIDFromAlias​(String alias)
      • chooseLocation

        protected BackendID chooseLocation​(DataClayObject dcObject,
                                           String alias)
        Choose execution/make persistent location.
        Parameters:
        dcObject - DataClay object.
        Returns:
        Chosen location.
      • updateObjectID

        protected void updateObjectID​(DataClayObject dcObject,
                                      ObjectID newObjectID)
        Update the object id in both DataClayObject and HeapManager
        Parameters:
        dcObject - DataClay object.
        newObjectID - the new object id.