mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Запрет добавления и удаления обработчиков во время впыолнения
This commit is contained in:
parent
40392f24cd
commit
b83666a584
1 changed files with 2 additions and 0 deletions
|
@ -57,12 +57,14 @@ public synchronized void stop()
|
|||
public BlockingQueue<QueueEntry> queue = new LinkedBlockingQueue<>(QUEUE_MAX_SIZE); //Максимальный размер очереди
|
||||
public int registerHandler(EventHandler<EventInterface> func, UUID[] events)
|
||||
{
|
||||
if(isStarted.get()) throw new IllegalThreadStateException("It is forbidden to add a handler during thread operation.");
|
||||
Arrays.sort(events);
|
||||
handlers.add(new Entry(func,events));
|
||||
return handlers.size();
|
||||
}
|
||||
public void unregisterHandler(EventHandler<EventInterface> func)
|
||||
{
|
||||
if(isStarted.get()) throw new IllegalThreadStateException("It is forbidden to remove a handler during thread operation.");
|
||||
handlers.removeIf(e -> e.func.equals(func));
|
||||
}
|
||||
public void sendEvent(UUID key, EventInterface event, boolean blocking)
|
||||
|
|
Loading…
Reference in a new issue