public class RequestHandler extends java.lang.Object implements java.lang.Comparable<RequestHandler>
Modifier and Type | Field and Description |
---|---|
private static java.util.logging.Logger |
log |
private Registry |
registry |
private SeleniumBasedRequest |
request |
private javax.servlet.http.HttpServletResponse |
response |
private TestSession |
session |
private java.util.concurrent.CountDownLatch |
sessionAssigned |
private java.lang.Thread |
waitingThread |
Constructor and Description |
---|
RequestHandler(SeleniumBasedRequest request,
javax.servlet.http.HttpServletResponse response,
Registry registry) |
Modifier and Type | Method and Description |
---|---|
private void |
beforeSessionEvent()
calls the TestSessionListener is the proxy for that node has one specified.
|
void |
bindSession(TestSession session) |
private void |
cleanup() |
int |
compareTo(RequestHandler o) |
java.lang.String |
debug() |
boolean |
equals(java.lang.Object obj) |
void |
forwardNewSessionRequestAndUpdateRegistry(TestSession session)
Forward the new session request to the TestSession that has been assigned, and parse the
response to extract and return the external key assigned by the remote.
|
protected void |
forwardRequest(TestSession session,
RequestHandler handler) |
Registry |
getRegistry() |
SeleniumBasedRequest |
getRequest() |
javax.servlet.http.HttpServletResponse |
getResponse() |
ExternalSessionKey |
getServerSession() |
TestSession |
getSession() |
int |
hashCode() |
void |
process()
forwards the request to the remote, allocating / releasing the resources if necessary.
|
protected void |
setSession(TestSession session) |
void |
stop() |
java.lang.String |
toString() |
void |
waitForSessionBound()
wait for the registry to match the request with a TestSlot.
|
private final Registry registry
private final SeleniumBasedRequest request
private final javax.servlet.http.HttpServletResponse response
private volatile TestSession session
private final java.util.concurrent.CountDownLatch sessionAssigned
private static final java.util.logging.Logger log
private final java.lang.Thread waitingThread
public RequestHandler(SeleniumBasedRequest request, javax.servlet.http.HttpServletResponse response, Registry registry)
public void forwardNewSessionRequestAndUpdateRegistry(TestSession session) throws NewSessionException
session
- sessionNewSessionException
- in case anything wrong happens during the new session process.protected void forwardRequest(TestSession session, RequestHandler handler) throws java.io.IOException
java.io.IOException
public void process()
private void cleanup()
private void beforeSessionEvent() throws NewSessionException
NewSessionException
- in case anything goes wrong with the listener.public void waitForSessionBound() throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
java.lang.InterruptedException
- Interrupted exceptionjava.util.concurrent.TimeoutException
- if the request reaches the new session wait timeout before being
assigned.public SeleniumBasedRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public int compareTo(RequestHandler o)
compareTo
in interface java.lang.Comparable<RequestHandler>
protected void setSession(TestSession session)
public void bindSession(TestSession session)
public TestSession getSession()
public ExternalSessionKey getServerSession()
public void stop()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String debug()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public Registry getRegistry()