org.wildfly.clustering.session.cache.affinity.UnarySessionAffinity Maven / Gradle / Ivy
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.session.cache.affinity;
import java.util.function.Function;
import java.util.function.UnaryOperator;
import org.wildfly.clustering.server.GroupMember;
/**
* Session affinity to a multiple members.
* @param the group member type
* @author Paul Ferraro
*/
public class UnarySessionAffinity implements UnaryOperator {
private Function affinity;
private Function mapper;
public UnarySessionAffinity(Function affinity, Function mapper) {
this.affinity = affinity;
this.mapper = mapper;
}
@Override
public String apply(String id) {
return this.affinity.andThen(this.mapper).apply(id);
}
}