cgl.narada.service.buffering
Class BufferHandler

java.lang.Object
  extended by java.lang.Thread
      extended by cgl.narada.service.buffering.BufferHandler
All Implemented Interfaces:
Runnable

public class BufferHandler
extends Thread

This thread is responsible for sorting the buffer and releasing the events in the buffer.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BufferHandler(BufferingServiceImpl buffServiceImpl)
          Generates a new BufferHandler object.
 
Method Summary
 void notifyBufferHandler()
          This thread can be notified by calling this method.
 void run()
          Waits on the buffering object.
 void stopRunning()
          Stops the running thread.
 void terminateService()
           
 void waitOnBuffer()
          Calling this method causes the caller to wait on the synchronization object for a maximum entry duration.
 void waitOnBuffer(long time)
          Calling this method causes the caller to wait on the synchronization object for the time specified.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BufferHandler

public BufferHandler(BufferingServiceImpl buffServiceImpl)
Generates a new BufferHandler object.

Parameters:
buffServiceImpl - - parent that initiates this thread
Method Detail

notifyBufferHandler

public void notifyBufferHandler()
This thread can be notified by calling this method. On notification, this thread sorts the buffer and releases the events in the buffer.


run

public void run()
Waits on the buffering object. If release factor is set to 1.0, it releases all of the events in the buffer by calling releaseAllEntries() method of the parent. Otherwise it calls releaseAllEntries(double releaseFactor). Thread wakes up if the waiting time is up, if the buffer is full and/or maximum number of entries are reached and then notified.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

stopRunning

public void stopRunning()
Stops the running thread.


terminateService

public void terminateService()

waitOnBuffer

public void waitOnBuffer()
Calling this method causes the caller to wait on the synchronization object for a maximum entry duration.


waitOnBuffer

public void waitOnBuffer(long time)
Calling this method causes the caller to wait on the synchronization object for the time specified.



For comments and suggestions please send e-mail to The NaradaBrokering Project