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

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

/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package org.wildfly.clustering.singleton.server;

import java.util.Optional;

import org.wildfly.clustering.dispatcher.Command;

/**
 * Command to support {@link org.wildfly.clustering.singleton.SingletonService#getValue()} invocations for legacy MSC singleton services.
 * @author Paul Ferraro
 * @param  the service value type
 */
@Deprecated
public enum SingletonValueCommand implements Command, LegacySingletonContext> {
    INSTANCE;

    @SuppressWarnings("unchecked")
    static  Command, LegacySingletonContext> getInstance() {
        return (Command, LegacySingletonContext>) (Command) INSTANCE;
    }

    @Override
    public Optional execute(LegacySingletonContext context) {
        return context.getLocalValue();
    }
}