From bf135c5c0f1c9b949de97f97092780f8c3d9a8a2 Mon Sep 17 00:00:00 2001
From: jdemendi <jdemendi@localhost>
Date: Tue, 04 Nov 2008 09:53:59 +0000
Subject: [PATCH] fix 3560, Cannot recreate a workflow after a create/delete
---
opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java b/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
index 3fcb443..59b119f 100644
--- a/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
+++ b/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -80,26 +80,28 @@
// access to all the workflows. The purpose of the default network
// group is to allow new clients to perform a first operation before
// they can be attached to a specific network group.
+ private static final String DEFAULT_NETWORK_GROUP_NAME = "default";
+ private final boolean isDefaultNetworkGroup;
private static NetworkGroup defaultNetworkGroup =
- new NetworkGroup ("default");
+ new NetworkGroup (DEFAULT_NETWORK_GROUP_NAME);
// The admin network group (singleton).
// The admin network group has no criterion, no policy, and gives
// access to all the workflows.
private static final String ADMIN_NETWORK_GROUP_NAME = "admin";
+ private final boolean isAdminNetworkGroup;
private static NetworkGroup adminNetworkGroup =
new NetworkGroup (ADMIN_NETWORK_GROUP_NAME);
- private final boolean isAdminNetworkGroup;
// The internal network group (singleton).
// The internal network group has no criterion, no policy, and gives
// access to all the workflows. The purpose of the internal network
// group is to allow internal connections to perform operations.
private static final String INTERNAL_NETWORK_GROUP_NAME = "internal";
+ private boolean isInternalNetworkGroup;
private static NetworkGroup internalNetworkGroup =
new NetworkGroup(INTERNAL_NETWORK_GROUP_NAME);
- private boolean isInternalNetworkGroup;
// The list of all network groups that are registered with the server.
@@ -142,7 +144,8 @@
this.networkGroupID = networkGroupID;
isInternalNetworkGroup = INTERNAL_NETWORK_GROUP_NAME.equals(networkGroupID);
- isAdminNetworkGroup = ADMIN_NETWORK_GROUP_NAME.equals(networkGroupID);
+ isAdminNetworkGroup = ADMIN_NETWORK_GROUP_NAME.equals(networkGroupID);
+ isDefaultNetworkGroup = DEFAULT_NETWORK_GROUP_NAME.equals(networkGroupID);
}
@@ -302,6 +305,17 @@
// Rebuild the list of naming context handled by the network group
rebuildNamingContextList();
+
+ // Now that the workflow node has been registered with the network
+ // group, update the reference counter of the workflow, unless
+ // the network group is either default, or administration, or internal
+ // network group.
+ if (!isAdminNetworkGroup
+ && !isInternalNetworkGroup
+ && !isDefaultNetworkGroup)
+ {
+ workflow.incrementReferenceCounter();
+ }
}
}
@@ -354,6 +368,17 @@
}
}
+ // Now that the workflow node has been deregistered with the network
+ // group, update the reference counter of the workflow.
+ if ((workflow != null)
+ && !isAdminNetworkGroup
+ && !isInternalNetworkGroup
+ && !isDefaultNetworkGroup)
+ {
+ WorkflowImpl workflowImpl = (WorkflowImpl) workflow;
+ workflowImpl.decrementReferenceCounter();
+ }
+
return workflow;
}
@@ -363,11 +388,14 @@
* deregister is identified by its workflow ID.
*
* @param workflowID the workflow identifier of the workflow to deregister
+ * @return the deregistered workflow
*/
- public void deregisterWorkflow(
+ public Workflow deregisterWorkflow(
String workflowID
)
{
+ Workflow workflow = null;
+
String rootDSEWorkflowID = null;
if (rootDSEWorkflowNode != null)
{
@@ -378,6 +406,7 @@
{
// deregister the rootDSE
deregisterWorkflow(rootDSEWorkflowNode);
+ workflow = rootDSEWorkflowNode.getWorkflowImpl();
}
else
{
@@ -392,6 +421,7 @@
// Call deregisterWorkflow() instead of deregisterWorkflowNode()
// because we want the naming context list to be updated as well.
deregisterWorkflow(node);
+ workflow = node.getWorkflowImpl();
// Only one workflow can match the baseDN, so we can break
// the loop here.
@@ -400,6 +430,19 @@
}
}
}
+
+ // Now that the workflow node has been deregistered with the network
+ // group, update the reference counter of the workflow.
+ if ((workflow != null)
+ && !isAdminNetworkGroup
+ && !isInternalNetworkGroup
+ && !isDefaultNetworkGroup)
+ {
+ WorkflowImpl workflowImpl = (WorkflowImpl) workflow;
+ workflowImpl.decrementReferenceCounter();
+ }
+
+ return workflow;
}
--
Gitblit v1.10.0