Package org.hotswap.agent.watch.nio
Class EventDispatcher
- java.lang.Object
-
- org.hotswap.agent.watch.nio.EventDispatcher
-
- All Implemented Interfaces:
Runnable
public class EventDispatcher extends Object implements Runnable
The EventDispatcher holds a queue of all events collected by the watcher but not yet processed. It runs on its own thread and is responsible for calling all the registered listeners. Since file system events can spawn too fast, this implementation works as buffer for fast spawning events. The watcher is now responsible for collecting and pushing events in this queue.
-
-
Field Summary
Fields Modifier and Type Field Description protected AgentLoggerLOGGERThe logger.
-
Constructor Summary
Constructors Constructor Description EventDispatcher(Map<Path,List<WatchEventListener>> listeners)Instantiates a new event dispatcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(WatchEvent<Path> event, Path path)Adds the.voidrun()voidstart()Start.voidstop()Stop.
-
-
-
Field Detail
-
LOGGER
protected AgentLogger LOGGER
The logger.
-
-
Constructor Detail
-
EventDispatcher
public EventDispatcher(Map<Path,List<WatchEventListener>> listeners)
Instantiates a new event dispatcher.- Parameters:
listeners- the listeners
-
-
Method Detail
-
add
public void add(WatchEvent<Path> event, Path path)
Adds the.- Parameters:
event- the eventpath- the path
-
start
public void start()
Start.
-
stop
public void stop() throws InterruptedExceptionStop.- Throws:
InterruptedException- the interrupted exception
-
-