Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSP-1387 Do not bind DefaultActionDispatcher as ActionHandler #246

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 [#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)
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();
}
}
}
Loading