You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2017/07/27 13:42:21 UTC
[1/2] qpid-broker-j git commit: QPID-7781: QPID-7442: [Java Broker]
Enhance UI to allow a VH to be added to a VHN that has none.
Repository: qpid-broker-j
Updated Branches:
refs/heads/master ebec2d335 -> 3e1ddbccb
QPID-7781: QPID-7442: [Java Broker] Enhance UI to allow a VH to be added to a VHN that has none.
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/3e1ddbcc
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/3e1ddbcc
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/3e1ddbcc
Branch: refs/heads/master
Commit: 3e1ddbccb44ee5b9923029234677facf8419e77c
Parents: e697c9e
Author: Keith Wall <kw...@apache.org>
Authored: Thu Jul 27 13:42:21 2017 +0100
Committer: Keith Wall <kw...@apache.org>
Committed: Thu Jul 27 13:44:48 2017 +0100
----------------------------------------------------------------------
.../src/main/java/resources/addVirtualHost.html | 60 ++++++
.../js/qpid/common/ContextVariablesEditor.js | 10 +-
.../java/resources/js/qpid/management/Broker.js | 50 ++++-
.../js/qpid/management/addVirtualHost.js | 185 +++++++++++++++++++
.../src/main/java/resources/showBroker.html | 1 +
5 files changed, 292 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/3e1ddbcc/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html b/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
new file mode 100644
index 0000000..fba2dc0
--- /dev/null
+++ b/broker-plugins/management-http/src/main/java/resources/addVirtualHost.html
@@ -0,0 +1,60 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ ~
+ -->
+<div class="dijitHidden">
+ <div data-dojo-attach-point="addVirtualHost" data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add'" id="${id}_addVirtualHost">
+ <div id="${id}_addVirtualHost.contentPane">
+
+ <form id="${id}_addVirtualHost.form" data-dojo-attach-point="virtualHostForm" method="post" data-dojo-type="dijit/form/Form">
+ <div class="formBox">
+ <fieldset>
+ <legend>Virtual Host</legend>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div>
+ <div class="tableContainer-valueCell formLabel-controlCell">
+ <select data-dojo-attach-point="virtualHostType" id="${id}_addVirtualHost.type" data-dojo-type="dijit/form/FilteringSelect"
+ data-dojo-props="
+ name: 'type',
+ required: true,
+ disabled: true,
+ placeHolder: 'select virtual host type',
+ promptMessage: 'Type of virtual host',
+ title: 'Select virtual host type',
+ searchAttr: 'name'">
+ </select>
+ </div>
+ </div>
+ <div class="clear"></div>
+
+ <div data-dojo-attach-point="typeFields" id="${id}_addVirtualHost.typeFields"></div>
+ <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false">
+ <div id="${id}_addVirtualHost.context" data-dojo-attach-point="virtualHostContext"
+ data-dojo-type="qpid.common.ContextVariablesEditor"
+ data-dojo-props="name: 'context', title: 'Context variables'"></div>
+ </div>
+ </fieldset>
+ </div>
+ </form>
+ </div>
+ <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar">
+ <button data-dojo-attach-point="addButton" data-dojo-type="dijit/form/Button" id="${id}_addVirtualHost.addButton" data-dojo-props="label: 'Add'" type="submit"></button>
+ <button data-dojo-attach-point="cancelButton" data-dojo-type="dijit/form/Button" id="${id}_addVirtualHost.cancelButton" data-dojo-props="label: 'Cancel'" ></button>
+ </div>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/3e1ddbcc/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
index 215dd10..e3aa602 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js
@@ -297,24 +297,24 @@ define(["qpid/common/util",
},
destroy: function ()
{
- if (this.domNode)
+ if (this.domNode && this.domNode.destroy)
{
- this.domNode.destroy();
+ this.domNode.destroy(); // TODO probably dead code
this.domNode = null;
}
if (this._grid != null)
{
- this._grid.destroyRecursively();
+ this._grid.destroyRecursive();
this._grid = null;
}
if (this._addButton != null)
{
- this._addButton.destroyRecursively();
+ this._addButton.destroyRecursive();
this._addButton = null;
}
if (this._deleteButton != null)
{
- this._deleteButton.destroyRecursively();
+ this._deleteButton.destroyRecursive();
this._deleteButton = null;
}
},
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/3e1ddbcc/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
index 96d1157..cda12be 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
@@ -21,6 +21,7 @@
define(["dojo/parser",
"dojo/query",
"dojo/json",
+ "dojo/_base/lang",
"dojo/_base/connect",
"dojo/store/Memory",
"dojo/promise/all",
@@ -33,6 +34,7 @@ define(["dojo/parser",
"dojox/html/entities",
"qpid/management/addAuthenticationProvider",
"qpid/management/addVirtualHostNodeAndVirtualHost",
+ "qpid/management/addVirtualHost",
"qpid/management/addPort",
"qpid/management/addStore",
"qpid/management/addGroupProvider",
@@ -56,6 +58,7 @@ define(["dojo/parser",
function (parser,
query,
json,
+ lang,
connect,
memory,
all,
@@ -68,6 +71,7 @@ define(["dojo/parser",
entities,
addAuthenticationProvider,
addVirtualHostNodeAndVirtualHost,
+ AddVirtualHostDialog,
addPort,
addStore,
addGroupProvider,
@@ -410,9 +414,10 @@ define(["dojo/parser",
this.virtualHostMenuButton = registry.byNode(query(".virtualHostMenuButton", node)[0]);
var hostMenuItems = this.virtualHostMenuButton.dropDown.getChildren();
- var viewVirtualHostItem = hostMenuItems[0];
- var startVirtualHostItem = hostMenuItems[1];
- var stopVirtualHostItem = hostMenuItems[2];
+ var addVirtualHostItem = hostMenuItems[0];
+ var viewVirtualHostItem = hostMenuItems[1];
+ var startVirtualHostItem = hostMenuItems[2];
+ var stopVirtualHostItem = hostMenuItems[3];
var nodeMenuItems = this.virtualHostNodeMenuButton.dropDown.getChildren();
var viewNodeItem = nodeMenuItems[0];
@@ -423,10 +428,35 @@ define(["dojo/parser",
var toggler = function (index)
{
that.toggleVirtualHostNodeNodeMenus(index);
- }
+ };
connect.connect(this.vhostsGrid.grid.selection, 'onSelected', toggler);
connect.connect(this.vhostsGrid.grid.selection, 'onDeselected', toggler);
+ addVirtualHostItem.on("click", function ()
+ {
+ var data = that.vhostsGrid.grid.selection.getSelected();
+ if (data.length === 1)
+ {
+ var item = data[0];
+ var nodeModelObject = that.controller.structure.findById(item.id);
+ var dialog = new AddVirtualHostDialog({
+ management: that.controller.management,
+ virtualhostNodeType: item.type,
+ virtualhostNodeModelObject: nodeModelObject
+ });
+ dialog.show();
+ dialog.on("done", function (update)
+ {
+ dialog.hideAndDestroy();
+ that.vhostsGrid.grid.selection.clear();
+ if (update)
+ {
+ that.update();
+ }
+ });
+ }
+ });
+
viewVirtualHostItem.on("click", function ()
{
var data = that.vhostsGrid.grid.selection.getSelected();
@@ -937,7 +967,7 @@ define(["dojo/parser",
var data = this.vhostsGrid.grid.selection.getSelected();
var selected = data && data[0];
this.virtualHostNodeMenuButton.set("disabled", !selected);
- this.virtualHostMenuButton.set("disabled", !selected || !data[0].vhId);
+ this.virtualHostMenuButton.set("disabled", !selected);
if (selected)
{
var nodeMenuItems = this.virtualHostNodeMenuButton.dropDown.getChildren();
@@ -946,9 +976,10 @@ define(["dojo/parser",
var startNodeItem = nodeMenuItems[2];
var stopNodeItem = nodeMenuItems[3];
- var viewVirtualHostItem = hostMenuItems[0];
- var startVirtualHostItem = hostMenuItems[1];
- var stopVirtualHostItem = hostMenuItems[2];
+ var addVirtualHostItem = hostMenuItems[0];
+ var viewVirtualHostItem = hostMenuItems[1];
+ var startVirtualHostItem = hostMenuItems[2];
+ var stopVirtualHostItem = hostMenuItems[3];
var item = data[0];
startNodeItem.set("disabled", item.state != "STOPPED");
@@ -956,13 +987,14 @@ define(["dojo/parser",
if (item.vhId)
{
+ addVirtualHostItem.set("disabled", true);
viewVirtualHostItem.set("disabled", false);
-
startVirtualHostItem.set("disabled", item.vhState != "STOPPED");
stopVirtualHostItem.set("disabled", item.vhState != "ACTIVE");
}
else
{
+ addVirtualHostItem.set("disabled", false);
viewVirtualHostItem.set("disabled", true);
startVirtualHostItem.set("disabled", true);
stopVirtualHostItem.set("disabled", true);
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/3e1ddbcc/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
new file mode 100644
index 0000000..5a0be0e
--- /dev/null
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHost.js
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/_base/declare",
+ "dojo/Evented",
+ "dojo/_base/lang",
+ "dojo/_base/array",
+ "dojo/dom-construct",
+ "dijit/registry",
+ "dijit/Dialog",
+ "dijit/form/Button",
+ "dijit/form/FilteringSelect",
+ "qpid/common/util",
+ "dojo/text!addVirtualHost.html",
+ "dijit/_WidgetBase",
+ "dijit/_TemplatedMixin",
+ "dijit/_WidgetsInTemplateMixin",
+ "qpid/common/ContextVariablesEditor",
+ "dijit/TitlePane",
+ "dijit/layout/ContentPane",
+ "dijit/form/Form",
+ "dijit/form/CheckBox",
+ "dijit/form/RadioButton",
+ "dojox/validate/us",
+ "dojox/validate/web",
+ "dojo/domReady!"],
+ function (declare,
+ Evented,
+ lang,
+ array,
+ domConstruct,
+ registry,
+ Dialog,
+ Button,
+ FilteringSelect,
+ util,
+ template)
+ {
+
+ return declare("qpid.management.addVirtualHostDialog",
+ [dijit._WidgetBase, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin, Evented],
+ {
+ //Strip out the apache comment header from the template html as comments unsupported.
+ templateString: template.replace(/<!--[\s\S]*?-->/g, ""),
+
+ // template fields
+ addVirtualHost: null,
+ addButton: null,
+ cancelButton: null,
+ virtualHostType: null,
+ typeFields: null,
+ context: null,
+
+ // constructor parameters
+ management: null,
+ virtualhostNodeModelObject: null,
+ virtualhostNodeType : null,
+
+ postCreate: function ()
+ {
+ this.inherited(arguments);
+
+ this.addButton.on("click", lang.hitch(this, this._onFormSubmit));
+ this.cancelButton.on("click", lang.hitch(this, this._onCancel));
+ this.virtualHostType.on("change", lang.hitch(this, this._onVhTypeChanged));
+
+ var validChildTypes = this.management ? this.management.metadata.validChildTypes("VirtualHostNode",
+ this.virtualhostNodeType,
+ "VirtualHost") : [];
+ validChildTypes.sort();
+
+ var virtualHostTypeStore = util.makeTypeStore(validChildTypes);
+
+ this.virtualHostType.set("store", virtualHostTypeStore);
+ this.virtualHostType.set("disabled", validChildTypes.length <= 1);
+ if (validChildTypes.length === 1)
+ {
+ this.virtualHostType.set("value", validChildTypes[0]);
+ }
+ else
+ {
+ this.virtualHostType.reset();
+ }
+ },
+ show: function ()
+ {
+ util.loadEffectiveAndInheritedActualData(this.management, this.virtualhostNodeModelObject, lang.hitch(this, function(data)
+ {
+ this.virtualHostContext.setData({},
+ data.effective.context,
+ data.inheritedActual.context);
+ this.addVirtualHost.show();
+ }));
+ },
+ hideAndDestroy: function ()
+ {
+ //this.addVirtualHost.hide(); // Seems to upset destroy??
+ this.destroy();
+ },
+ destroy: function ()
+ {
+ this.addVirtualHost.destroyRecursive(false);
+ domConstruct.destroy(this.typeFields);
+ this.inherited(arguments);
+ },
+ _onCancel: function (data)
+ {
+ this.emit("done", false);
+ },
+ _onFormSubmit: function (e)
+ {
+ if (this.virtualHostForm.validate())
+ {
+ var virtualHostData = util.getFormWidgetValues(this.virtualHostForm);
+ var virtualHostContext = this.virtualHostContext.get("value");
+ if (virtualHostContext)
+ {
+ virtualHostData["context"] = virtualHostContext;
+ }
+
+ //Default the VH name to be the same as the VHN name.
+ virtualHostData["name"] = this.virtualhostNodeModelObject.name;
+
+ this.management.create("virtualhost", this.virtualhostNodeModelObject, virtualHostData)
+ .then(lang.hitch(this, function (x)
+ {
+ this.emit("done", true);
+ }));
+ }
+ else
+ {
+ alert('Form contains invalid data. Please correct first');
+ }
+ return false;
+
+ },
+ _onVhTypeChanged: function (type)
+ {
+ var widgets = registry.findWidgets(this.typeFields);
+ array.forEach(widgets, function (item)
+ {
+ item.destroyRecursive();
+ });
+ domConstruct.empty(this.typeFields);
+ this.virtualHostContext.removeDynamicallyAddedInheritedContext();
+ if (type)
+ {
+ require(["qpid/management/virtualhost/" + type.toLowerCase() + "/add"], lang.hitch(this, function (typeUI)
+ {
+ try
+ {
+ var metadata = this.management.metadata;
+ typeUI.show({
+ containerNode: this.typeFields,
+ parent: this,
+ metadata: metadata
+ });
+ util.applyMetadataToWidgets(this.typeFields, "VirtualHost", type, metadata);
+ }
+ catch (e)
+ {
+ console.warn(e);
+ }
+ }));
+ }
+ }
+
+ });
+ });
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/3e1ddbcc/broker-plugins/management-http/src/main/java/resources/showBroker.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/showBroker.html b/broker-plugins/management-http/src/main/java/resources/showBroker.html
index 0d13b12..cb32cb0 100644
--- a/broker-plugins/management-http/src/main/java/resources/showBroker.html
+++ b/broker-plugins/management-http/src/main/java/resources/showBroker.html
@@ -74,6 +74,7 @@
<div data-dojo-type="dijit.form.DropDownButton" class="virtualHostMenuButton" data-dojo-props="iconClass: 'dijitIconPackage',disabled:true">
<span>Virtual Host</span>
<div data-dojo-type="dijit.Menu" class="virtualHostMenu">
+ <div data-dojo-type="dijit.MenuItem">Add</div>
<div data-dojo-type="dijit.MenuItem" class="viewVirtualHost" >View</div>
<div data-dojo-type="dijit.MenuItem" data-dojo-props="disabled:true">Start</div>
<div data-dojo-type="dijit.MenuItem" data-dojo-props="disabled:true">Stop</div>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-broker-j git commit: QPID-7781: QPID-7442: [Java Broker]
On deletion ensure that the store remains open until the link registry is
deleted. On virtualhost delete ensure that the virtualhost and durable
children are removed from the configurati
Posted by kw...@apache.org.
QPID-7781: QPID-7442: [Java Broker] On deletion ensure that the store remains open until the link registry is deleted.
On virtualhost delete ensure that the virtualhost and durable children are removed from the configuration store.
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/e697c9ed
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/e697c9ed
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/e697c9ed
Branch: refs/heads/master
Commit: e697c9eded66686f906feadd969566a248a5d16a
Parents: ebec2d3
Author: Keith Wall <kw...@apache.org>
Authored: Wed Jul 26 16:45:53 2017 +0100
Committer: Keith Wall <kw...@apache.org>
Committed: Thu Jul 27 13:44:48 2017 +0100
----------------------------------------------------------------------
.../store/berkeleydb/BDBCacheSizeSetter.java | 25 ++--
.../VirtualHostStoreUpgraderAndRecoverer.java | 22 +++-
.../server/virtualhost/AbstractVirtualHost.java | 130 ++++++++++++-------
3 files changed, 117 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/e697c9ed/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBCacheSizeSetter.java
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBCacheSizeSetter.java b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBCacheSizeSetter.java
index 8d0e755..e7c16a0 100644
--- a/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBCacheSizeSetter.java
+++ b/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBCacheSizeSetter.java
@@ -99,21 +99,18 @@ public class BDBCacheSizeSetter extends AbstractConfigurationChangeListener
}
}
int numberOfJEEnvironments = bdbEnvironmentContainers.size();
- if (numberOfJEEnvironments == 0)
+ if (numberOfJEEnvironments > 0)
{
- // This should never happen out side of tests
- LOGGER.warn("Cannot find any BDBEnvironmentContainer instance when there should be at least one.");
- numberOfJEEnvironments = 1;
- }
- long cacheSize = totalCacheSize / numberOfJEEnvironments;
- if (cacheSize < BDBVirtualHost.BDB_MIN_CACHE_SIZE)
- {
- cacheSize = BDBVirtualHost.BDB_MIN_CACHE_SIZE;
- }
- LOGGER.debug("Setting JE cache size: totalCacheSize: {}; numberOfJEEnvironment: {}; cacheSize: {}", totalCacheSize, numberOfJEEnvironments, cacheSize);
- for (BDBEnvironmentContainer bdbEnvironmentContainer : bdbEnvironmentContainers)
- {
- bdbEnvironmentContainer.setBDBCacheSize(cacheSize);
+ long cacheSize = totalCacheSize / numberOfJEEnvironments;
+ if (cacheSize < BDBVirtualHost.BDB_MIN_CACHE_SIZE)
+ {
+ cacheSize = BDBVirtualHost.BDB_MIN_CACHE_SIZE;
+ }
+ LOGGER.debug("Setting JE cache size: totalCacheSize: {}; numberOfJEEnvironment: {}; cacheSize: {}", totalCacheSize, numberOfJEEnvironments, cacheSize);
+ for (BDBEnvironmentContainer bdbEnvironmentContainer : bdbEnvironmentContainers)
+ {
+ bdbEnvironmentContainer.setBDBCacheSize(cacheSize);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/e697c9ed/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java b/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java
index 84071bf..1572600 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/store/VirtualHostStoreUpgraderAndRecoverer.java
@@ -1039,9 +1039,9 @@ public class VirtualHostStoreUpgraderAndRecoverer extends AbstractConfigurationS
if(child instanceof VirtualHost)
{
child.removeChangeListener(configChangeListener);
+ removeVirtualHostConfiguration((VirtualHost<?>) child, durableConfigurationStore);
}
}
-
});
if(isNew)
{
@@ -1052,4 +1052,24 @@ public class VirtualHostStoreUpgraderAndRecoverer extends AbstractConfigurationS
}
}
+ private void removeVirtualHostConfiguration(final VirtualHost<?> virtualHost,
+ final DurableConfigurationStore durableConfigurationStore)
+ {
+ Set<ConfiguredObjectRecord> records = new HashSet<>();
+ applyRecursively(virtualHost, new RecursiveAction<ConfiguredObject<?>>()
+ {
+ @Override
+ public boolean applyToChildren(final ConfiguredObject<?> object)
+ {
+ return object.isDurable();
+ }
+
+ @Override
+ public void performAction(final ConfiguredObject<?> object)
+ {
+ records.add(object.asObjectRecord());
+ }
+ });
+ durableConfigurationStore.remove(records.toArray(new ConfiguredObjectRecord[records.size()]));
+ }
}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/e697c9ed/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
index da32b3d..4db5344 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
@@ -156,9 +156,10 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
private final AccessControlContext _housekeepingJobContext;
private final AccessControlContext _fileSystemSpaceCheckerJobContext;
private final AtomicBoolean _acceptsConnections = new AtomicBoolean(false);
- private TaskExecutor _preferenceTaskExecutor;
+ private volatile TaskExecutor _preferenceTaskExecutor;
+ private volatile boolean _deleteRequested;
- private static enum BlockingType { STORE, FILESYSTEM };
+ private enum BlockingType { STORE, FILESYSTEM };
private static final String USE_ASYNC_RECOVERY = "use_async_message_store_recovery";
@@ -167,7 +168,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
private static final int HOUSEKEEPING_SHUTDOWN_TIMEOUT = 5;
- private ScheduledThreadPoolExecutor _houseKeepingTaskExecutor;
+ private volatile ScheduledThreadPoolExecutor _houseKeepingTaskExecutor;
private final Broker<?> _broker;
@@ -1151,7 +1152,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
}
}
- protected void shutdownHouseKeeping()
+ private void shutdownHouseKeeping()
{
if(_houseKeepingTaskExecutor != null)
{
@@ -1169,6 +1170,10 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
_logger.warn("Interrupted during Housekeeping shutdown:", e);
Thread.currentThread().interrupt();
}
+ finally
+ {
+ _houseKeepingTaskExecutor = null;
+ }
}
}
@@ -1511,7 +1516,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
protected ListenableFuture<Void> beforeClose()
{
setState(State.UNAVAILABLE);
- _virtualHostLoggersToClose = new ArrayList(getChildren(VirtualHostLogger.class));
+ _virtualHostLoggersToClose = new ArrayList<>(getChildren(VirtualHostLogger.class));
//Stop Connections
return closeConnections();
}
@@ -1521,9 +1526,22 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
{
_dtxRegistry.close();
shutdownHouseKeeping();
+
+ if (_deleteRequested)
+ {
+ deleteLinkRegistry();
+ }
+
closeMessageStore();
stopPreferenceTaskExecutor();
closePreferenceStore();
+
+ if (_deleteRequested)
+ {
+ deleteMessageStore();
+ deletePreferenceStore();
+ }
+
closeNetworkConnectionScheduler();
_eventLogger.message(VirtualHostMessages.CLOSED(getName()));
@@ -1532,11 +1550,11 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
}
- public ListenableFuture<Void> closeConnections()
+ private ListenableFuture<Void> closeConnections()
{
if (_logger.isDebugEnabled())
{
- _logger.debug("Closing connection registry :" + _connections.size() + " connections.");
+ _logger.debug("Closing connection registry : {} connection(s).", _connections.size());
}
_acceptsConnections.set(false);
for(AMQPConnection<?> conn : _connections)
@@ -1719,7 +1737,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
}
}
- protected void reportIfError(State state)
+ private void reportIfError(State state)
{
if (state == State.ERRORED)
{
@@ -2244,6 +2262,7 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
if (_preferenceTaskExecutor != null)
{
_preferenceTaskExecutor.stop();
+ _preferenceTaskExecutor = null;
}
}
@@ -2263,47 +2282,68 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
}
}
+ @SuppressWarnings("ignore")
@StateTransition( currentState = { State.ACTIVE, State.ERRORED }, desiredState = State.DELETED )
private ListenableFuture<Void> doDelete()
{
+ _deleteRequested = true;
+
return doAfterAlways(closeAsync(),
- new Runnable()
- {
- @Override
- public void run()
- {
- if (_linkRegistry != null)
- {
- _linkRegistry.delete();
- }
- MessageStore ms = getMessageStore();
- if (ms != null)
- {
- try
- {
- ms.onDelete(AbstractVirtualHost.this);
- }
- catch (Exception e)
- {
- _logger.warn("Exception occurred on message store deletion", e);
- }
- }
- PreferenceStore ps = _preferenceStore;
- if (ps != null)
- {
- try
- {
- ps.onDelete();
- }
- catch (Exception e)
- {
- _logger.warn("Exception occurred on preference store deletion", e);
- }
- }
- deleted();
- setState(State.DELETED);
- }
- });
+ () ->
+ {
+ setState(State.DELETED);
+ deleted();
+ });
+ }
+
+ private void deleteLinkRegistry()
+ {
+ if (_linkRegistry != null)
+ {
+ _linkRegistry.delete();
+ _linkRegistry = null;
+ }
+ }
+
+ private void deletePreferenceStore()
+ {
+ final PreferenceStore ps = _preferenceStore;
+ if (ps != null)
+ {
+ try
+ {
+ ps.onDelete();
+ }
+ catch (Exception e)
+ {
+ _logger.warn("Exception occurred on preference store deletion", e);
+ }
+ finally
+ {
+ _preferenceStore = null;
+
+ }
+ }
+ }
+
+ private void deleteMessageStore()
+ {
+ MessageStore ms = _messageStore;
+ if (ms != null)
+ {
+ try
+ {
+ ms.onDelete(AbstractVirtualHost.this);
+ }
+ catch (Exception e)
+ {
+ _logger.warn( "Exception occurred on message store deletion", e);
+ }
+ finally
+ {
+ _messageStore = null;
+ }
+ }
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org