public interface MastershipService extends ListenerService<MastershipEvent,MastershipListener>
Modifier and Type | Field and Description |
---|---|
static long |
TIMEOUT_MILLIS |
Modifier and Type | Method and Description |
---|---|
Set<DeviceId> |
getDevicesOf(NodeId nodeId)
Deprecated.
1.6.0 Goldeneye release.
|
MastershipRole |
getLocalRole(DeviceId deviceId)
Returns the role of the local node for the specified device, without
triggering master selection.
|
NodeId |
getMasterFor(DeviceId deviceId)
Returns the current master for a given device.
|
MastershipInfo |
getMastershipFor(DeviceId deviceId)
Returns the mastership info for the given device.
|
RoleInfo |
getNodesFor(DeviceId deviceId)
Returns controllers connected to a given device, in order of
preference.
|
default boolean |
isLocalMaster(DeviceId deviceId)
Returns true if the local controller is the Master for the specified deviceId.
|
CompletableFuture<Void> |
relinquishMastership(DeviceId deviceId)
Abandons mastership of the specified device on the local node thus
forcing selection of a new master.
|
default void |
relinquishMastershipSync(DeviceId deviceId)
Synchronous version of relinquishMastership.
|
CompletableFuture<MastershipRole> |
requestRoleFor(DeviceId deviceId)
Returns the mastership status of the local controller for a given
device forcing master selection if necessary.
|
default MastershipRole |
requestRoleForSync(DeviceId deviceId)
Synchronous version of requestRoleFor.
|
addListener, removeListener
static final long TIMEOUT_MILLIS
MastershipRole getLocalRole(DeviceId deviceId)
deviceId
- the identifier of the devicedefault boolean isLocalMaster(DeviceId deviceId)
deviceId
- the identifier of the deviceCompletableFuture<MastershipRole> requestRoleFor(DeviceId deviceId)
deviceId
- the identifier of the devicedefault MastershipRole requestRoleForSync(DeviceId deviceId)
deviceId
- the identifier of the deviceCompletableFuture<Void> relinquishMastership(DeviceId deviceId)
deviceId
- the identifier of the devicedefault void relinquishMastershipSync(DeviceId deviceId)
deviceId
- the identifier of the deviceNodeId getMasterFor(DeviceId deviceId)
deviceId
- the identifier of the deviceRoleInfo getNodesFor(DeviceId deviceId)
deviceId
- the identifier of the deviceMastershipInfo getMastershipFor(DeviceId deviceId)
deviceId
- the device for which to return the mastership info@Deprecated Set<DeviceId> getDevicesOf(NodeId nodeId)
Returned Set may contain DeviceId which no longer exist in the system.
nodeId
- the ID of the controller