use of org.wildfly.clustering.Registration in project wildfly by wildfly.
the class RemoteCacheContainerResource method register.
@Override
public Registration register(String cache) {
ChildResourceProvider handler = this.apply(CHILD_TYPE);
handler.getChildren().add(cache);
return new Registration() {
@Override
public void close() {
handler.getChildren().remove(cache);
}
};
}
use of org.wildfly.clustering.Registration in project wildfly by wildfly.
the class CacheContainerResource method register.
@Override
public Registration register(String cache) {
ChildResourceProvider provider = this.apply(CHILD_TYPE);
provider.getChildren().add(cache);
return new Registration() {
@Override
public void close() {
provider.getChildren().remove(cache);
}
};
}
use of org.wildfly.clustering.Registration in project wildfly by wildfly.
the class ConcurrentBroadcastCommandDispatcherFactoryTestCase method registration.
@Test
public void registration() {
BroadcastReceiver receiver1 = mock(BroadcastReceiver.class);
BroadcastReceiver receiver2 = mock(BroadcastReceiver.class);
BroadcastReceiverRegistrar registrar = new ConcurrentBroadcastCommandDispatcherFactory(this.factory);
byte[] data1 = new byte[] { 1 };
byte[] data2 = new byte[] { 2 };
byte[] data3 = new byte[] { 3 };
try (Registration registration1 = registrar.register(receiver1)) {
try (Registration registration2 = registrar.register(receiver2)) {
registrar.receive(data1);
verify(receiver1).receive(data1);
verify(receiver2).receive(data1);
}
registrar.receive(data2);
verify(receiver1).receive(data2);
verifyNoMoreInteractions(receiver2);
}
registrar.receive(data3);
verifyNoMoreInteractions(receiver1);
verifyNoMoreInteractions(receiver2);
}
use of org.wildfly.clustering.Registration in project wildfly by wildfly.
the class CacheContainerServiceConfigurator method cacheStopped.
@CacheStopped
public CompletionStage<Void> cacheStopped(CacheStoppedEvent event) {
String cacheName = event.getCacheName();
ServiceValueCaptor<Cache<?, ?>> captor = this.registry.remove(this.createCacheServiceName(cacheName));
if (captor != null) {
captor.accept(null);
}
try (Registration registration = this.registrations.remove(cacheName)) {
InfinispanLogger.ROOT_LOGGER.cacheStopped(cacheName, this.name);
}
return CompletableFutures.completedNull();
}
use of org.wildfly.clustering.Registration in project wildfly by wildfly.
the class SingletonPolicyResource method register.
@Override
public Registration register(ServiceName service) {
boolean deployment = Services.JBOSS_DEPLOYMENT.isParentOf(service);
ChildResourceProvider provider = this.apply(deployment ? DEPLOYMENT_CHILD_TYPE : SERVICE_CHILD_TYPE);
String name = (deployment ? SingletonDeploymentResourceDefinition.pathElement(service) : SingletonServiceResourceDefinition.pathElement(service)).getValue();
provider.getChildren().add(name);
return new Registration() {
@Override
public void close() {
provider.getChildren().remove(name);
}
};
}
Aggregations