All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.launchdarkly.sdk.server.DataSourceStatusProviderImpl Maven / Gradle / Ivy

There is a newer version: 7.5.0
Show newest version
package com.launchdarkly.sdk.server;

import com.launchdarkly.sdk.server.interfaces.DataSourceStatusProvider;

import java.time.Duration;

final class DataSourceStatusProviderImpl implements DataSourceStatusProvider {
  private final EventBroadcasterImpl dataSourceStatusNotifier;
  private final DataSourceUpdatesImpl dataSourceUpdates;

  DataSourceStatusProviderImpl(
      EventBroadcasterImpl dataSourceStatusNotifier,
      DataSourceUpdatesImpl dataSourceUpdates
      ) {
    this.dataSourceStatusNotifier = dataSourceStatusNotifier;
    this.dataSourceUpdates = dataSourceUpdates;
  }

  @Override
  public Status getStatus() {
    return dataSourceUpdates.getLastStatus();
  }

  @Override
  public boolean waitFor(State desiredState, Duration timeout) throws InterruptedException {
    return dataSourceUpdates.waitFor(desiredState, timeout);
  }
  
  @Override
  public void addStatusListener(StatusListener listener) {
    dataSourceStatusNotifier.register(listener);
  }

  @Override
  public void removeStatusListener(StatusListener listener) {
    dataSourceStatusNotifier.unregister(listener);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy