Search in sources :

Example 1 with DefaultMultipleComponentLeaderElectionService

use of org.apache.flink.runtime.leaderelection.DefaultMultipleComponentLeaderElectionService in project flink by apache.

the class KubernetesMultipleComponentLeaderElectionHaServices method getOrInitializeSingleLeaderElectionService.

private DefaultMultipleComponentLeaderElectionService getOrInitializeSingleLeaderElectionService() {
    synchronized (lock) {
        if (multipleComponentLeaderElectionService == null) {
            try {
                final KubernetesLeaderElectionConfiguration leaderElectionConfiguration = new KubernetesLeaderElectionConfiguration(getClusterConfigMap(), lockIdentity, configuration);
                multipleComponentLeaderElectionService = new DefaultMultipleComponentLeaderElectionService(fatalErrorHandler, new KubernetesMultipleComponentLeaderElectionDriverFactory(kubeClient, leaderElectionConfiguration, configMapSharedWatcher, watchExecutorService, fatalErrorHandler));
            } catch (Exception e) {
                throw new FlinkRuntimeException("Could not initialize the default single leader election service.", e);
            }
        }
        return multipleComponentLeaderElectionService;
    }
}
Also used : FlinkRuntimeException(org.apache.flink.util.FlinkRuntimeException) KubernetesLeaderElectionConfiguration(org.apache.flink.kubernetes.configuration.KubernetesLeaderElectionConfiguration) DefaultMultipleComponentLeaderElectionService(org.apache.flink.runtime.leaderelection.DefaultMultipleComponentLeaderElectionService) FlinkRuntimeException(org.apache.flink.util.FlinkRuntimeException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 KubernetesLeaderElectionConfiguration (org.apache.flink.kubernetes.configuration.KubernetesLeaderElectionConfiguration)1 DefaultMultipleComponentLeaderElectionService (org.apache.flink.runtime.leaderelection.DefaultMultipleComponentLeaderElectionService)1 FlinkRuntimeException (org.apache.flink.util.FlinkRuntimeException)1