private class AnonProxy.OpenSocketRequester
extends java.lang.Object
implements java.lang.Runnable
SocketGuard
objects via the
pushSocket()
method
and starts AnonProxyRequest
s, respecting the max. number of
requests that class can process requests.
This class can be used to process sockets, that want to send a request without having to worry about blocking or sending too many requests at once.
Modifier and Type | Field and Description |
---|---|
private boolean |
m_bIsClosed
Signals if the
AnonProxy.OpenSocketRequester has been or is being
closed. |
private AnonProxy |
m_proxy
AnonProxy object used to send requests and receive responses
to the destination of the initial request. |
private ObjectQueue |
m_socketQueue
A queue used for
SocketGuard objects, wrapping sockets the
client used to send requests over. |
private java.lang.Object |
m_syncObject
Used by the underlying
AnonProxyRequest objects to wait, when
the given AnonProxy needs to reconnect. |
Constructor and Description |
---|
OpenSocketRequester(AnonProxy a_proxy,
java.lang.Object a_syncObject)
Instantiates an
AnonProxy.OpenSocketRequester . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Will stop the
run() method and signal Threads waiting on the
internal socket queue. |
void |
pushSocket(SocketGuard clientSocket)
Adds a
SocketGuard to the internal queue and notifies threads
waiting on the queue. |
void |
run()
|
private ObjectQueue m_socketQueue
SocketGuard
objects, wrapping sockets the
client used to send requests over.
They willprivate AnonProxy m_proxy
AnonProxy
object used to send requests and receive responses
to the destination of the initial request.private java.lang.Object m_syncObject
AnonProxyRequest
objects to wait, when
the given AnonProxy
needs to reconnect.private boolean m_bIsClosed
AnonProxy.OpenSocketRequester
has been or is being
closed.public OpenSocketRequester(AnonProxy a_proxy, java.lang.Object a_syncObject)
AnonProxy.OpenSocketRequester
.a_proxy
- AnonProxy
to communicate over.a_syncObject
- public void pushSocket(SocketGuard clientSocket)
SocketGuard
to the internal queue and notifies threads
waiting on the queue.clientSocket
- The SocketGuard
object to add to the
queue.public void close()
run()
method and signal Threads waiting on the
internal socket queue.public void run()
run
in interface java.lang.Runnable
Copyright © 2023. All rights reserved.