public class AsyncSocketImpl extends AbstractState<SocketState,IOException> implements AsyncSocket, IStatefulObject<SocketState,IOException>
The object has monitorable internal state SocketState.
Methods for monitoring the state,
State of the socket,
Async input stream,
Async output stream,
Stream alarms| Modifier and Type | Class and Description |
|---|---|
class |
AsyncSocketImpl.AsyncSocketInputStream
Internal
AsyncInputStream of the AsyncSocketImpl. |
class |
AsyncSocketImpl.AsyncSocketOutputStream
Internal
AsyncOutputStream of the AsyncSocketImpl. |
| Constructor and Description |
|---|
AsyncSocketImpl()
Constructor for AsyncSocketImpl.
|
AsyncSocketImpl(SocketChannel chan)
Constructor for AsyncSocketImpl.
|
AsyncSocketImpl(SocketChannel channel,
Executor triggerExecutor,
AsyncSelector selectorThread)
Constructor for AsyncSocketImpl.
|
| Modifier and Type | Method and Description |
|---|---|
AsyncSocketImpl |
close()
close.
|
void |
closeOnFlush()
Convenience method.
|
void |
connect(SocketAddress addr)
connect.
|
AsyncSocketImpl.AsyncSocketInputStream |
getInputStream()
getInputStream.
|
AsyncSocketImpl.AsyncSocketOutputStream |
getOutputStream()
getOutputStream.
|
IStatefulObject<SocketState,IOException> |
getStateMonitor()
getStateMonitor.
|
protected boolean |
isStateTransitionAllowed(SocketState oldState,
SocketState newState)
Checks whether state transition is allowed.
|
protected void |
onStateTransition(SocketState oldState,
SocketState newState)
Override this.
|
protected boolean |
setState(SocketState state)
setState.
|
Socket |
socket()
socket.
|
SocketChannel |
socketChannel()
socketChannel.
|
boolean |
syncConnect(SocketAddress addr)
syncConnect.
|
addStateListener, addStateNotifiable, attemptSetState, clearError, getError, getState, hasError, onListenerException, removeStateListener, removeStateNotifiable, setError, setState, throwIfError, waitForState, waitForState, waitForStateUninterruptiblyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddStateListener, addStateNotifiable, getError, getState, removeStateListener, removeStateNotifiable, waitForState, waitForState, waitForStateUninterruptiblypublic AsyncSocketImpl()
throws IOException
Constructor for AsyncSocketImpl.
IOException - if any.public AsyncSocketImpl(SocketChannel chan) throws IOException
Constructor for AsyncSocketImpl.
chan - a SocketChannel object.IOException - if any.public AsyncSocketImpl(SocketChannel channel, Executor triggerExecutor, AsyncSelector selectorThread) throws IOException
Constructor for AsyncSocketImpl.
channel - a SocketChannel object.triggerExecutor - a Executor object.selectorThread - a AsyncSelector object.IOException - if any.public AsyncSocketImpl close() throws IOException
close.
close in interface AsyncSocketAsyncSocketImpl object.IOException - if any.public void closeOnFlush()
public void connect(SocketAddress addr) throws IOException
connect.
Async connect. The state is set to Connecting upon successful attempt (method returns without exeception). Once the connection attempt is finished the object state will shift either to Error or to Connected (See getState()). State changes can be monitored by attaching listeners (See addStateListener()).connect in interface AsyncSocketaddr - a SocketAddress object.IOException - if any.public AsyncSocketImpl.AsyncSocketInputStream getInputStream()
getInputStream.
getInputStream in interface AsyncSocketAsyncInputStream object.public AsyncSocketImpl.AsyncSocketOutputStream getOutputStream()
getOutputStream.
getOutputStream in interface AsyncSocketAsyncOutputStream object.public IStatefulObject<SocketState,IOException> getStateMonitor()
getStateMonitor.
getStateMonitor in interface AsyncSocketIStatefulObject object.public Socket socket()
socket.
socket in interface AsyncSocketSocket object.public SocketChannel socketChannel()
socketChannel.
socketChannel in interface AsyncSocketSocketChannel object.public boolean syncConnect(SocketAddress addr) throws IOException
syncConnect.
addr - a SocketAddress object.IOException - if any.protected boolean isStateTransitionAllowed(SocketState oldState, SocketState newState)
isStateTransitionAllowed in class AbstractState<SocketState,IOException>oldState - a StateType object.newState - a StateType object.protected void onStateTransition(SocketState oldState, SocketState newState)
onStateTransition in class AbstractState<SocketState,IOException>oldState - a StateType object.newState - a StateType object.protected boolean setState(SocketState state)
setState.
setState in class AbstractState<SocketState,IOException>state - a SocketState object.Copyright © 2026. All rights reserved.