![JAR search and dependency download from the Maven repository](/logo.png)
org.wildfly.clustering.ejb.cache.bean.DefaultImmutableBeanGroup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-clustering-ejb-cache Show documentation
Show all versions of wildfly-clustering-ejb-cache Show documentation
Contains code common to the wildfly-clustering-ejb-hotrod and wildfly-clustering-ejb-infinispan modules.
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.ejb.cache.bean;
import java.util.Map;
import org.wildfly.clustering.ejb.bean.BeanInstance;
/**
* A default {@link ImmutableBeanGroup} implementation based on a map of bean instances.
* @author Paul Ferraro
* @param the bean identifier type
* @param the bean instance type
*/
public class DefaultImmutableBeanGroup> implements ImmutableBeanGroup {
private final K id;
private final Map instances;
private final Runnable closeTask;
public DefaultImmutableBeanGroup(K id, Map instances, Runnable closeTask) {
this.id = id;
this.instances = instances;
this.closeTask = closeTask;
}
@Override
public K getId() {
return this.id;
}
@Override
public boolean isEmpty() {
return this.instances.isEmpty();
}
@Override
public V getBeanInstance(K id) {
return this.instances.get(id);
}
@Override
public void close() {
this.closeTask.run();
}
@Override
public String toString() {
return String.format("%s { %s -> %s }", this.getClass().getSimpleName(), this.id, this.instances.keySet());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy