Interface NodeRegistry
- All Superinterfaces:
AutoCloseable
,Closeable
,HasReadyState
- All Known Implementing Classes:
LocalNodeRegistry
Maintains a registry of the nodes available for a
Distributor
. Implementations may store nodes in memory or
in an external data store to allow for high availability configurations.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a node to this registry.boolean
Set a node to draining state.int
Get the number of active slots.Gets all available nodes that are not DOWN or DRAINING.long
Gets the total number of nodes that are DOWN.int
Get the number of idle slots.Get node by URI.Gets a node by its ID.Gets a snapshot of all registered nodes.long
Gets the total number of nodes that are UP.void
refresh()
Refreshes all nodes by running a health check on each one.void
register
(NodeStatus status) Register a node status received from an event.void
Removes a node from this registry.boolean
Reserve a slot for a session.void
Run health checks on all nodes.void
setSession
(SlotId slotId, Session session) Set a session for a particular slot.void
updateNodeAvailability
(URI nodeUri, NodeId id, Availability availability) Updates a node's availability status.Methods inherited from interface org.openqa.selenium.status.HasReadyState
isReady
-
Method Details
-
register
Register a node status received from an event.- Parameters:
status
- The node status to register.
-
add
Add a node to this registry.- Parameters:
node
- The node to add.
-
remove
Removes a node from this registry.- Parameters:
nodeId
- The id of the node to remove.
-
drain
Set a node to draining state.- Parameters:
nodeId
- The id of the node to drain.- Returns:
- true if the node was set to draining, false otherwise.
-
updateNodeAvailability
Updates a node's availability status.- Parameters:
nodeUri
- The URI of the node.id
- The id of the node.availability
- The new availability status.
-
refresh
void refresh()Refreshes all nodes by running a health check on each one. -
getStatus
DistributorStatus getStatus()Gets a snapshot of all registered nodes.- Returns:
- The current status of the distributor.
-
getAvailableNodes
Set<NodeStatus> getAvailableNodes()Gets all available nodes that are not DOWN or DRAINING.- Returns:
- Set of available node statuses.
-
getNode
Gets a node by its ID.- Parameters:
id
- The node ID to look up.- Returns:
- The node, or null if not found.
-
getUpNodeCount
long getUpNodeCount()Gets the total number of nodes that are UP.- Returns:
- The number of UP nodes.
-
getDownNodeCount
long getDownNodeCount()Gets the total number of nodes that are DOWN.- Returns:
- The number of DOWN nodes.
-
runHealthChecks
void runHealthChecks()Run health checks on all nodes. -
reserve
Reserve a slot for a session.- Parameters:
slotId
- The slot ID to reserve.- Returns:
- Whether the reservation was successful.
-
setSession
Set a session for a particular slot.- Parameters:
slotId
- The slot ID.session
- The session to associate with the slot, or null to clear.
-
getActiveSlots
int getActiveSlots()Get the number of active slots. -
getIdleSlots
int getIdleSlots()Get the number of idle slots. -
getNode
Get node by URI.- Parameters:
uri
- The node URI to look up.- Returns:
- The node if found, null otherwise.
-