org.openqa.grid.internal
Class Registry

java.lang.Object
  extended by org.openqa.grid.internal.Registry

@ThreadSafe
public class Registry
extends java.lang.Object

Kernel of the grid. Keeps track of what's happening, what's free/used and assigned resources to incoming requests.


Field Summary
static java.lang.String KEY
           
 
Method Summary
 void add(RemoteProxy proxy)
          Add a proxy to the list of proxy available for the grid to managed and link the proxy to the registry.
 void addNewSessionRequest(RequestHandler request)
           
 void clearNewSessionRequests()
           
 void forceRelease(TestSlot testSlot)
          releasing the testslot, WITHOUT running any listener.
 java.util.Set<TestSession> getActiveSessions()
           
 ProxySet getAllProxies()
           
 GridHubConfiguration getConfiguration()
           
 java.lang.Iterable<DesiredCapabilities> getDesiredCapabilities()
           
 Hub getHub()
           
 int getNewSessionRequestCount()
           
 int getNewSessionWaitTimeout()
          how long a session can remains in the newSession queue before being quicked out
 Prioritizer getPrioritizer()
           
 RemoteProxy getProxyById(java.lang.String id)
           
 TestSession getSession(ExternalSessionKey externalKey)
          gets the test session associated to this external key.
 java.util.List<RemoteProxy> getUsedProxies()
           
static Registry newInstance()
           
static Registry newInstance(Hub hub, GridHubConfiguration config)
           
 void removeIfPresent(RemoteProxy proxy)
           
 boolean removeNewSessionRequest(RequestHandler request)
           
 void setHub(Hub hub)
           
 void setNewSessionWaitTimeout(int newSessionWaitTimeout)
           
 void setPrioritizer(Prioritizer prioritizer)
           
 void setThrowOnCapabilityNotPresent(boolean throwOnCapabilityNotPresent)
          If throwOnCapabilityNotPresent is set to true, the hub will reject test request for a capability that is not on the grid.
 void stop()
           
 void terminate(TestSession session)
          Ends this test session for the hub, releasing the resources in the hub / registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

public static final java.lang.String KEY
Method Detail

newInstance

public static Registry newInstance()

newInstance

public static Registry newInstance(Hub hub,
                                   GridHubConfiguration config)

getConfiguration

public GridHubConfiguration getConfiguration()

getNewSessionWaitTimeout

public int getNewSessionWaitTimeout()
how long a session can remains in the newSession queue before being quicked out

Returns:
the new session wait timeout

setNewSessionWaitTimeout

public void setNewSessionWaitTimeout(int newSessionWaitTimeout)

terminate

public void terminate(TestSession session)
Ends this test session for the hub, releasing the resources in the hub / registry. It does not release anything on the remote. The resources are released in a separate thread, so the call returns immediatly. It allows release with long duration not to block the test while the hub is releasing the resource.

Parameters:
session - The session to terminate

removeIfPresent

public void removeIfPresent(RemoteProxy proxy)

forceRelease

public void forceRelease(TestSlot testSlot)
releasing the testslot, WITHOUT running any listener.


stop

public void stop()

getHub

public Hub getHub()

setHub

public void setHub(Hub hub)

addNewSessionRequest

public void addNewSessionRequest(RequestHandler request)

add

public void add(RemoteProxy proxy)
Add a proxy to the list of proxy available for the grid to managed and link the proxy to the registry.

Parameters:
proxy - The proxy to add

setThrowOnCapabilityNotPresent

public void setThrowOnCapabilityNotPresent(boolean throwOnCapabilityNotPresent)
If throwOnCapabilityNotPresent is set to true, the hub will reject test request for a capability that is not on the grid. No exception will be thrown if the capability is present but busy.

If set to false, the test will be queued hoping a new proxy will register later offering that capability.

Parameters:
throwOnCapabilityNotPresent - true to throw if capability not present

getAllProxies

public ProxySet getAllProxies()

getUsedProxies

public java.util.List<RemoteProxy> getUsedProxies()

getSession

public TestSession getSession(ExternalSessionKey externalKey)
gets the test session associated to this external key. The external key is the session used by webdriver.

Parameters:
externalKey - the external session key
Returns:
null if the hub doesn't have a node associated to the provided externalKey

getNewSessionRequestCount

public int getNewSessionRequestCount()

clearNewSessionRequests

public void clearNewSessionRequests()

removeNewSessionRequest

public boolean removeNewSessionRequest(RequestHandler request)

getDesiredCapabilities

public java.lang.Iterable<DesiredCapabilities> getDesiredCapabilities()

getActiveSessions

public java.util.Set<TestSession> getActiveSessions()

setPrioritizer

public void setPrioritizer(Prioritizer prioritizer)

getPrioritizer

public Prioritizer getPrioritizer()

getProxyById

public RemoteProxy getProxyById(java.lang.String id)


Copyright © 2011. All Rights Reserved.