org.semanticdesktop.aperture.util
Class StreamMonitor

java.lang.Object
  extended by org.semanticdesktop.aperture.util.StreamMonitor

public class StreamMonitor
extends Object

Monitors whether a thread that consumes an input stream works or has it stalled. It can be used to protect an application against unreliable external libraries.

Author:
antheque

Nested Class Summary
static class StreamMonitor.ProcessingAbortedException
          Thrown during processing when the StreamMonitor decides that the stream consumer has stalled, and has to be killed.
static class StreamMonitor.ProcessingInterruptedException
          Thrown during processing when StreamMonitor.StopRequestor.isStopRequested() returns true
static interface StreamMonitor.StopRequestor
           
static class StreamMonitor.StreamConsumer
           
static interface StreamMonitor.StreamConsumerFactory
           
 
Constructor Summary
StreamMonitor(InputStream stream, StreamMonitor.StreamConsumerFactory threadFac, StreamMonitor.StopRequestor stopRequestor, long maxProcessingTimePerMb, long minimumMaxProcessingTime, long maxIdleReadTime)
           
 
Method Summary
 void resumeMonitoring()
           
 void setStreamConsumerFactory(StreamMonitor.StreamConsumerFactory abortableThreadFactory)
           
 void start()
           
 void suspendMonitoring()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamMonitor

public StreamMonitor(InputStream stream,
                     StreamMonitor.StreamConsumerFactory threadFac,
                     StreamMonitor.StopRequestor stopRequestor,
                     long maxProcessingTimePerMb,
                     long minimumMaxProcessingTime,
                     long maxIdleReadTime)
Method Detail

setStreamConsumerFactory

public void setStreamConsumerFactory(StreamMonitor.StreamConsumerFactory abortableThreadFactory)

start

public void start()
           throws Exception
Throws:
Exception

suspendMonitoring

public void suspendMonitoring()

resumeMonitoring

public void resumeMonitoring()


Copyright © 2010 Aperture Development Team. All Rights Reserved.