org.jetlang.channels
Class LastSubscriber<T>

java.lang.Object
  extended by org.jetlang.channels.BaseSubscription<T>
      extended by org.jetlang.channels.LastSubscriber<T>
All Implemented Interfaces:
Subscribable<T>, Callback<T>

public class LastSubscriber<T>
extends BaseSubscription<T>

Subscribes to last event received on the channel. If consuming thread cannot process events as fast as they arrive, then older events will be dropped in favor of most recent. Flush interval determines rate at which events are processes. If interval is less than 1, then events will be delivered as fast as consuming thread can handle them.


Constructor Summary
LastSubscriber(Fiber context, Callback<T> target, Filter<T> filter, int flushInterval, java.util.concurrent.TimeUnit timeUnit)
           
LastSubscriber(Fiber context, Callback<T> target, int flushInterval, java.util.concurrent.TimeUnit timeUnit)
           
 
Method Summary
protected  void onMessageOnProducerThread(T msg)
           
 
Methods inherited from class org.jetlang.channels.BaseSubscription
getQueue, onMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LastSubscriber

public LastSubscriber(Fiber context,
                      Callback<T> target,
                      Filter<T> filter,
                      int flushInterval,
                      java.util.concurrent.TimeUnit timeUnit)

LastSubscriber

public LastSubscriber(Fiber context,
                      Callback<T> target,
                      int flushInterval,
                      java.util.concurrent.TimeUnit timeUnit)
Method Detail

onMessageOnProducerThread

protected void onMessageOnProducerThread(T msg)
Specified by:
onMessageOnProducerThread in class BaseSubscription<T>


Copyright © 2009. All Rights Reserved.