Package io.jenkins.plugins.ompass
Class OmpassClientFactory
java.lang.Object
io.jenkins.plugins.ompass.OmpassClientFactory
Thread-safe factory for obtaining a shared OmpassClient instance.
The client is lazily created and cached. When the global configuration changes
(detected by a hash of server URL, client ID, and secret key),
the existing client is closed and a new one is created.
This prevents creating a new HTTP client on every request while ensuring
configuration changes take effect without a restart.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.ompasscloud.sdk.OmpassClientReturns a shared OmpassClient instance configured with the current OmpassGlobalConfig.static voidreset()Clears the cached client instance.
-
Method Details
-
getInstance
public static com.ompasscloud.sdk.OmpassClient getInstance()Returns a shared OmpassClient instance configured with the current OmpassGlobalConfig. Creates a new client if the configuration has changed since the last call.- Returns:
- a configured OmpassClient instance
- Throws:
IllegalStateException- if the global configuration is missing or incomplete
-
reset
public static void reset()Clears the cached client instance. The next call to getInstance() will create a new client. Useful for testing and configuration resets.
-