Class GridModel
java.lang.Object
org.openqa.selenium.grid.distributor.GridModel
- Direct Known Subclasses:
LocalGridModel
An abstract representation of the Grid's node state model. This abstraction allows for different
implementations that can store state either locally or in an external datastore for high
availability.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
add
(NodeStatus node) Adds a node to the grid model, typically starting with DOWN availability until health checks pass.abstract Set
<NodeStatus> Gets a snapshot of all node statuses currently in the grid model.abstract void
Removes nodes that have been unresponsive for too long.abstract void
refresh
(NodeStatus status) Refreshes a node's status in the grid model.abstract void
release
(org.openqa.selenium.remote.SessionId id) Releases a session, making its slot available again.abstract void
Removes a node from the grid model.abstract boolean
Attempts to reserve a specific slot on a node.abstract void
setAvailability
(NodeId id, Availability availability) Sets the availability status for a node.abstract void
setSession
(SlotId slotId, Session session) Updates a reserved slot to contain an actual session.abstract void
touch
(NodeStatus nodeStatus) Updates the timestamp for a node to prevent it from being considered stale.abstract void
updateHealthCheckCount
(NodeId id, Availability availability) Updates the health check count for a node based on its availability.
-
Constructor Details
-
GridModel
public GridModel()
-
-
Method Details
-
add
Adds a node to the grid model, typically starting with DOWN availability until health checks pass.- Parameters:
node
- The node status to add
-
refresh
Refreshes a node's status in the grid model.- Parameters:
status
- The updated node status
-
touch
Updates the timestamp for a node to prevent it from being considered stale. May also update the node's availability if reported differently.- Parameters:
nodeStatus
- The node status to update
-
remove
Removes a node from the grid model.- Parameters:
id
- The ID of the node to remove
-
purgeDeadNodes
public abstract void purgeDeadNodes()Removes nodes that have been unresponsive for too long. -
setAvailability
Sets the availability status for a node.- Parameters:
id
- The ID of the nodeavailability
- The new availability status
-
reserve
Attempts to reserve a specific slot on a node.- Parameters:
slotId
- The ID of the slot to reserve- Returns:
- true if the reservation was successful, false otherwise
-
getSnapshot
Gets a snapshot of all node statuses currently in the grid model.- Returns:
- A set of node statuses
-
release
public abstract void release(org.openqa.selenium.remote.SessionId id) Releases a session, making its slot available again.- Parameters:
id
- The ID of the session to release
-
setSession
Updates a reserved slot to contain an actual session.- Parameters:
slotId
- The ID of the slot to updatesession
- The session to associate with the slot, or null to clear
-
updateHealthCheckCount
Updates the health check count for a node based on its availability.- Parameters:
id
- The ID of the nodeavailability
- The current availability status
-