Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.media.mn8.protocol.jabber
Class JabberDataBlockDispatcher  view JabberDataBlockDispatcher download JabberDataBlockDispatcher.java

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.media.mn8.protocol.jabber.JabberDataBlockDispatcher
All Implemented Interfaces:
java.lang.Runnable

public class JabberDataBlockDispatcher
extends java.lang.Thread

The dispatcher for blocks that have arrived. Adds new blocks to the dispatch queue, and then dispatches waiting blocks in their own thread to avoid holding up the stream reader.


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  boolean dispatcherActive
          Flag to watch the dispatching loop
private  JabberListener listener
          The recipient waiting on this stream
private  java.util.Vector waitingQueue
          The list of messages waiting to be dispatched
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JabberDataBlockDispatcher()
          Constructor to start the dispatcher in a thread.
 
Method Summary
 void broadcastBeginConversation()
          Method to tell the listener the stream is ready for talking to.
 void broadcastJabberDataBlock(JabberDataBlock dataBlock)
          Method to add a datablock to the dispatch queue
 void broadcastTerminatedConnection(java.lang.Exception exception)
          Method to tell the listener the connection has been terminated
 void halt()
          Method to stop the dispatcher
 void run()
          The thread loop that handles dispatching any waiting datablocks
 void setJabberListener(JabberListener _listener)
          Set the listener that we are dispatching to.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, 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
 

Field Detail

listener

private JabberListener listener
The recipient waiting on this stream


waitingQueue

private java.util.Vector waitingQueue
The list of messages waiting to be dispatched


dispatcherActive

private boolean dispatcherActive
Flag to watch the dispatching loop

Constructor Detail

JabberDataBlockDispatcher

public JabberDataBlockDispatcher()
Constructor to start the dispatcher in a thread.

Method Detail

setJabberListener

public void setJabberListener(JabberListener _listener)
Set the listener that we are dispatching to. Allows for switching of clients in mid stream.


broadcastJabberDataBlock

public void broadcastJabberDataBlock(JabberDataBlock dataBlock)
Method to add a datablock to the dispatch queue


run

public void run()
The thread loop that handles dispatching any waiting datablocks


halt

public void halt()
Method to stop the dispatcher


broadcastTerminatedConnection

public void broadcastTerminatedConnection(java.lang.Exception exception)
Method to tell the listener the connection has been terminated


broadcastBeginConversation

public void broadcastBeginConversation()
Method to tell the listener the stream is ready for talking to.