Package io.split.engine
Class SDKReadinessGates
java.lang.Object
io.split.engine.SDKReadinessGates
public class SDKReadinessGates extends Object
Created by adilaijaz on 4/27/16.
-
Constructor Summary
Constructors Constructor Description SDKReadinessGates() -
Method Summary
Modifier and Type Method Description booleanareSegmentsReady(long milliseconds)Returns true if the SDK is ready w.r.t segments.booleanareSplitsReady(long milliseconds)Returns true if the SDK is ready w.r.t splits.booleanisSDKReady(long milliseconds)Returns true if the SDK is ready.booleanisSDKReadyNow()booleanisSegmentRegistered(String segmentName)booleanregisterSegment(String segmentName)Registers a segment that the SDK should download before it is ready.voidsegmentIsReady(String segmentName)Records that the SDK segment initialization for this segment is done.voidsplitsAreReady()Records that the SDK split initialization is done.
-
Constructor Details
-
SDKReadinessGates
public SDKReadinessGates()
-
-
Method Details
-
isSDKReady
Returns true if the SDK is ready. The SDK is ready when:- It has fetched Split definitions the first time.
- It has downloaded segment memberships for segments in use in the initial split definitions
- Parameters:
milliseconds- time to wait for an answer. if the value is zero or negative, we will not block for an answer.- Returns:
- true if the sdk is ready, false otherwise.
- Throws:
InterruptedException- if this operation was interrupted.
-
isSDKReadyNow
public boolean isSDKReadyNow() -
splitsAreReady
public void splitsAreReady()Records that the SDK split initialization is done. This operation is atomic and idempotent. Repeated invocations will not have any impact on the state. -
registerSegment
Registers a segment that the SDK should download before it is ready. This method should be called right after the first successful download of split definitions. Note that if this method is called in subsequent fetches of splits, it will return false; meaning any segments used in new splits will not be able to block the SDK from being marked as complete.- Parameters:
segmentName- the segment to register- Returns:
- true if the segments were registered, false otherwise.
- Throws:
InterruptedException
-
segmentIsReady
Records that the SDK segment initialization for this segment is done. This operation is atomic and idempotent. Repeated invocations will not have any impact on the state. -
isSegmentRegistered
-
areSegmentsReady
Returns true if the SDK is ready w.r.t segments. In other words, this method returns true if:- The SDK has fetched segment definitions the first time.
- Parameters:
milliseconds- time to wait for an answer. if the value is zero or negative, we will not block for an answer.- Returns:
- true if the sdk is ready w.r.t splits, false otherwise.
- Throws:
InterruptedException- if this operation was interrupted.
-
areSplitsReady
Returns true if the SDK is ready w.r.t splits. In other words, this method returns true if:- The SDK has fetched Split definitions the first time.
- Parameters:
milliseconds- time to wait for an answer. if the value is zero or negative, we will not block for an answer.- Returns:
- true if the sdk is ready w.r.t splits, false otherwise.
- Throws:
InterruptedException- if this operation was interrupted.
-