ACE-2816 "Ensure that Behaviour Bindings are Removed on Event Subsystem Stop"

Fix up policy component class behaviour listeners for removal of behaviour

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85600 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Steven Glover
2014-09-24 11:28:31 +00:00
parent ab8bd84a7b
commit 40f3283ee3
4 changed files with 49 additions and 2 deletions

View File

@@ -34,5 +34,7 @@ package org.alfresco.repo.policy;
* @param binding the binding
* @param behaviour the behaviour attached to the binding
*/
public void addition(B binding, Behaviour behaviour);
void addition(B binding, Behaviour behaviour);
void removal(B binding, Behaviour behaviour);
}

View File

@@ -95,8 +95,12 @@ import java.util.Map;
{
existing.remove(behaviourDefinition);
size--;
}
for (BehaviourChangeObserver<B> listener : observers)
{
listener.removal(binding, behaviourDefinition.getBehaviour());
}
}
}

View File

@@ -89,6 +89,12 @@ import org.apache.commons.logging.LogFactory;
clearCache("aggregate delegate", singleCache, binding);
clearCache("delegate collection", listCache, binding);
}
public void removal(B binding, Behaviour behaviour)
{
clearCache("aggregate delegate", singleCache, binding);
clearCache("delegate collection", listCache, binding);
}
});
}

View File

@@ -77,6 +77,33 @@ import org.alfresco.util.LockHelper;
listener.addition(binding, behaviour);
}
}
public void removal(B binding, Behaviour behaviour)
{
for (BehaviourChangeObserver<B> listener : observers)
{
listener.removal(binding, behaviour);
}
}
});
this.classMap.addChangeObserver(new BehaviourChangeObserver<B>()
{
public void addition(B binding, Behaviour behaviour)
{
for (BehaviourChangeObserver<B> listener : observers)
{
listener.addition(binding, behaviour);
}
}
public void removal(B binding, Behaviour behaviour)
{
for (BehaviourChangeObserver<B> listener : observers)
{
listener.removal(binding, behaviour);
}
}
});
// Observe service binding changes and propagate to our own observers
@@ -90,6 +117,14 @@ import org.alfresco.util.LockHelper;
listener.addition(null, behaviour);
}
}
public void removal(ServiceBehaviourBinding binding, Behaviour behaviour)
{
for (BehaviourChangeObserver<B> listener : observers)
{
listener.removal(null, behaviour);
}
}
});
// Setup state