Package com.neovisionaries.ws.client
Class SocketInitiator.SocketFuture
- java.lang.Object
-
- com.neovisionaries.ws.client.SocketInitiator.SocketFuture
-
- Enclosing class:
- SocketInitiator
private class SocketInitiator.SocketFuture extends java.lang.Object
The socket future is shared across allSocketInitiator.SocketRacer
threads and aggregates the results. A socket future is considered fulfilled when...- any racer thread has established a socket in which case all other racers will be stopped, or
- all racer threads returned with an exception, or
- there was no racer thread (e.g. in case there is no network interface).
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Exception
mException
private java.util.concurrent.CountDownLatch
mLatch
private java.util.List<SocketInitiator.SocketRacer>
mRacers
private java.net.Socket
mSocket
-
Constructor Summary
Constructors Modifier Constructor Description private
SocketFuture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.net.Socket
await(java.util.List<SocketInitiator.SocketRacer> racers)
(package private) boolean
hasSocket()
(package private) void
setException(java.lang.Exception exception)
(package private) void
setSocket(SocketInitiator.SocketRacer current, java.net.Socket socket)
-
-
-
Field Detail
-
mLatch
private java.util.concurrent.CountDownLatch mLatch
-
mRacers
private java.util.List<SocketInitiator.SocketRacer> mRacers
-
mSocket
private java.net.Socket mSocket
-
mException
private java.lang.Exception mException
-
-
Method Detail
-
hasSocket
boolean hasSocket()
-
setSocket
void setSocket(SocketInitiator.SocketRacer current, java.net.Socket socket)
-
setException
void setException(java.lang.Exception exception)
-
await
java.net.Socket await(java.util.List<SocketInitiator.SocketRacer> racers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-