-
Notifications
You must be signed in to change notification settings - Fork 0
feature(core): Add wait handler structure #19
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
base: main
Are you sure you want to change the base?
Conversation
core/src/main/java/cloud/stackit/sdk/core/oapierror/GenericOpenAPIError.java
Outdated
Show resolved
Hide resolved
services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/Wait.java
Outdated
Show resolved
Hide resolved
services/resourcemanager/src/test/java/cloud/stackit/sdk/resourcemanager/WaitTest.java
Outdated
Show resolved
Hide resolved
services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/Wait.java
Outdated
Show resolved
Hide resolved
060607e
to
b4e7330
Compare
core/src/test/java/cloud/stackit/sdk/core/wait/AsyncWaitHandlerTest.java
Outdated
Show resolved
Hide resolved
12a9371
to
49fb05c
Compare
core/src/main/java/cloud/stackit/sdk/core/oapierror/GenericOpenAPIError.java
Outdated
Show resolved
Hide resolved
core/src/main/java/cloud/stackit/sdk/core/oapierror/GenericOpenAPIError.java
Outdated
Show resolved
Hide resolved
...esourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/ResourcemanagerWait.java
Outdated
Show resolved
Hide resolved
...esourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/ResourcemanagerWait.java
Outdated
Show resolved
Hide resolved
...esourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/ResourcemanagerWait.java
Outdated
Show resolved
Hide resolved
.../src/test/java/cloud/stackit/sdk/resourcemanager/ResourcemanagerWaitTestmanagerWaitTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/cloud/stackit/sdk/resourcemanager/ResourcemanagerWaitTestmanagerWaitTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/cloud/stackit/sdk/resourcemanager/ResourcemanagerWaitTestmanagerWaitTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/cloud/stackit/sdk/resourcemanager/ResourcemanagerWaitTestmanagerWaitTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/cloud/stackit/sdk/core/wait/AsyncActionHandler.java
Outdated
Show resolved
Hide resolved
core/src/main/java/cloud/stackit/sdk/core/wait/AsyncActionHandler.java
Outdated
Show resolved
Hide resolved
core/src/main/java/cloud/stackit/sdk/core/oapierror/GenericOpenAPIError.java
Outdated
Show resolved
Hide resolved
core/src/main/java/cloud/stackit/sdk/core/wait/AsyncActionHandler.java
Outdated
Show resolved
Hide resolved
core/src/main/java/cloud/stackit/sdk/core/wait/AsyncActionHandler.java
Outdated
Show resolved
Hide resolved
59254e9
to
3a0eea7
Compare
...esourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/ResourcemanagerWait.java
Outdated
Show resolved
Hide resolved
...esourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/wait/ResourcemanagerWait.java
Outdated
Show resolved
Hide resolved
49c9074
to
9a4750e
Compare
Signed-off-by: Alexander Dahmen <[email protected]>
9a4750e
to
8ad2045
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
Description
relates to STACKITSDK-232
Checklist
make fmt
examples/
directory)make test
(will be checked by CI)make lint
(will be checked by CI)