use of org.apache.qpid.server.model.AbstractConfiguredObject in project qpid-broker-j by apache.
the class VirtualHostLoggerTest method testLoggersRemovedOnVirtualHostStop.
@Test
public void testLoggersRemovedOnVirtualHostStop() {
VirtualHostLogger logger = createVirtualHostLogger();
((AbstractConfiguredObject<?>) _virtualHost).stop();
Appender<ILoggingEvent> appender = ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).getAppender(logger.getName());
assertNull("Appender was not deleted", appender);
}
use of org.apache.qpid.server.model.AbstractConfiguredObject in project qpid-broker-j by apache.
the class VirtualHostStoreUpgraderAndRecoverer method recover.
private void recover(final ConfiguredObject<?> recoveryRoot, final DurableConfigurationStore durableConfigurationStore, final List<ConfiguredObjectRecord> records, final boolean isNew) {
new GenericRecoverer(recoveryRoot).recover(records, isNew);
final StoreConfigurationChangeListener configChangeListener = new StoreConfigurationChangeListener(durableConfigurationStore);
if (_virtualHostNode.getVirtualHost() != null) {
applyRecursively(_virtualHostNode.getVirtualHost(), new RecursiveAction<ConfiguredObject<?>>() {
@Override
public boolean applyToChildren(final ConfiguredObject<?> object) {
return object.isDurable();
}
@Override
public void performAction(final ConfiguredObject<?> object) {
object.addChangeListener(configChangeListener);
}
});
}
if (recoveryRoot instanceof VirtualHostNode) {
_virtualHostNode.addChangeListener(new AbstractConfigurationChangeListener() {
@Override
public void childAdded(final ConfiguredObject<?> object, final ConfiguredObject<?> child) {
if (child instanceof VirtualHost) {
applyRecursively(child, new RecursiveAction<ConfiguredObject<?>>() {
@Override
public boolean applyToChildren(final ConfiguredObject<?> object) {
return object.isDurable();
}
@Override
public void performAction(final ConfiguredObject<?> object) {
if (object.isDurable()) {
durableConfigurationStore.update(true, object.asObjectRecord());
object.addChangeListener(configChangeListener);
}
}
});
}
}
@Override
public void childRemoved(final ConfiguredObject<?> object, final ConfiguredObject<?> child) {
if (child instanceof VirtualHost) {
child.removeChangeListener(configChangeListener);
}
}
});
if (isNew) {
if (_virtualHostNode instanceof AbstractConfiguredObject) {
((AbstractConfiguredObject) _virtualHostNode).forceUpdateAllSecureAttributes();
}
}
}
}
Aggregations