@ThreadSafe
public class Registry
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
Registry.Matcher
iterates the queue of incoming new session request and assign them to proxy after they've been
sorted by priority, with priority defined by the prioritizer.
|
private static class |
Registry.UncaughtExceptionHandler |
Modifier and Type | Field and Description |
---|---|
private ActiveTestSessions |
activeTestSessions |
private GridHubConfiguration |
configuration |
private org.openqa.selenium.remote.internal.HttpClientFactory |
httpClientFactory |
private Hub |
hub |
static java.lang.String |
KEY |
private java.util.concurrent.locks.ReentrantLock |
lock |
private static java.util.logging.Logger |
LOG |
private Registry.Matcher |
matcherThread |
private NewSessionRequestQueue |
newSessionQueue |
private ProxySet |
proxies |
private java.util.List<RemoteProxy> |
registeringProxies |
private boolean |
stop |
private java.util.concurrent.locks.Condition |
testSessionAvailable |
Modifier | Constructor and Description |
---|---|
private |
Registry(Hub hub,
GridHubConfiguration config) |
Modifier and Type | Method and Description |
---|---|
private void |
_release(TestSlot testSlot,
SessionTerminationReason reason)
Release the test slot.
|
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 handler) |
private void |
assignRequestToProxy()
iterates the list of incoming session request to find a potential match in the list of proxies.
|
void |
clearNewSessionRequests() |
private void |
fireMatcherStateChanged() |
void |
forceRelease(TestSlot testSlot,
SessionTerminationReason reason)
Releases the test slot, WITHOUT running any listener.
|
java.util.Set<TestSession> |
getActiveSessions() |
ProxySet |
getAllProxies() |
GridHubConfiguration |
getConfiguration() |
java.lang.Iterable<org.openqa.selenium.remote.DesiredCapabilities> |
getDesiredCapabilities() |
TestSession |
getExistingSession(ExternalSessionKey externalKey)
gets the test existing session associated to this external key.
|
(package private) org.openqa.selenium.remote.internal.HttpClientFactory |
getHttpClientFactory() |
Hub |
getHub() |
int |
getNewSessionRequestCount() |
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) |
private void |
release(java.lang.String internalKey,
SessionTerminationReason reason) |
private void |
release(TestSession session,
SessionTerminationReason reason)
mark the session as finished for the registry.
|
void |
removeIfPresent(RemoteProxy proxy) |
boolean |
removeNewSessionRequest(RequestHandler request) |
void |
setHub(Hub hub) |
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() |
private boolean |
takeRequestHandler(RequestHandler handler) |
void |
terminate(TestSession session,
SessionTerminationReason reason)
Ends this test session for the hub, releasing the resources in the hub / registry.
|
(package private) void |
terminateSynchronousFOR_TEST_ONLY(TestSession testSession) |
public static final java.lang.String KEY
private static final java.util.logging.Logger LOG
private final java.util.concurrent.locks.ReentrantLock lock
private final java.util.concurrent.locks.Condition testSessionAvailable
private final ProxySet proxies
private final ActiveTestSessions activeTestSessions
private final GridHubConfiguration configuration
private final org.openqa.selenium.remote.internal.HttpClientFactory httpClientFactory
private final NewSessionRequestQueue newSessionQueue
private final Registry.Matcher matcherThread
private final java.util.List<RemoteProxy> registeringProxies
private volatile boolean stop
private volatile Hub hub
private Registry(Hub hub, GridHubConfiguration config)
public static Registry newInstance()
public static Registry newInstance(Hub hub, GridHubConfiguration config)
public GridHubConfiguration getConfiguration()
public void terminate(TestSession session, SessionTerminationReason reason)
session
- The session to terminatereason
- the reason for terminationprivate void _release(TestSlot testSlot, SessionTerminationReason reason)
TestSessionListener.afterSession(TestSession)
if
applicable.testSlot
- The slot to releasevoid terminateSynchronousFOR_TEST_ONLY(TestSession testSession)
public void removeIfPresent(RemoteProxy proxy)
public void forceRelease(TestSlot testSlot, SessionTerminationReason reason)
testSlot
- test slot to be releasedreason
- reason for terminationpublic void stop()
public Hub getHub()
public void setHub(Hub hub)
public void addNewSessionRequest(RequestHandler handler)
private void assignRequestToProxy()
private boolean takeRequestHandler(RequestHandler handler)
private void release(TestSession session, SessionTerminationReason reason)
session
- The sessionreason
- the reason for the releaseprivate void release(java.lang.String internalKey, SessionTerminationReason reason)
public void add(RemoteProxy proxy)
proxy
- The proxy to addpublic void setThrowOnCapabilityNotPresent(boolean throwOnCapabilityNotPresent)
If set to false, the test will be queued hoping a new proxy will register later offering that capability.
throwOnCapabilityNotPresent
- true to throw if capability not presentprivate void fireMatcherStateChanged()
public ProxySet getAllProxies()
public java.util.List<RemoteProxy> getUsedProxies()
public TestSession getSession(ExternalSessionKey externalKey)
externalKey
- the external session keypublic TestSession getExistingSession(ExternalSessionKey externalKey)
externalKey
- the external session keypublic int getNewSessionRequestCount()
public void clearNewSessionRequests()
public boolean removeNewSessionRequest(RequestHandler request)
public java.lang.Iterable<org.openqa.selenium.remote.DesiredCapabilities> getDesiredCapabilities()
public java.util.Set<TestSession> getActiveSessions()
public RemoteProxy getProxyById(java.lang.String id)
org.openqa.selenium.remote.internal.HttpClientFactory getHttpClientFactory()