Interface VariableManagementService

All Known Implementing Classes:
VariableManagementServiceImpl

public interface VariableManagementService
Variables service for reading and writing variables, and for setting a version number for the current thread to consider variables for.

See implementation class for further details.

  • Method Details

    • setLocalVersion

      void setLocalVersion()
      Sets the variable version that subsequent reads consider.
    • getReadWriteLock

      ReadWriteLock getReadWriteLock()
      Lock for use in atomic writes to the variable space.
      Returns:
      read write lock for external coordinated write
    • addVariable

      void addVariable(String deploymentId, VariableMetaData metaData, String optionalDeploymentIdContext, DataInputOutputSerde optionalSerde)
    • getReader

      VariableReader getReader(String deploymentId, String variableName, int agentInstanceIdAccessor)
      Returns a reader that provides access to variable values. The reader considers the version currently set via setLocalVersion.
      Parameters:
      deploymentId - deployment id
      variableName - the variable that the reader should read
      agentInstanceIdAccessor - agent instance id of accessor
      Returns:
      reader
    • registerCallback

      void registerCallback(String deploymentId, String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback)
      Registers a callback invoked when the variable is written with a new value.
      Parameters:
      deploymentId - deployment id
      variableName - variable name
      agentInstanceId - agent instance id
      variableChangeCallback - a callback
    • unregisterCallback

      void unregisterCallback(String deploymentId, String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback)
      Removes a callback.
      Parameters:
      deploymentId - deployment id
      variableName - variable name
      agentInstanceId - agent instance id
      variableChangeCallback - a callback
    • write

      void write(int variableNumber, int agentInstanceId, Object newValue)
      Writes a new variable value.

      Must be followed by either a commit or rollback.

      Parameters:
      variableNumber - the index number of the variable to write (from VariableReader)
      newValue - the new value
      agentInstanceId - agent instance id
    • checkAndWrite

      void checkAndWrite(String deploymentId, String variableName, int agentInstanceId, Object newValue)
      Check type of the value supplied and writes the new variable value.

      Must be followed by either a commit or rollback.

      Parameters:
      deploymentId - deployment id
      variableName - variable name
      agentInstanceId - agent instance id
      newValue - the new value
    • commit

      void commit()
      Commits the variable outstanding changes.
    • rollback

      void rollback()
      Rolls back the variable outstanding changes.
    • getVariableMetaData

      Variable getVariableMetaData(String deploymentId, String variableName)
    • removeVariableIfFound

      void removeVariableIfFound(String deploymentId, String variableName)
      Removes a variable.
      Parameters:
      deploymentId - deployment id
      variableName - to remove
    • destroy

      void destroy()
    • allocateVariableState

      void allocateVariableState(String deploymentId, String variableName, int agentInstanceId, boolean recovery, NullableObject<Object> initialValue, EventBeanTypedEventFactory eventBeanTypedEventFactory)
    • deallocateVariableState

      void deallocateVariableState(String deploymentId, String variableName, int agentInstanceId)
    • getReadersPerCP

      ConcurrentHashMap<Integer,VariableReader> getReadersPerCP(String deploymentId, String variableName)
    • getVariableReadersNonCP

      Map<DeploymentIdNamePair,VariableReader> getVariableReadersNonCP()
    • getOptionalStateHandler

      VariableStateNonConstHandler getOptionalStateHandler()
    • getDeploymentsWithVariables

      Map<String,VariableDeployment> getDeploymentsWithVariables()
    • traverseVariables

      void traverseVariables(BiConsumer<String,Variable> consumer)