Avoid IllegalStateExceptions

The DefaultNamespaceManager has not been a singleton.
Because of this, instances could be removed before
the event has been handled completely and therefore
the handler could no longer be removed from the queue,
resulting in an IllegalStateException.

By making the manager a singleton, it is no longer
garbage collected and therefore we do not get the
exception any longer.

Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
Rene Pfeuffer
2023-09-20 17:36:34 +02:00
parent fa6769e5bb
commit 5149927195
3 changed files with 5 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ import sonia.scm.HandlerEventType;
import sonia.scm.event.ScmEventBus;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.Collection;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -36,6 +37,7 @@ import java.util.stream.Collectors;
import static sonia.scm.ContextEntry.ContextBuilder.entity;
import static sonia.scm.NotFoundException.notFound;
@Singleton
public class DefaultNamespaceManager implements NamespaceManager {
private final RepositoryManager repositoryManager;