org.apache.camel.processor
Class DelayProcessorSupport

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.processor.DelegateProcessor
          extended by org.apache.camel.processor.DelayProcessorSupport
All Implemented Interfaces:
Navigate<Processor>, Processor, Service
Direct Known Subclasses:
Delayer, DelayInterceptor, Throttler

public abstract class DelayProcessorSupport
extends DelegateProcessor

A useful base class for any processor which provides some kind of throttling or delayed processing

Version:
$Revision: 17079 $

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Fields inherited from class org.apache.camel.processor.DelegateProcessor
processor
 
Constructor Summary
DelayProcessorSupport(Processor processor)
           
 
Method Summary
protected  long currentSystemTime()
           
protected abstract  void delay(Exchange exchange)
           
protected  void doStop()
           
protected  void handleSleepInterruptedException(InterruptedException e)
          Called when a sleep is interrupted; allows derived classes to handle this case differently
 boolean isFastStop()
           
 void process(Exchange exchange)
          Processes the message exchange
 void setFastStop(boolean fastStop)
          Enables & disables a fast stop; basically to avoid waiting a possibly long time for delays to complete before the context shuts down; instead the current processing method throws AlreadyStoppedException to terminate processing.
protected  void sleep(long delay)
           
protected  void waitUntil(long time, Exchange exchange)
          Wait until the given system time before continuing
 
Methods inherited from class org.apache.camel.processor.DelegateProcessor
doStart, getProcessor, hasNext, next, proceed, processNext, setProcessor, toString
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final transient org.apache.commons.logging.Log log
Constructor Detail

DelayProcessorSupport

public DelayProcessorSupport(Processor processor)
Method Detail

process

public void process(Exchange exchange)
             throws Exception
Description copied from interface: Processor
Processes the message exchange

Specified by:
process in interface Processor
Overrides:
process in class DelegateProcessor
Parameters:
exchange - the message exchange
Throws:
Exception - if an internal processing error has occurred.

isFastStop

public boolean isFastStop()

setFastStop

public void setFastStop(boolean fastStop)
Enables & disables a fast stop; basically to avoid waiting a possibly long time for delays to complete before the context shuts down; instead the current processing method throws AlreadyStoppedException to terminate processing.


doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class DelegateProcessor
Throws:
Exception

delay

protected abstract void delay(Exchange exchange)
                       throws Exception
Throws:
Exception

waitUntil

protected void waitUntil(long time,
                         Exchange exchange)
                  throws Exception
Wait until the given system time before continuing

Parameters:
time - the system time to wait for
exchange - the exchange being processed
Throws:
Exception

sleep

protected void sleep(long delay)
              throws InterruptedException
Throws:
InterruptedException

handleSleepInterruptedException

protected void handleSleepInterruptedException(InterruptedException e)
Called when a sleep is interrupted; allows derived classes to handle this case differently


currentSystemTime

protected long currentSystemTime()


Copyright © 2007-2010 IONA Open Source Community. All Rights Reserved.