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 Summary
Modifier and TypeMethodDescriptionvoid
addVariable
(String deploymentId, VariableMetaData metaData, String optionalDeploymentIdContext, DataInputOutputSerde optionalSerde) void
allocateVariableState
(String deploymentId, String variableName, int agentInstanceId, boolean recovery, NullableObject<Object> initialValue, EventBeanTypedEventFactory eventBeanTypedEventFactory) void
checkAndWrite
(String deploymentId, String variableName, int agentInstanceId, Object newValue) Check type of the value supplied and writes the new variable value.void
commit()
Commits the variable outstanding changes.void
deallocateVariableState
(String deploymentId, String variableName, int agentInstanceId) void
destroy()
Returns a reader that provides access to variable values.getReadersPerCP
(String deploymentId, String variableName) Lock for use in atomic writes to the variable space.getVariableMetaData
(String deploymentId, String variableName) void
registerCallback
(String deploymentId, String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback) Registers a callback invoked when the variable is written with a new value.void
removeVariableIfFound
(String deploymentId, String variableName) Removes a variable.void
rollback()
Rolls back the variable outstanding changes.void
Sets the variable version that subsequent reads consider.void
traverseVariables
(BiConsumer<String, Variable> consumer) void
unregisterCallback
(String deploymentId, String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback) Removes a callback.void
Writes a new variable value.
-
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
Returns a reader that provides access to variable values. The reader considers the version currently set via setLocalVersion.- Parameters:
deploymentId
- deployment idvariableName
- the variable that the reader should readagentInstanceIdAccessor
- 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 idvariableName
- variable nameagentInstanceId
- agent instance idvariableChangeCallback
- a callback
-
unregisterCallback
void unregisterCallback(String deploymentId, String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback) Removes a callback.- Parameters:
deploymentId
- deployment idvariableName
- variable nameagentInstanceId
- agent instance idvariableChangeCallback
- a callback
-
write
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 valueagentInstanceId
- agent instance id
-
checkAndWrite
Check type of the value supplied and writes the new variable value.Must be followed by either a commit or rollback.
- Parameters:
deploymentId
- deployment idvariableName
- variable nameagentInstanceId
- agent instance idnewValue
- the new value
-
commit
void commit()Commits the variable outstanding changes. -
rollback
void rollback()Rolls back the variable outstanding changes. -
getVariableMetaData
-
removeVariableIfFound
Removes a variable.- Parameters:
deploymentId
- deployment idvariableName
- to remove
-
destroy
void destroy() -
allocateVariableState
void allocateVariableState(String deploymentId, String variableName, int agentInstanceId, boolean recovery, NullableObject<Object> initialValue, EventBeanTypedEventFactory eventBeanTypedEventFactory) -
deallocateVariableState
-
getReadersPerCP
-
getVariableReadersNonCP
Map<DeploymentIdNamePair,VariableReader> getVariableReadersNonCP() -
getOptionalStateHandler
VariableStateNonConstHandler getOptionalStateHandler() -
getDeploymentsWithVariables
Map<String,VariableDeployment> getDeploymentsWithVariables() -
traverseVariables
-