use of org.apache.qpid.server.model.VirtualHostNode in project qpid-broker-j by apache.
the class ProvidedStoreVirtualHostImpl method onValidate.
@Override
public void onValidate() {
super.onValidate();
VirtualHostNode<?> virtualHostNode = (VirtualHostNode) getParent();
DurableConfigurationStore configurationStore = virtualHostNode.getConfigurationStore();
if (!(configurationStore instanceof MessageStoreProvider)) {
throw new IllegalConfigurationException(VIRTUAL_HOST_TYPE + " virtual host can only be used where the node's store (" + configurationStore.getClass().getName() + ") is a message store provider. ");
}
}
use of org.apache.qpid.server.model.VirtualHostNode in project qpid-broker-j by apache.
the class AbstractVirtualHost method onOpen.
@Override
protected void onOpen() {
super.onOpen();
registerSystemNodes();
_messageStore = createMessageStore();
_messageStoreLogSubject = new MessageStoreLogSubject(getName(), _messageStore.getClass().getSimpleName());
_messageStore.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL);
_messageStore.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
_fileSystemMaxUsagePercent = getContextValue(Integer.class, Broker.STORE_FILESYSTEM_MAX_USAGE_PERCENT);
_flowToDiskCheckPeriod = getContextValue(Long.class, FLOW_TO_DISK_CHECK_PERIOD);
_isDiscardGlobalSharedSubscriptionLinksOnDetach = getContextValue(Boolean.class, DISCARD_GLOBAL_SHARED_SUBSCRIPTION_LINKS_ON_DETACH);
QpidServiceLoader serviceLoader = new QpidServiceLoader();
for (ConnectionValidator validator : serviceLoader.instancesOf(ConnectionValidator.class)) {
if ((_enabledConnectionValidators.isEmpty() && (_disabledConnectionValidators.isEmpty()) || !_disabledConnectionValidators.contains(validator.getType())) || _enabledConnectionValidators.contains(validator.getType())) {
_connectionValidators.add(validator);
}
}
PreferencesRoot preferencesRoot = (VirtualHostNode) getParent();
_preferenceStore = preferencesRoot.createPreferenceStore();
_linkRegistry = createLinkRegistry();
createHousekeepingExecutor();
openConnectionLimiter();
}
use of org.apache.qpid.server.model.VirtualHostNode 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();
}
}
}
}
use of org.apache.qpid.server.model.VirtualHostNode in project qpid-broker-j by apache.
the class AbstractVirtualHost method doRestart.
private ListenableFuture<Void> doRestart() {
createHousekeepingExecutor();
final VirtualHostStoreUpgraderAndRecoverer virtualHostStoreUpgraderAndRecoverer = new VirtualHostStoreUpgraderAndRecoverer((VirtualHostNode<?>) getParent());
virtualHostStoreUpgraderAndRecoverer.reloadAndRecoverVirtualHost(getDurableConfigurationStore());
final Collection<VirtualHostAccessControlProvider> accessControlProviders = getChildren(VirtualHostAccessControlProvider.class);
if (!accessControlProviders.isEmpty()) {
accessControlProviders.forEach(child -> child.addChangeListener(_accessControlProviderListener));
}
final List<ListenableFuture<Void>> childOpenFutures = new ArrayList<>();
Subject.doAs(getSubjectWithAddedSystemRights(), (PrivilegedAction<Object>) () -> {
applyToChildren(child -> {
final ListenableFuture<Void> childOpenFuture = child.openAsync();
childOpenFutures.add(childOpenFuture);
addFutureCallback(childOpenFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
}
@Override
public void onFailure(final Throwable t) {
LOGGER.error("Exception occurred while opening {} : {}", child.getClass().getSimpleName(), child.getName(), t);
onRestartFailure();
}
}, getTaskExecutor());
});
return null;
});
ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(childOpenFutures);
return Futures.transformAsync(combinedFuture, input -> onActivate(), MoreExecutors.directExecutor());
}
use of org.apache.qpid.server.model.VirtualHostNode in project qpid-broker-j by apache.
the class DefaultVirtualHostAliasImpl method getAddressSpace.
@Override
public NamedAddressSpace getAddressSpace(final String name) {
if (name == null || name.trim().equals("")) {
Broker<?> broker = getAncestor(Broker.class);
VirtualHostNode defaultVirtualHostNode = broker.findDefautVirtualHostNode();
return defaultVirtualHostNode == null ? null : defaultVirtualHostNode.getVirtualHost();
}
return null;
}
Aggregations