public interface GroupMember
DistributedGroup.
A GroupMember represents a reference to a single instance of a resource which has
joined a membership group. Each member is guaranteed to
have a unique id() throughout the lifetime of the distributed resource. Group members
can schedule or execute callbacks
remotely on member nodes.
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
execute(Runnable callback)
Executes a callback on the group member.
|
<T> CompletableFuture<T> |
get(String property)
Gets the value of a property of the member.
|
String |
id()
Returns the member ID.
|
boolean |
isLeader()
Returns a boolean value indicating whether this member is the current leader.
|
CompletableFuture<Void> |
schedule(Duration delay,
Runnable callback)
Schedules a callback to run after the given delay on the member.
|
CompletableFuture<Void> |
schedule(Instant instant,
Runnable callback)
Schedules a callback to run at the given instant.
|
CompletableFuture<Void> |
send(String topic,
Object message)
Sends a message to the member.
|
String id()
boolean isLeader()
<T> CompletableFuture<T> get(String property)
Properties are identified by a String name. Properties may only be set by the local member but
can be accessed by any instance of the DistributedGroup.
T - The property type.property - The property to get.CompletableFuture<Void> send(String topic, Object message)
Group messaging guarantees sequential consistency such that members are guaranteed to receive messages
in the order in which they were sent. Messages will be sent according to the parent DistributedGroup's
consistency level. If the consistency level is
Consistency (the default), the returned CompletableFuture will
be completed once the member has received the message or has left the group. Note that the completion of
the returned future does not necessarily guarantee that the message was received and processed, only that
it was either received and processed or the member left the group or disconnected.
topic - The message topic.message - The message to send.CompletableFuture<Void> schedule(Instant instant, Runnable callback)
instant - The instant at which to run the callback.callback - The callback to run.CompletableFuture<Void> schedule(Duration delay, Runnable callback)
delay - The delay after which to run the callback.callback - The callback to run.CompletableFuture<Void> execute(Runnable callback)
callback - The callback to execute.Copyright © 2013–2016. All rights reserved.