Class SDKReadinessGates

java.lang.Object
io.split.engine.SDKReadinessGates

public class SDKReadinessGates
extends Object
Created by adilaijaz on 4/27/16.
  • Constructor Details

  • Method Details

    • isSDKReady

      public boolean isSDKReady​(long milliseconds) throws InterruptedException
      Returns true if the SDK is ready. The SDK is ready when:
      1. It has fetched Split definitions the first time.
      2. It has downloaded segment memberships for segments in use in the initial split definitions

      This operation will block until the SDK is ready or 'milliseconds' have passed. If the milliseconds are less than or equal to zero, the operation will not block and return immediately

      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

      public boolean registerSegment​(String segmentName) throws InterruptedException
      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

      public void segmentIsReady​(String segmentName)
      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

      public boolean isSegmentRegistered​(String segmentName)
    • areSegmentsReady

      public boolean areSegmentsReady​(long milliseconds) throws InterruptedException
      Returns true if the SDK is ready w.r.t segments. In other words, this method returns true if:
      1. The SDK has fetched segment definitions the first time.

      This operation will block until the SDK is ready or 'milliseconds' have passed. If the milliseconds are less than or equal to zero, the operation will not block and return immediately

      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

      public boolean areSplitsReady​(long milliseconds) throws InterruptedException
      Returns true if the SDK is ready w.r.t splits. In other words, this method returns true if:
      1. The SDK has fetched Split definitions the first time.

      This operation will block until the SDK is ready or 'milliseconds' have passed. If the milliseconds are less than or equal to zero, the operation will not block and return immediately

      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.