Interface CloudServiceFactory
The taken input configurations are always cloned before being used, so there is no need to do this manually. This is due to the fact, that
- there might be changes made by the system to the given configuration which should not get reflected to the later created services based on the configuration.
- changes made to the configuration should not get reflected into the service, this might lead to unexpected behaviour of the system.
A method call to any of the create methods will always generate a different result if the service was created successfully, even if the same configuration was used multiple times. You can safely assume, that a service created by this factory is ALWAYS unique.
All factory methods are thread safe, calling them with the same configuration across multiple threads will not lead to duplicate service results.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptioncreateCloudService(@NonNull ServiceConfiguration serviceConfiguration) Creates and prepares a new cloud service based on the given configuration.createCloudServiceAsync(@NonNull ServiceConfiguration configuration) Creates and prepares a new cloud service based on the given configuration.
-
Method Details
-
createCloudService
@NonNull @NonNull ServiceCreateResult createCloudService(@NonNull @NonNull ServiceConfiguration serviceConfiguration) Creates and prepares a new cloud service based on the given configuration. This method can be called with the same configuration multiple times and will always (if the service was created successfully) in a different result.This method will return a result with the state set to
FAILEDif the service could not get created. This can happen (for example) if:- no node in the cluster can currently pick up the service (for example if all nodes are draining).
- the configured node in the configuration is not connected or draining.
- the selected node to start the service did not respond within a given time (uncommon).
The result of the service creation will only have a state of
DEFERREDif a retry configuration was provided to the given service configuration.- Parameters:
serviceConfiguration- the configuration to base the newly created service on.- Returns:
- a result representing the state of the service creation.
- Throws:
NullPointerException- if the given service configuration is null.
-
createCloudServiceAsync
@NonNull @NonNull CompletableFuture<ServiceCreateResult> createCloudServiceAsync(@NonNull @NonNull ServiceConfiguration configuration) Creates and prepares a new cloud service based on the given configuration. This method can be called with the same configuration multiple times and will always (if the service was created successfully) in a different result.This method will return a task completed with null if the service could not get created. This can happen (for example) if:
- no node in the cluster can currently pick up the service (for example if all nodes are draining).
- the configured node in the configuration is not connected or draining.
- the selected node to start the service did not respond within a given time (uncommon).
The result of the service creation will only have a state of
DEFERREDif a retry configuration was provided to the given service configuration.- Parameters:
configuration- the configuration to base the newly created service on.- Returns:
- a task completed with a result representing the state of the service creation.
- Throws:
NullPointerException- if the given service configuration is null.
-