org.opcfoundation.ua.utils.asyncsocket
Class BufferMonitor

java.lang.Object
  extended by org.opcfoundation.ua.utils.AbstractState<BufferMonitorState,IOException>
      extended by org.opcfoundation.ua.utils.asyncsocket.BufferMonitor
All Implemented Interfaces:
Comparable<BufferMonitor>, IStatefulObject<BufferMonitorState,IOException>

public abstract class BufferMonitor
extends AbstractState<BufferMonitorState,IOException>
implements Comparable<BufferMonitor>

BufferMonitor is a monitor that triggers when a specific position is reached. The position to monitor in AsyncSocketInputStream is the number of bytes received (buffered, not read) and in AsyncSocketOutputStream the number of bytes flushed to TCP Stack.

User can set event listeners or wait for a state change. E.g. // Block until stream has buffered 1000 bytes inputStream. createAlarm(inputStream.getPosition() + 1000, null). waitForState(AlarmState.FINAL_STATES);

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

Method Summary
 void cancel()
          cancel.
 int compareTo(BufferMonitor o)
          
 long getTriggerPos()
          Getter for the field triggerPos.
protected  void setError(IOException e)
          setError.
 
Methods inherited from class org.opcfoundation.ua.utils.AbstractState
addStateListener, addStateNotifiable, assertNoError, attemptSetState, clearError, getError, getState, hasError, isStateTransitionAllowed, onListenerException, onStateTransition, removeStateListener, removeStateNotifiable, setState, setState, waitForState, waitForState, waitForStateUninterruptibly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTriggerPos

public long getTriggerPos()

Getter for the field triggerPos.

Returns:
a long.

compareTo

public int compareTo(BufferMonitor o)

Specified by:
compareTo in interface Comparable<BufferMonitor>

cancel

public void cancel()

cancel.


setError

protected void setError(IOException e)

setError.

Overrides:
setError in class AbstractState<BufferMonitorState,IOException>
Parameters:
e - a IOException object.


Copyright © 2018. All rights reserved.