Package org.apache.http.impl.nio.reactor
Class ListenerEndpointImpl
java.lang.Object
org.apache.http.impl.nio.reactor.ListenerEndpointImpl
- All Implemented Interfaces:
ListenerEndpoint
@Contract(threading=SAFE_CONDITIONAL)
public class ListenerEndpointImpl
extends Object
implements ListenerEndpoint
Default implementation of
ListenerEndpoint
.- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SocketAddress
private final ListenerEndpointClosedCallback
private boolean
private boolean
private IOException
private SelectionKey
-
Constructor Summary
ConstructorsConstructorDescriptionListenerEndpointImpl
(SocketAddress address, ListenerEndpointClosedCallback callback) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
void
close()
Closes this endpoint.void
completed
(SocketAddress address) void
failed
(IOException exception) Returns the socket address of this endpoint.Returns an instance ofIOException
thrown during initialization of this endpoint ornull
, if initialization was successful.boolean
isClosed()
Determines if this endpoint has been closed and is no longer listens for incoming connections.boolean
protected void
setKey
(SelectionKey key) toString()
void
waitFor()
Waits for completion of initialization process of this endpoint.
-
Field Details
-
completed
private volatile boolean completed -
closed
private volatile boolean closed -
key
-
address
-
exception
-
callback
-
-
Constructor Details
-
ListenerEndpointImpl
-
-
Method Details
-
getAddress
Description copied from interface:ListenerEndpoint
Returns the socket address of this endpoint.- Specified by:
getAddress
in interfaceListenerEndpoint
- Returns:
- socket address.
-
isCompleted
public boolean isCompleted() -
getException
Description copied from interface:ListenerEndpoint
Returns an instance ofIOException
thrown during initialization of this endpoint ornull
, if initialization was successful.- Specified by:
getException
in interfaceListenerEndpoint
- Returns:
- I/O exception object or
null
.
-
waitFor
Description copied from interface:ListenerEndpoint
Waits for completion of initialization process of this endpoint.- Specified by:
waitFor
in interfaceListenerEndpoint
- Throws:
InterruptedException
- in case the initialization process was interrupted.
-
completed
-
failed
-
cancel
public void cancel() -
setKey
-
isClosed
public boolean isClosed()Description copied from interface:ListenerEndpoint
Determines if this endpoint has been closed and is no longer listens for incoming connections.- Specified by:
isClosed
in interfaceListenerEndpoint
- Returns:
true
if the endpoint has been closed,false
otherwise.
-
close
public void close()Description copied from interface:ListenerEndpoint
Closes this endpoint. The endpoint will stop accepting incoming connection.- Specified by:
close
in interfaceListenerEndpoint
-
toString
-