|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opcfoundation.ua.utils.AbstractState<SocketState,IOException>
org.opcfoundation.ua.utils.asyncsocket.AsyncSocketImpl
public class AsyncSocketImpl
Async socket.
The object has monitorable internal state SocketState.
Methods for monitoring the state,
State of the socket,
Async input stream,
Async output stream,
Stream alarms| Constructor Summary | |
|---|---|
AsyncSocketImpl()
Constructor for AsyncSocketImpl. |
|
AsyncSocketImpl(SocketChannel chan)
Constructor for AsyncSocketImpl. |
|
AsyncSocketImpl(SocketChannel channel,
Executor triggerExecutor,
AsyncSelector selectorThread)
Constructor for AsyncSocketImpl. |
|
| Method Summary | |
|---|---|
AsyncSocketImpl |
close()
close. |
void |
closeOnFlush()
Convenience method. |
void |
connect(SocketAddress addr)
connect. |
AsyncInputStream |
getInputStream()
getInputStream. |
AsyncOutputStream |
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. |
| Methods inherited from class org.opcfoundation.ua.utils.AbstractState |
|---|
addStateListener, addStateNotifiable, assertNoError, attemptSetState, clearError, getError, getState, hasError, onListenerException, removeStateListener, removeStateNotifiable, setError, setState, waitForState, waitForState, waitForStateUninterruptibly |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.opcfoundation.ua.utils.IStatefulObject |
|---|
addStateListener, addStateNotifiable, getError, getState, removeStateListener, removeStateNotifiable, waitForState, waitForState, waitForStateUninterruptibly |
| Constructor Detail |
|---|
public 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.| Method Detail |
|---|
protected void onStateTransition(SocketState oldState,
SocketState newState)
onStateTransition in class AbstractState<SocketState,IOException>oldState - a StateType object.newState - a StateType object.public AsyncInputStream getInputStream()
getInputStream.
getInputStream in interface AsyncSocketAsyncInputStream object.public AsyncOutputStream getOutputStream()
getOutputStream.
getOutputStream in interface AsyncSocketAsyncOutputStream object.
public AsyncSocketImpl close()
throws IOException
close.
close in interface AsyncSocketAsyncSocketImpl object.
IOException - if any.public SocketChannel socketChannel()
socketChannel.
socketChannel in interface AsyncSocketSocketChannel object.public Socket socket()
socket.
socket in interface AsyncSocketSocket object.protected boolean setState(SocketState state)
setState.
setState in class AbstractState<SocketState,IOException>state - a SocketState object.
protected boolean isStateTransitionAllowed(SocketState oldState,
SocketState newState)
isStateTransitionAllowed in class AbstractState<SocketState,IOException>oldState - a StateType object.newState - a StateType object.
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 boolean syncConnect(SocketAddress addr)
throws IOException
syncConnect.
addr - a SocketAddress object.
IOException - if any.public IStatefulObject<SocketState,IOException> getStateMonitor()
getStateMonitor.
getStateMonitor in interface AsyncSocketIStatefulObject object.public void closeOnFlush()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||