Class GridModel

java.lang.Object
org.openqa.selenium.grid.distributor.GridModel
Direct Known Subclasses:
LocalGridModel

public abstract class GridModel extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    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
    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
    reserve(SlotId slotId)
    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
    Updates the health check count for a node based on its availability.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GridModel

      public GridModel()
  • Method Details

    • add

      public abstract void add(NodeStatus node)
      Adds a node to the grid model, typically starting with DOWN availability until health checks pass.
      Parameters:
      node - The node status to add
    • refresh

      public abstract void refresh(NodeStatus status)
      Refreshes a node's status in the grid model.
      Parameters:
      status - The updated node status
    • touch

      public abstract void touch(NodeStatus nodeStatus)
      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

      public abstract void remove(NodeId id)
      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

      public abstract void setAvailability(NodeId id, Availability availability)
      Sets the availability status for a node.
      Parameters:
      id - The ID of the node
      availability - The new availability status
    • reserve

      public abstract boolean reserve(SlotId slotId)
      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

      public abstract Set<NodeStatus> 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

      public abstract void setSession(SlotId slotId, Session session)
      Updates a reserved slot to contain an actual session.
      Parameters:
      slotId - The ID of the slot to update
      session - The session to associate with the slot, or null to clear
    • updateHealthCheckCount

      public abstract void updateHealthCheckCount(NodeId id, Availability availability)
      Updates the health check count for a node based on its availability.
      Parameters:
      id - The ID of the node
      availability - The current availability status