Skip to content

feat: introduce timeout and retry parameter for BM executor shutdown#1113

Merged
ava-fred merged 1 commit into
dsldevkit:masterfrom
ava-fred:work.250409
Apr 11, 2025
Merged

feat: introduce timeout and retry parameter for BM executor shutdown#1113
ava-fred merged 1 commit into
dsldevkit:masterfrom
ava-fred:work.250409

Conversation

@ava-fred
Copy link
Copy Markdown
Collaborator

The awaitBinaryStorageExecutorTermination() in
MonitoredClusteringBuilderState is extended with parameters that allow the timeout for the shutdown and the number of attempts to make to be specified.

(also implement 2 small cleanups of code causing a compile error depending on settings and a FB warning suppression that is no longer necessary)

if (root != null && NodeModelUtils.getNode(root) instanceof ICompositeNode composite) {
composite.getText(); // side-effect on removing com.avaloq.tools.ddk.xtext.resource.persistence.ProxyCompositeNode
if (root != null) {
NodeModelUtils.getNode(root).getText(); // side-effect on removing com.avaloq.tools.ddk.xtext.resource.persistence.ProxyCompositeNode
Copy link
Copy Markdown
Member

@rubenporras rubenporras Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need to check for null on NodeModelUtils.getNode(root)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do


// Attempt to wait for queued work to complete
int retries = 0;
boolean terminated = false;
Copy link
Copy Markdown
Member

@rubenporras rubenporras Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
boolean terminated = false;
boolean terminated;

queuedTaskCount, activeTaskCount, binaryStorageExecutor.getQueue().size(), binaryStorageExecutor.getActiveCount()));
binaryStorageExecutor.shutdownNow();
} catch (InterruptedException e) {
LOGGER.warn("Interrupted waiting for binaryStorageExecutor shutdown, terminating");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to keep the part of the message "tasks not completed in time, start with %d queued / %d active; now have %d / %d" when interrupted.

The awaitBinaryStorageExecutorTermination() in
MonitoredClusteringBuilderState is extended with parameters that allow
the timeout for the shutdown and the number of attempts to make to be
specified.

(also implement 2 small cleanups of code causing a compile error
depending on settings and a FB warning suppression that is no longer
necessary)
public static void ensureNodeModelLoaded(final Resource resource) {
if (resource instanceof LazyLinkingResource2 lazyLinkinResource && lazyLinkinResource.isLoadedFromStorage()) {
EObject root = resource.getContents().get(0);
if (root != null && NodeModelUtils.getNode(root) instanceof ICompositeNode composite) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your version is fine for me, but what about just naming the variable rootNode instead of composite? That would be a smaller change than this one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't fix the compiler error I see when I include the DDK in an ASMD workspace. The compiler complains because NodeModelUtils.getNode() returns an ICompositeNode, so the instanceof test is always true. The message is "Expression type cannot be a subtype of the Pattern type".

@ava-fred ava-fred merged commit c7febea into dsldevkit:master Apr 11, 2025
2 checks passed
@ava-fred ava-fred deleted the work.250409 branch April 11, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants