edu.uci.isr.yancees.server.rmi
Class NotificationBuffer

java.lang.Object
  extended by java.lang.Thread
      extended by edu.uci.isr.yancees.server.rmi.NotificationBuffer
All Implemented Interfaces:
java.lang.Runnable

public class NotificationBuffer
extends java.lang.Thread

This buffer schedules events to be notified. The aim is to cope with scalability and high throughput, in order to publish a bunch of events at once, instead of one at a time. This strategy better utilizes the RMI serialization mechanisms and icreases the throughput of the server. A big buffer will allow the server to handle more publish commands per second. However, it will reduce the latency (the time between production and delivery of an event). A low SLEEP_TIME will not permit the buffer to get full, and will reduce the throughput.

Author:
Roberto Silveira Silva Filho [rsilvafi@ics.uci.edu]

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NotificationBuffer(RemoteSubscriberInterface remInt, SubscriberMediator med)
           
 
Method Summary
 void addObjectToBuffer(java.lang.Object obj)
          Method used by the clients of this class to enqueue events in the buffer
 java.lang.Object getObjectFromBuffer()
          This method should be called when there is some event on the buffer, otherwise, it returns null
 void run()
          Main logic of this thread
 
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

NotificationBuffer

public NotificationBuffer(RemoteSubscriberInterface remInt,
                          SubscriberMediator med)
Method Detail

run

public void run()
Main logic of this thread

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

addObjectToBuffer

public void addObjectToBuffer(java.lang.Object obj)
Method used by the clients of this class to enqueue events in the buffer

Parameters:
event -

getObjectFromBuffer

public java.lang.Object getObjectFromBuffer()
This method should be called when there is some event on the buffer, otherwise, it returns null

Returns:
null if buffer is empty, the element in FIFO order, in case there is at least one element on it.