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

org.wildfly.clustering.singleton.server.LegacySingletonServiceBuilder Maven / Gradle / Ivy

/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.clustering.singleton.server;

import java.util.function.Supplier;

import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.wildfly.clustering.singleton.Singleton;
import org.wildfly.clustering.singleton.service.SingletonServiceBuilder;
import org.wildfly.clustering.singleton.service.SingletonServiceController;

/**
 * @author Paul Ferraro
 */
public class LegacySingletonServiceBuilder extends AbstractSingletonServiceBuilder {

    private final Supplier singleton;

    public LegacySingletonServiceBuilder(Supplier singleton, SingletonServiceBuilderContext context, ServiceBuilder builder) {
        super(builder, context);
        this.singleton = singleton;
    }

    @Override
    public SingletonServiceBuilder setInstance(Service service) {
        throw new IllegalStateException();
    }

    @Override
    public SingletonServiceController install() {
        return new DistributedSingletonServiceController<>(this.getDelegate().install(), this.singleton);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy