Package com.illumon.iris.db.util
Class EtcdUtil
java.lang.Object
com.illumon.iris.db.util.EtcdUtil
public class EtcdUtil extends Object
-
Constructor Summary
Constructors Constructor Description EtcdUtil(com.fishlib.configuration.Configuration configuration)
-
Method Summary
Modifier and Type Method Description long
getRecreateWatchPauseMs()
Get the configured time to pause between attempts to recreate a watcher, in millisecondslong
getRecreateWatchTimeoutMs()
Get the configured timeout when recreating a failed watcher, in milliseconds<EXCEPTION_TYPE extends Exception, RETURN_TYPE>
RETURN_TYPEwaitFor(CompletableFuture<RETURN_TYPE> future, Class<EXCEPTION_TYPE> clazz)
Wait for the future for the configured timeout.long
watchTimeoutMs()
Get the configured timeout when waiting for an update via watcher, in milliseconds
-
Constructor Details
-
EtcdUtil
public EtcdUtil(com.fishlib.configuration.Configuration configuration)
-
-
Method Details
-
watchTimeoutMs
public long watchTimeoutMs()Get the configured timeout when waiting for an update via watcher, in milliseconds- Returns:
- watchTimeoutMs
-
getRecreateWatchTimeoutMs
public long getRecreateWatchTimeoutMs()Get the configured timeout when recreating a failed watcher, in milliseconds- Returns:
- recreateWatchTimeoutMs
-
getRecreateWatchPauseMs
public long getRecreateWatchPauseMs()Get the configured time to pause between attempts to recreate a watcher, in milliseconds- Returns:
- recreateWatchPauseMs
-
waitFor
public <EXCEPTION_TYPE extends Exception, RETURN_TYPE> RETURN_TYPE waitFor(CompletableFuture<RETURN_TYPE> future, Class<EXCEPTION_TYPE> clazz) throws EXCEPTION_TYPE extends ExceptionWait for the future for the configured timeout. Convert failures in the future to the given exception type.- Parameters:
future
- wait for this future- Returns:
- the result of the future
- Throws:
EXCEPTION_TYPE
- if the future does not completeRuntimeException
- if the correct exception type can't be constructedEXCEPTION_TYPE extends Exception
-