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

Quick Search    Search Deep

org.scoja.server.core
Class EventQueue  view EventQueue download EventQueue.java

java.lang.Object
  extended byorg.scoja.server.core.ClusterSkeleton
      extended byorg.scoja.server.core.EventQueue
All Implemented Interfaces:
Cluster, java.lang.Runnable

public class EventQueue
extends ClusterSkeleton

Estas colas desacoplan la captura de eventos de su procesamiento posterior a través de enlaces, filtros y destinos.

Puede haber tantas instancias como se desee.

Estas colas son activas: se encargan de ir procesando los eventos que le llegan. Se puede configurar cuántas hebras realizan esta labor. En el constructor se indica el máximo número de hebras que queremos (por defecto ClusterSkeleton.DEFAULT_THREAD_COUNT 55 ), pero esta cantidad se puede cambiar dinámicamente con ClusterSkeleton.setThreads(int) 55 . Cuando sobran hebras, se destruyen al terminar el proceso del evento con el que estén. Sin embargo, las hebras sólo se crean cuando llega un nuevo evento, todas las hebras están ocupadas y todavía no se ha llegado al máximo de hebras. Por tanto, el número real de hebras puede no llegar al máximo; aunque es muy probable porque crece monótonamente.


Field Summary
protected  java.lang.String name
           
protected  java.util.LinkedList queue
           
protected  int threadsAwaiting
           
 
Fields inherited from class org.scoja.server.core.ClusterSkeleton
currentThreadCount, DEFAULT_THREAD_COUNT, isRunning, maxThreadCount, stopRequested, threads
 
Constructor Summary
EventQueue(java.lang.String name)
           
 
Method Summary
 void process(EventContext eenv)
           
 void run()
          This method will be called by whoever wishes to run your class implementing Runnable.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class org.scoja.server.core.ClusterSkeleton
getCurrentThreads, getThreads, isRunning, setThreads, shouldStop, start, startAllThreads, startAnotherThread, stopRequested, threadStopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name

queue

protected final java.util.LinkedList queue

threadsAwaiting

protected int threadsAwaiting
Constructor Detail

EventQueue

public EventQueue(java.lang.String name)
Method Detail

process

public void process(EventContext eenv)

run

public void run()
Description copied from interface: java.lang.Runnable
This method will be called by whoever wishes to run your class implementing Runnable. Note that there are no restrictions on what you are allowed to do in the run method, except that you cannot throw a checked exception.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).