org.nuiton.wikitty
Class WikittyServiceNotifier.EventThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.nuiton.wikitty.WikittyServiceNotifier.EventThread
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
WikittyServiceNotifier

public static class WikittyServiceNotifier.EventThread
extends java.lang.Thread

Thread utilise pour envoyer les events. On rend accessible ce thread pour pouvoir y acceder depuis l'exterieur (pour l'instant pour les tests mais peut-etre plus tard du monitoring). Il permet a un thread d'attendre qu'un evenement leve a une certaine heure est bien ete dispatchee grace a la methode waitfor


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  org.nuiton.util.ListenerSet<WikittyServiceListener> allWikittyServiceListeners
          Wikitty service listener (all event).
protected  java.util.concurrent.LinkedBlockingQueue<WikittyServiceEvent> eventToSend
          reference vers la collection qui contient les events a envoyer
protected  long lastEventTime
          heure du dernier event envoye
protected  org.nuiton.util.ListenerSet<WikittyServiceListener> localWikittyServiceListeners
          Wikitty service listener (only for local event).
protected  boolean mustBeRunning
           
protected  org.nuiton.util.ListenerSet<WikittyServiceListener> remoteWikittyServiceListeners
          Wikitty service listener (only for remote event).
protected  java.util.SortedMap<java.lang.Long,java.lang.Object> waiter
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WikittyServiceNotifier.EventThread(java.util.concurrent.LinkedBlockingQueue<WikittyServiceEvent> eventToSend, org.nuiton.util.ListenerSet<WikittyServiceListener> allWikittyServiceListeners, org.nuiton.util.ListenerSet<WikittyServiceListener> localWikittyServiceListeners, org.nuiton.util.ListenerSet<WikittyServiceListener> remoteWikittyServiceListeners)
           
 
Method Summary
protected  void askStop()
          demande l'arret du thread, ne doit ĂȘtre appeler que par le finalize du WikittyServiceNotifier
protected  void processEventQueue()
           
 void run()
           
 boolean stopAsked()
          retourne vrai si on a demande l'arret du thread
 void waitFor(long eventTime)
          thread that want wait for particulare event to be processed, can be call this method with event time in argument.
 
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
 

Field Detail

mustBeRunning

protected boolean mustBeRunning

waiter

protected java.util.SortedMap<java.lang.Long,java.lang.Object> waiter

eventToSend

protected java.util.concurrent.LinkedBlockingQueue<WikittyServiceEvent> eventToSend
reference vers la collection qui contient les events a envoyer


allWikittyServiceListeners

protected org.nuiton.util.ListenerSet<WikittyServiceListener> allWikittyServiceListeners
Wikitty service listener (all event).


localWikittyServiceListeners

protected org.nuiton.util.ListenerSet<WikittyServiceListener> localWikittyServiceListeners
Wikitty service listener (only for local event).


remoteWikittyServiceListeners

protected org.nuiton.util.ListenerSet<WikittyServiceListener> remoteWikittyServiceListeners
Wikitty service listener (only for remote event).


lastEventTime

protected long lastEventTime
heure du dernier event envoye

Constructor Detail

WikittyServiceNotifier.EventThread

public WikittyServiceNotifier.EventThread(java.util.concurrent.LinkedBlockingQueue<WikittyServiceEvent> eventToSend,
                                          org.nuiton.util.ListenerSet<WikittyServiceListener> allWikittyServiceListeners,
                                          org.nuiton.util.ListenerSet<WikittyServiceListener> localWikittyServiceListeners,
                                          org.nuiton.util.ListenerSet<WikittyServiceListener> remoteWikittyServiceListeners)
Method Detail

askStop

protected void askStop()
demande l'arret du thread, ne doit ĂȘtre appeler que par le finalize du WikittyServiceNotifier


stopAsked

public boolean stopAsked()
retourne vrai si on a demande l'arret du thread

Returns:

waitFor

public void waitFor(long eventTime)
             throws java.lang.InterruptedException
thread that want wait for particulare event to be processed, can be call this method with event time in argument. Used only in unit test but this is necessary for test.

Throws:
java.lang.InterruptedException

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

processEventQueue

protected void processEventQueue()


Copyright © 2009-2010 CodeLutin. All Rights Reserved.