diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e750148..9e9e444b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Changes +- [API] Fix: do not bind the DefaultActionDispatcher as ActionHandler, so it can be correctly disposed and the thread is closed at the end of a session [#246](https://github.com/eclipse-glsp/glsp-server/pull/246) - Contributed on behalf of Axon Ivy AG + ### Potentially Breaking Changes ## [v2.2.1 - 22/07/2024](https://github.com/eclipse-glsp/glsp-server/releases/tag/v2.2.1) diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/DiagramModule.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/DiagramModule.java index 25c601a2..f371b0e4 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/DiagramModule.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/DiagramModule.java @@ -261,7 +261,7 @@ protected Class bindActionDispatcher() { } protected void configureActionHandlers(final MultiBinding binding) { - binding.add(DefaultActionDispatcher.class); + binding.add(DefaultActionDispatcher.JoinActionHandler.class); binding.add(OperationActionHandler.class); binding.add(RequestModelActionHandler.class); binding.add(RequestPopupModelActionHandler.class); diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java index 3b7ab73b..b5e79b92 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/actions/DefaultActionDispatcher.java @@ -30,6 +30,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.eclipse.glsp.server.actions.AbstractActionHandler; import org.eclipse.glsp.server.actions.Action; import org.eclipse.glsp.server.actions.ActionDispatcher; import org.eclipse.glsp.server.actions.ActionHandler; @@ -46,6 +47,7 @@ import com.google.inject.Inject; import com.google.inject.Provider; + /** *

* An ActionDispatcher that executes all handlers in the same thread. The dispatcher's @@ -53,7 +55,7 @@ * the server. *

*/ -public class DefaultActionDispatcher extends Disposable implements ActionDispatcher, ActionHandler { +public class DefaultActionDispatcher extends Disposable implements ActionDispatcher { protected static final Logger LOGGER = LogManager.getLogger(DefaultActionDispatcher.class); @@ -246,14 +248,6 @@ public void doDispose() { } } - @Override - public List> getHandledActionTypes() { return List.of(JoinAction.class); } - - @Override - public List execute(final Action action) { - return none(); - } - /** * An internal action class that is used to define a join-point within the queue of all pending actions. */ @@ -262,4 +256,11 @@ public JoinAction() { super("internal.join"); } } + + public static class JoinActionHandler extends AbstractActionHandler { + @Override + protected List executeAction(final JoinAction actualAction) { + return none(); + } + } }