org.freehep.record.source
Interface AsynchronousRecordSource

All Superinterfaces:
SequentialRecordSource

public interface AsynchronousRecordSource
extends SequentialRecordSource

A mixin interface that can be implemented by RecordSource's. Typical uses would be for live sources (e.g. sampling data from a running experiment) or reading data over a slow connection.

Version:
$Id: AsynchronousRecordSource.java 8584 2006-08-10 23:06:37Z duns $

Field Summary
 
Fields inherited from interface org.freehep.record.source.SequentialRecordSource
UNKNOWN
 
Method Summary
 void addRecordListener(RecordReadyListener l)
          Add a record listener that will be notified when the record is ready
 boolean isRecordReady()
          Test if non-blocking mode is enabled.
 void removeRecordListener(RecordReadyListener l)
          Remove a record listener
 void setNonBlocking(boolean value)
          When non blocking is set all methods which would normally block, such as next() previous(), skip(), goToRecord(), will instead return immediately.
 void waitForRecordReady()
          This method will block until the requested record is ready
 
Methods inherited from interface org.freehep.record.source.SequentialRecordSource
close, getCurrentRecord, getEstimatedSize, getRecordClass, getSourceName, next, releaseRecord, rewind
 

Method Detail

setNonBlocking

void setNonBlocking(boolean value)
When non blocking is set all methods which would normally block, such as next() previous(), skip(), goToRecord(), will instead return immediately. The caller is then resposnsible to use this interface to check when the requested record is ready before calling getCurrentObject() etc. If non-blocking is not enabled then AsynchronousRecordSources will behave exactly as non-asynchronous sources.

Parameters:
value - true to enable non-blocking mode, false to disable.

isRecordReady

boolean isRecordReady()
Test if non-blocking mode is enabled.

Returns:
true if non-blocking mode is enabled. boolean isNonBlocking(); /** Returns true is the requested record is available.

waitForRecordReady

void waitForRecordReady()
                        throws InterruptedException
This method will block until the requested record is ready

Throws:
InterruptedException

addRecordListener

void addRecordListener(RecordReadyListener l)
Add a record listener that will be notified when the record is ready


removeRecordListener

void removeRecordListener(RecordReadyListener l)
Remove a record listener



Copyright © 2000-2007 FreeHEP. All Rights Reserved.