Package com.rpl.rama.integration
Interface TaskGlobalObject
- All Superinterfaces:
AutoCloseable,Closeable,RamaSerializable,Serializable
- All Known Subinterfaces:
ExternalDepot,TaskGlobalObjectWithTick
Objects implementing this interface that are provided to
This object is serialized with Java serialization and then deserialized on every task before being built with
This functionality can be used to integrate external queues, databases, or other tools with Rama.
Closeable.close() should be implemented to clean up any resources opened during preparation, such as connections to other processes. This is especially important for unit tests using
RamaModule.Setup.declareObject(String, Object)
can specialize their implementation per task. References to the declared var will see the
specific instance of this object built for that task.This object is serialized with Java serialization and then deserialized on every task before being built with
prepareForTask(int, com.rpl.rama.integration.TaskGlobalContext).This functionality can be used to integrate external queues, databases, or other tools with Rama.
Closeable.close() should be implemented to clean up any resources opened during preparation, such as connections to other processes. This is especially important for unit tests using
InProcessCluster.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidThis function is called on this object whenever the task on which it lives gains leadership.voidprepareForTask(int taskId, TaskGlobalContext context) Specializes this object for this particular task ID.
-
Method Details
-
prepareForTask
Specializes this object for this particular task ID. This is called one time during worker launch. Each task has a separate instance of this object by using serialization/deserialization.- Parameters:
taskId- Task ID on which this object will livecontext- Contextual information- See Also:
-
gainedLeadership
default void gainedLeadership()This function is called on this object whenever the task on which it lives gains leadership.
-