org.opcfoundation.ua.utils
Interface IStatefulObject<StateType,ErrorType extends Throwable>

All Known Subinterfaces:
CloseableObject, EndpointServer
All Known Implementing Classes:
AbstractServerConnection, AbstractServerSecureChannel, AbstractState, AsyncRead, AsyncServerSocket, AsyncSocketImpl, AsyncWrite, BufferMonitor, HttpsServer, HttpsServerConnection, HttpsServerSecureChannel, OpcTcpServer, OpcTcpServerConnection, OpcTcpServerSecureChannel, State

public interface IStatefulObject<StateType,ErrorType extends Throwable>

IStatefulObject interface.

Author:
Toni Kalajainen (toni.kalajainen@vtt.fi)

Method Summary
 void addStateListener(StateListener<StateType> listener)
          Add on-event listener.
 void addStateNotifiable(StateListener<StateType> notifiable)
          Add post-event notification listener.
 ErrorType getError()
          Get error state or null
 StateType getState()
          getState.
 void removeStateListener(StateListener<StateType> listener)
          removeStateListener.
 void removeStateNotifiable(StateListener<StateType> notifiable)
          removeStateNotifiable.
 StateType waitForState(Set<StateType> set)
          Wait until state changes to one of the given states.
 StateType waitForState(Set<StateType> set, long timeout, TimeUnit unit)
          Wait until state changes to one of the given states or until time out occurs.
 StateType waitForStateUninterruptibly(Set<StateType> set)
          Wait until state changes to one of the given states.
 

Method Detail

addStateNotifiable

void addStateNotifiable(StateListener<StateType> notifiable)
Add post-event notification listener. The prosessing thread is random. The prosessing order is not guaranteed if the handling is not synchronized.

Parameters:
notifiable - a StateListener object.

removeStateNotifiable

void removeStateNotifiable(StateListener<StateType> notifiable)

removeStateNotifiable.

Parameters:
notifiable - a StateListener object.

addStateListener

void addStateListener(StateListener<StateType> listener)
Add on-event listener.

Parameters:
listener - a StateListener object.

removeStateListener

void removeStateListener(StateListener<StateType> listener)

removeStateListener.

Parameters:
listener - a StateListener object.

getState

StateType getState()

getState.

Returns:
a StateType object.

waitForState

StateType waitForState(Set<StateType> set)
                       throws InterruptedException,
                              ErrorType extends Throwable
Wait until state changes to one of the given states.

Parameters:
set - states that ends waiting
Returns:
the state in the given set that broke the wait
Throws:
InterruptedException - if any.
ErrorType - if any.
ErrorType extends Throwable

waitForStateUninterruptibly

StateType waitForStateUninterruptibly(Set<StateType> set)
                                      throws ErrorType extends Throwable
Wait until state changes to one of the given states.

Parameters:
set - states that ends waiting
Returns:
the state in the given set that broke the wait
Throws:
ErrorType - if any.
ErrorType extends Throwable

waitForState

StateType waitForState(Set<StateType> set,
                       long timeout,
                       TimeUnit unit)
                       throws InterruptedException,
                              TimeoutException,
                              ErrorType extends Throwable
Wait until state changes to one of the given states or until time out occurs.

Parameters:
set - a Set object.
timeout - a long.
unit - a TimeUnit object.
Returns:
state one in set
Throws:
InterruptedException - thread was interrupted
TimeoutException - timeout occured
ErrorType - if any.
ErrorType extends Throwable

getError

ErrorType getError()
Get error state or null

Returns:
error


Copyright © 2018. All rights reserved.