Skip to content
Permalink
Browse files

[WFLY-11936] only log unbound msgs if binding service was up

  • Loading branch information
emmartins authored and bstansberry committed Mar 29, 2019
1 parent 0dc3b30 commit ae0c6026e06e64744e7b19cc891212a1bafdc9ff
@@ -261,6 +261,7 @@ private void startDataSource(final AbstractDataSourceService dataSourceService,
.addService(bindInfo.getBinderServiceName(), binderService)
.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, binderService.getManagedObjectInjector())
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addListener(new LifecycleListener() {
private volatile boolean bound;
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
@@ -269,13 +270,16 @@ public void handleEvent(final ServiceController<?> controller, final LifecycleEv
} else {
SUBSYSTEM_DATASOURCES_LOGGER.boundNonJTADataSource(jndiName);
}
bound = true;
break;
}
case DOWN: {
if (isTransactional()) {
SUBSYSTEM_DATASOURCES_LOGGER.unboundDataSource(jndiName);
} else {
SUBSYSTEM_DATASOURCES_LOGGER.unBoundNonJTADataSource(jndiName);
if (bound) {
if (isTransactional()) {
SUBSYSTEM_DATASOURCES_LOGGER.unboundDataSource(jndiName);
} else {
SUBSYSTEM_DATASOURCES_LOGGER.unBoundNonJTADataSource(jndiName);
}
}
break;
}
@@ -363,6 +363,7 @@ private void startDataSource(final AbstractDataSourceService dataSourceService,
.addService(bindInfo.getBinderServiceName(), binderService)
.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, binderService.getManagedObjectInjector())
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addListener(new LifecycleListener() {
private volatile boolean bound;
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
@@ -371,13 +372,16 @@ public void handleEvent(final ServiceController<?> controller, final LifecycleEv
} else {
SUBSYSTEM_DATASOURCES_LOGGER.boundNonJTADataSource(jndiName);
}
bound = true;
break;
}
case DOWN: {
if (isTransactional) {
SUBSYSTEM_DATASOURCES_LOGGER.unboundDataSource(jndiName);
} else {
SUBSYSTEM_DATASOURCES_LOGGER.unBoundNonJTADataSource(jndiName);
if (bound) {
if (isTransactional) {
SUBSYSTEM_DATASOURCES_LOGGER.unboundDataSource(jndiName);
} else {
SUBSYSTEM_DATASOURCES_LOGGER.unBoundNonJTADataSource(jndiName);
}
}
break;
}
@@ -100,14 +100,18 @@ public void getResourceValue(final ResolutionContext context, final ServiceBuild

serviceBuilder.addDependency(AdminObjectReferenceFactoryService.SERVICE_NAME_BASE.append(bindInfo.getBinderServiceName()), ManagedReferenceFactory.class, injector);
serviceBuilder.addListener(new LifecycleListener() {
private volatile boolean bound;
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
DEPLOYMENT_CONNECTOR_LOGGER.adminObjectAnnotation(jndiName);
bound = true;
break;
}
case DOWN: {
DEPLOYMENT_CONNECTOR_LOGGER.unboundJca("AdminObject", jndiName);
if (bound) {
DEPLOYMENT_CONNECTOR_LOGGER.unboundJca("AdminObject", jndiName);
}
break;
}
case REMOVED: {
@@ -442,14 +442,18 @@ protected AbstractWildFlyRaDeployer(ServiceTarget serviceTarget, URL url, String
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class,
binderService.getNamingStoreInjector())
.addListener(new LifecycleListener() {
private volatile boolean bound;
public void handleEvent(final ServiceController<? extends Object> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
DEPLOYMENT_CONNECTOR_LOGGER.boundJca("ConnectionFactory", jndi);
bound = true;
break;
}
case DOWN: {
DEPLOYMENT_CONNECTOR_LOGGER.unboundJca("ConnectionFactory", jndi);
if (bound) {
DEPLOYMENT_CONNECTOR_LOGGER.unboundJca("ConnectionFactory", jndi);
}
break;
}
case REMOVED: {
@@ -479,15 +483,19 @@ private void installJNDIAliases(final ContextNames.BindInfo bindInfo, final Serv
sb.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, aliasBinderService.getNamingStoreInjector());
sb.requires(bindInfo.getBinderServiceName());
sb.addListener(new LifecycleListener() {
private volatile boolean bound;
@Override
public void handleEvent(ServiceController<?> controller, LifecycleEvent event) {
switch (event) {
case UP: {
DEPLOYMENT_CONNECTOR_LOGGER.bindingAlias(bindInfo.getAbsoluteJndiName(), alias);
bound = true;
break;
}
case DOWN: {
DEPLOYMENT_CONNECTOR_LOGGER.unbindingAlias(bindInfo.getAbsoluteJndiName(), alias);
if (bound) {
DEPLOYMENT_CONNECTOR_LOGGER.unbindingAlias(bindInfo.getAbsoluteJndiName(), alias);
}
break;
}
case REMOVED: {
@@ -539,15 +547,18 @@ public void handleEvent(ServiceController<?> controller, LifecycleEvent event) {
binderService.getManagedObjectInjector())
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class,
binderService.getNamingStoreInjector()).addListener(new LifecycleListener() {

private volatile boolean bound;
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
DEPLOYMENT_CONNECTOR_LOGGER.boundJca("AdminObject", jndi);
bound = true;
break;
}
case DOWN: {
DEPLOYMENT_CONNECTOR_LOGGER.unboundJca("AdminObject", jndi);
if (bound) {
DEPLOYMENT_CONNECTOR_LOGGER.unboundJca("AdminObject", jndi);
}
break;
}
case REMOVED: {
@@ -418,6 +418,7 @@ static void secondRuntimeStep(OperationContext context, ModelNode operation, Man
.addService(bindInfo.getBinderServiceName(), binderService)
.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, binderService.getManagedObjectInjector())
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addListener(new LifecycleListener() {
private volatile boolean bound;
public void handleEvent(final ServiceController<? extends Object> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
@@ -426,13 +427,16 @@ public void handleEvent(final ServiceController<? extends Object> controller, fi
} else {
SUBSYSTEM_DATASOURCES_LOGGER.boundNonJTADataSource(jndiName);
}
bound = true;
break;
}
case DOWN: {
if (jta) {
SUBSYSTEM_DATASOURCES_LOGGER.unboundDataSource(jndiName);
} else {
SUBSYSTEM_DATASOURCES_LOGGER.unBoundNonJTADataSource(jndiName);
if (bound) {
if (jta) {
SUBSYSTEM_DATASOURCES_LOGGER.unboundDataSource(jndiName);
} else {
SUBSYSTEM_DATASOURCES_LOGGER.unBoundNonJTADataSource(jndiName);
}
}
break;
}
@@ -140,14 +140,19 @@ static void installRuntimeServices(OperationContext context, PathAddress address
final ServiceBuilder<?> binderBuilder = serviceTarget
.addService(bindInfo.getBinderServiceName(), binderService)
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addListener(new LifecycleListener() {
private volatile boolean bound;
@Override
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
MailLogger.ROOT_LOGGER.boundMailSession(jndiName);
bound = true;
break;
}
case DOWN: {
MailLogger.ROOT_LOGGER.unboundMailSession(jndiName);
if (bound) {
MailLogger.ROOT_LOGGER.unboundMailSession(jndiName);
}
break;
}
case REMOVED: {
@@ -92,15 +92,19 @@ private void startMailSession(final MailSessionService mailSessionService,
final ServiceBuilder<ManagedReferenceFactory> binderBuilder = serviceTarget
.addService(bindInfo.getBinderServiceName(), binderService)
.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addListener(new LifecycleListener() {
private volatile boolean bound;
@Override
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
MailLogger.ROOT_LOGGER.boundMailSession(jndiName);
bound = true;
break;
}
case DOWN: {
MailLogger.ROOT_LOGGER.unboundMailSession(jndiName);
if (bound) {
MailLogger.ROOT_LOGGER.unboundMailSession(jndiName);
}
break;
}
case REMOVED: {
@@ -106,15 +106,19 @@ public static void installAliasBinderService(final ServiceTarget serviceTarget,
sb.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, aliasBinderService.getNamingStoreInjector());
sb.requires(bindInfo.getBinderServiceName());
sb.addListener(new LifecycleListener() {
private volatile boolean bound;
@Override
public void handleEvent(ServiceController<?> controller, LifecycleEvent event) {
switch (event) {
case UP: {
ROOT_LOGGER.boundJndiName(alias);
bound = true;
break;
}
case DOWN: {
ROOT_LOGGER.unboundJndiName(alias);
if (bound) {
ROOT_LOGGER.unboundJndiName(alias);
}
break;
}
case REMOVED: {
@@ -298,14 +298,18 @@ private void startTopic(String topicName,
final ContextListAndJndiViewManagedReferenceFactory referenceFactoryService = new MessagingJMSDestinationManagedReferenceFactory(destinationService);
injector.inject(referenceFactoryService);
serviceBuilder.addListener(new LifecycleListener() {
private volatile boolean bound;
public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) {
switch (event) {
case UP: {
ROOT_LOGGER.boundJndiName(jndiName);
bound = true;
break;
}
case DOWN: {
ROOT_LOGGER.unboundJndiName(jndiName);
if (bound) {
ROOT_LOGGER.unboundJndiName(jndiName);
}
break;
}
case REMOVED: {

0 comments on commit ae0c602

Please sign in to comment.
You can’t perform that action at this time.