Skip to content

Commit

Permalink
GH-1387 Do not bind DefaultActionDispatcher as ActionHandler
Browse files Browse the repository at this point in the history
Because of this threads couldn't be fully disposed
  • Loading branch information
ivy-lli committed Sep 9, 2024
1 parent 80bda42 commit 1ff0974
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [#1387](https://github.com/eclipse-glsp/glsp/issues/1387) - 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ protected Class<? extends ActionDispatcher> bindActionDispatcher() {
}

protected void configureActionHandlers(final MultiBinding<ActionHandler> binding) {
binding.add(DefaultActionDispatcher.class);
binding.add(DefaultActionDispatcher.JoinActionHandler.class);
binding.add(OperationActionHandler.class);
binding.add(RequestModelActionHandler.class);
binding.add(RequestPopupModelActionHandler.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -46,14 +47,15 @@
import com.google.inject.Inject;
import com.google.inject.Provider;


/**
* <p>
* An ActionDispatcher that executes all handlers in the same thread. The dispatcher's
* public methods can be invoked from any thread, e.g. from background jobs running on
* the server.
* </p>
*/
public class DefaultActionDispatcher extends Disposable implements ActionDispatcher, ActionHandler {
public class DefaultActionDispatcher extends Disposable implements ActionDispatcher {

protected static final Logger LOGGER = LogManager.getLogger(DefaultActionDispatcher.class);

Expand Down Expand Up @@ -246,14 +248,6 @@ public void doDispose() {
}
}

@Override
public List<Class<? extends Action>> getHandledActionTypes() { return List.of(JoinAction.class); }

@Override
public List<Action> 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.
*/
Expand All @@ -262,4 +256,11 @@ public JoinAction() {
super("internal.join");
}
}

public static class JoinActionHandler extends AbstractActionHandler<JoinAction> {
@Override
protected List<Action> executeAction(final JoinAction actualAction) {
return none();
}
}
}

0 comments on commit 1ff0974

Please sign in to comment.