*
* @param invocation the invocation
*/
protected void maintainRelatives(Invocation invocation)
{
HierarchicalState state = ((DelegateSupport)invocation.getTargetObject()).getState();
// We use a clone to avoid a deadlock where requests are made to close parent and child
// concurrently
Set clone;
Set children = state.getChildren();
if (children == null)
{
if (trace) { log.trace(this + " has no children"); }
return;
}
synchronized (children)
{
clone = new HashSet(children);
}
// Cycle through the children this will do a depth first close
for (Iterator i = clone.iterator(); i.hasNext();)
{
HierarchicalState child = (HierarchicalState)i.next();
Closeable del = (Closeable)child.getDelegate();
try
{
del.closing();
del.close();
}