use of org.infinispan.remoting.transport.Address in project wildfly by wildfly.
the class DefaultCacheContainerTestCase method getAddress.
@Test
public void getAddress() {
Address expected = mock(Address.class);
when(this.manager.getAddress()).thenReturn(expected);
Address result = this.subject.getAddress();
assertSame(expected, result);
}
use of org.infinispan.remoting.transport.Address in project wildfly by wildfly.
the class InfinispanSessionManagerFactory method createSessionManager.
@Override
public <L> SessionManager<L, TransactionBatch> createSessionManager(final SessionManagerConfiguration<L> configuration) {
final Batcher<TransactionBatch> batcher = new InfinispanBatcher(this.config.getCache());
final Cache<Key<String>, ?> cache = this.config.getCache();
final CacheProperties properties = new InfinispanCacheProperties(cache.getCacheConfiguration());
final IdentifierFactory<String> factory = new AffinityIdentifierFactory<>(configuration.getIdentifierFactory(), cache, this.config.getKeyAffinityServiceFactory());
final CommandDispatcherFactory dispatcherFactory = this.config.getCommandDispatcherFactory();
final NodeFactory<Address> nodeFactory = this.config.getNodeFactory();
final int maxActiveSessions = this.config.getSessionManagerFactoryConfiguration().getMaxActiveSessions();
InfinispanSessionManagerConfiguration config = new InfinispanSessionManagerConfiguration() {
@Override
public SessionExpirationListener getExpirationListener() {
return configuration.getExpirationListener();
}
@Override
public ServletContext getServletContext() {
return configuration.getServletContext();
}
@Override
public Cache<Key<String>, ?> getCache() {
return cache;
}
@Override
public CacheProperties getProperties() {
return properties;
}
@Override
public IdentifierFactory<String> getIdentifierFactory() {
return factory;
}
@Override
public Batcher<TransactionBatch> getBatcher() {
return batcher;
}
@Override
public CommandDispatcherFactory getCommandDispatcherFactory() {
return dispatcherFactory;
}
@Override
public NodeFactory<Address> getNodeFactory() {
return nodeFactory;
}
@Override
public int getMaxActiveSessions() {
return maxActiveSessions;
}
@Override
public Recordable<ImmutableSession> getInactiveSessionRecorder() {
return configuration.getInactiveSessionRecorder();
}
};
return new InfinispanSessionManager<>(this.createSessionFactory(properties, configuration.getLocalContextFactory()), config);
}
use of org.infinispan.remoting.transport.Address in project wildfly by wildfly.
the class InfinispanRouteLocator method locate.
@Override
public String locate(String sessionId) {
Map.Entry<String, Void> entry = null;
Address location = this.locatePrimaryOwner(sessionId);
if (location != null) {
Node node = this.factory.createNode(location);
entry = this.registry.getEntry(node);
}
return (entry != null) ? entry.getKey() : null;
}
use of org.infinispan.remoting.transport.Address in project wildfly by wildfly.
the class CacheGroup method getNodes.
@Override
public List<Node> getNodes() {
List<Address> addresses = this.getAddresses();
List<Node> nodes = new ArrayList<>(addresses.size());
for (Address address : addresses) {
nodes.add(this.factory.createNode(address));
}
return nodes;
}
use of org.infinispan.remoting.transport.Address in project wildfly by wildfly.
the class InfinispanBeanManager method locatePrimaryOwner.
Node locatePrimaryOwner(I id) {
DistributionManager dist = this.cache.getAdvancedCache().getDistributionManager();
Address address = (dist != null) ? dist.getPrimaryLocation(id) : null;
return (address != null) ? this.nodeFactory.createNode(address) : this.registry.getGroup().getLocalNode();
}
Aggregations