FreeHEP API
Version current

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,v 1.1 2003/03/10 21:56:05 tonyj Exp $
Source Code:
AsynchronousRecordSource.java

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

public 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

public 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

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

Throws:
InterruptedException

addRecordListener

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


removeRecordListener

public void removeRecordListener(RecordReadyListener l)
Remove a record listener


FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.