Skip to content

Conversation

Fyusel
Copy link
Contributor

@Fyusel Fyusel commented Sep 5, 2025

Description

relates to STACKITSDK-232

Checklist

  • Issue was linked above
  • No generated code was adjusted manually
  • Changelogs
    • Changelog in the root directory was adjusted
    • Changelog(s) of the service(s) were adjusted
  • VERSION file(s) of the service(s) were adjusted
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Unit tests got implemented or updated
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@Fyusel Fyusel requested a review from a team as a code owner September 5, 2025 06:35
@Fyusel Fyusel force-pushed the ft/java-wait-handler branch 2 times, most recently from 060607e to b4e7330 Compare September 9, 2025 09:13
@Fyusel Fyusel force-pushed the ft/java-wait-handler branch 2 times, most recently from 12a9371 to 49fb05c Compare September 10, 2025 06:29
@Fyusel Fyusel force-pushed the ft/java-wait-handler branch 2 times, most recently from 59254e9 to 3a0eea7 Compare September 12, 2025 10:03
@Fyusel Fyusel force-pushed the ft/java-wait-handler branch 2 times, most recently from 49c9074 to 9a4750e Compare October 16, 2025 09:56
@Fyusel Fyusel force-pushed the ft/java-wait-handler branch from 9a4750e to 8ad2045 Compare October 16, 2025 09:58
Signed-off-by: Alexander Dahmen <[email protected]>

### Implementing a service waiter

Waiters are routines that wait for the completion of asynchronous operations. They are located in a folder named `wait` inside each service folder.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Waiters are routines that wait for the completion of asynchronous operations. They are located in a folder named `wait` inside each service folder.
Waiters are routines that wait for the completion of asynchronous operations. They are located in a directory named `wait` inside each service project.

Copy link
Member

Choose a reason for hiding this comment

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

Well no, it's neither a folder nor a directory, it's a java package 😂


Let's suppose you want to implement the waiters for the `Create`, `Update` and `Delete` operations of a resource `bar` of service `foo`:

1. Start by creating a new folder `wait/` inside `services/foo/`, if it doesn't exist yet
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
1. Start by creating a new folder `wait/` inside `services/foo/`, if it doesn't exist yet
1. Start by creating a new Java package `cloud.stackit.sdk.<service>.wait` inside `services/foo/` project, if it doesn't exist yet

import java.util.Arrays;

public class GenericOpenAPIException extends ApiException {
private static final long serialVersionUID = 1L;
Copy link
Member

Choose a reason for hiding this comment

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

Please use a proper UID here

// The linter is complaining about this but since we are using Java 8 the
// possibilities are restricted.
@SuppressWarnings("PMD.DoNotUseThreads")
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
Copy link
Member

Choose a reason for hiding this comment

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

This creates a new Thread Pool for each waiter call. Maybe we can use one central Thread Pool for this somehow? I'm thinking of a Singleton pattern here

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