Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2008-11-26 15:58:14 +0000
committermkuppe2008-11-26 15:58:14 +0000
commit77c905f8228dcd991bd7356a624b420e195d289e (patch)
treeaea3d29776905863a9326b9e1df12bb7bca71168
parent74ed5411ceca51c655089de2470164f07f5016f2 (diff)
downloadorg.eclipse.ecf-77c905f8228dcd991bd7356a624b420e195d289e.tar.gz
org.eclipse.ecf-77c905f8228dcd991bd7356a624b420e195d289e.tar.xz
org.eclipse.ecf-77c905f8228dcd991bd7356a624b420e195d289e.zip
NEW - bug 256580: org.eclipse.ecf.core.ContainerFactory.getContainer(ID) never returns and causes caller to hang indefinitely
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256580
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java470
1 files changed, 317 insertions, 153 deletions
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java
index 48e6951bf..0e6947bf7 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerFactory.java
@@ -1,26 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Composent, Inc. - initial API and implementation
+ * Copyright (c) 2004, 2007 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
******************************************************************************/
package org.eclipse.ecf.core;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.runtime.Status;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.provider.IContainerInstantiator;
import org.eclipse.ecf.core.util.Trace;
-import org.eclipse.ecf.internal.core.ECFDebugOptions;
-import org.eclipse.ecf.internal.core.ECFPlugin;
-import org.eclipse.ecf.internal.core.IDisposable;
+import org.eclipse.ecf.internal.core.*;
/**
* Factory for creating {@link IContainer} instances. This class provides ECF
@@ -39,64 +34,48 @@ import org.eclipse.ecf.internal.core.IDisposable;
* {@link IContainer}.
*
* @see IContainer
+ * @see IContainerFactory
*/
-public class ContainerFactory implements IContainerFactory {
- private static final int DISPOSE_ERROR_CODE = 100;
+public class ContainerFactory implements IContainerFactory, IContainerManager {
+
+ public static final String BASE_CONTAINER_NAME = Messages.ContainerFactory_Base_Container_Name;
+
+ static final Map containerdescriptions = new HashMap();
- private static Hashtable containerdescriptions = new Hashtable();
+ static final Map containers = new HashMap();
- protected static IContainerFactory instance = null;
+ static final List managerListeners = new ArrayList();
- protected static Map containers = new WeakHashMap();
+ private static IContainerFactory instance = null;
static {
instance = new ContainerFactory();
}
- protected ContainerFactory() {
- try {
- ECFPlugin.getDefault().addDisposable(new IDisposable() {
- public void dispose() {
- doDispose();
- }
- });
- } catch (Exception e) {
- System.err
- .println("WARNING: Exception accessing ECFPlugin within ContainerFactory initialization. May not be running as OSGI bundle");
- e.printStackTrace(System.err);
- }
- }
-
public static IContainerFactory getDefault() {
return instance;
}
- protected void addContainer(IContainer container) {
- containers.put(container, null);
- }
-
- protected void removeContainer(IContainer container) {
- containers.remove(container);
- }
-
- protected void doDispose() {
- for (Iterator i = containers.keySet().iterator(); i.hasNext();) {
- IContainer c = (IContainer) i.next();
- if (c != null) {
- try {
- c.dispose();
- } catch (Exception e) {
- // Log exception
- ECFPlugin.log(new Status(Status.ERROR, ECFPlugin
- .getDefault().getBundle().getSymbolicName(),
- DISPOSE_ERROR_CODE, "container dispose error", e));
- Trace.catching(ECFPlugin.getDefault(),
- ECFDebugOptions.EXCEPTIONS_CATCHING,
- ContainerFactory.class, "doDispose", e);
+ protected ContainerFactory() {
+ ECFPlugin.getDefault().addDisposable(new IDisposable() {
+ public void dispose() {
+ synchronized (containers) {
+ for (Iterator i = containers.keySet().iterator(); i.hasNext();) {
+ IContainer c = (IContainer) containers.get(i.next());
+ try {
+ c.dispose();
+ } catch (Throwable e) {
+ // Log exception
+ ECFPlugin.getDefault().log(new Status(IStatus.ERROR, ECFPlugin.getDefault().getBundle().getSymbolicName(), IStatus.ERROR, "container dispose error", e)); //$NON-NLS-1$
+ Trace.catching(ECFPlugin.PLUGIN_ID, ECFDebugOptions.EXCEPTIONS_CATCHING, ContainerFactory.class, "doDispose", e); //$NON-NLS-1$
+ }
+ }
+ containers.clear();
}
+ containerdescriptions.clear();
+ managerListeners.clear();
}
- }
- containers.clear();
+ });
}
/*
@@ -104,14 +83,8 @@ public class ContainerFactory implements IContainerFactory {
*
* @see org.eclipse.ecf.core.IContainerFactory#addDescription(org.eclipse.ecf.core.ContainerTypeDescription)
*/
- public ContainerTypeDescription addDescription(ContainerTypeDescription scd) {
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ContainerFactory.class,
- "addDescription", scd);
- ContainerTypeDescription result = addDescription0(scd);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ContainerFactory.class, "addDescription", result);
- return result;
+ public ContainerTypeDescription addDescription(ContainerTypeDescription containerTypeDescription) {
+ return addDescription0(containerTypeDescription);
}
/*
@@ -124,15 +97,17 @@ public class ContainerFactory implements IContainerFactory {
}
protected List getDescriptions0() {
- return new ArrayList(containerdescriptions.values());
+ synchronized (containerdescriptions) {
+ return new ArrayList(containerdescriptions.values());
+ }
}
- protected ContainerTypeDescription addDescription0(
- ContainerTypeDescription n) {
- if (n == null)
+ protected ContainerTypeDescription addDescription0(ContainerTypeDescription containerTypeDescription) {
+ if (containerTypeDescription == null)
return null;
- return (ContainerTypeDescription) containerdescriptions.put(
- n.getName(), n);
+ synchronized (containerdescriptions) {
+ return (ContainerTypeDescription) containerdescriptions.put(containerTypeDescription.getName(), containerTypeDescription);
+ }
}
/*
@@ -140,28 +115,32 @@ public class ContainerFactory implements IContainerFactory {
*
* @see org.eclipse.ecf.core.IContainerFactory#containsDescription(org.eclipse.ecf.core.ContainerTypeDescription)
*/
- public boolean containsDescription(ContainerTypeDescription scd) {
- return containsDescription0(scd);
+ public boolean containsDescription(ContainerTypeDescription containerTypeDescription) {
+ return containsDescription0(containerTypeDescription);
}
- protected boolean containsDescription0(ContainerTypeDescription scd) {
- if (scd == null)
+ protected boolean containsDescription0(ContainerTypeDescription containerTypeDescription) {
+ if (containerTypeDescription == null)
return false;
- return containerdescriptions.containsKey(scd.getName());
+ synchronized (containerdescriptions) {
+ return containerdescriptions.containsKey(containerTypeDescription.getName());
+ }
}
- protected ContainerTypeDescription getDescription0(
- ContainerTypeDescription scd) {
- if (scd == null)
+ protected ContainerTypeDescription getDescription0(ContainerTypeDescription containerTypeDescription) {
+ if (containerTypeDescription == null)
return null;
- return (ContainerTypeDescription) containerdescriptions.get(scd
- .getName());
+ synchronized (containerdescriptions) {
+ return (ContainerTypeDescription) containerdescriptions.get(containerTypeDescription.getName());
+ }
}
- protected ContainerTypeDescription getDescription0(String name) {
- if (name == null)
+ protected ContainerTypeDescription getDescription0(String containerTypeDescriptionName) {
+ if (containerTypeDescriptionName == null)
return null;
- return (ContainerTypeDescription) containerdescriptions.get(name);
+ synchronized (containerdescriptions) {
+ return (ContainerTypeDescription) containerdescriptions.get(containerTypeDescriptionName);
+ }
}
/*
@@ -169,110 +148,295 @@ public class ContainerFactory implements IContainerFactory {
*
* @see org.eclipse.ecf.core.IContainerFactory#getDescriptionByName(java.lang.String)
*/
- public ContainerTypeDescription getDescriptionByName(String name) {
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ContainerFactory.class,
- "getDescriptionByName", name);
- ContainerTypeDescription res = getDescription0(name);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ContainerFactory.class, "getDescriptionByName", res);
- return res;
- }
-
- protected void throwContainerCreateException(String message,
- Throwable cause, String method) throws ContainerCreateException {
- ContainerCreateException except = (cause == null) ? new ContainerCreateException(
- message)
- : new ContainerCreateException(message, cause);
- Trace.throwing(ECFPlugin.getDefault(),
- ECFDebugOptions.EXCEPTIONS_THROWING, ContainerFactory.class,
- method, except);
+ public ContainerTypeDescription getDescriptionByName(String containerTypeDescriptionName) {
+ return getDescription0(containerTypeDescriptionName);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainerFactory#removeDescription(org.eclipse.ecf.core.ContainerTypeDescription)
+ */
+ public ContainerTypeDescription removeDescription(ContainerTypeDescription containerTypeDescription) {
+ return removeDescription0(containerTypeDescription);
+
+ }
+
+ protected ContainerTypeDescription removeDescription0(ContainerTypeDescription containerTypeDescription) {
+ if (containerTypeDescription == null)
+ return null;
+ synchronized (containerdescriptions) {
+ return (ContainerTypeDescription) containerdescriptions.remove(containerTypeDescription.getName());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainerFactory#getDescriptionsForContainerAdapter(java.lang.Class)
+ */
+ public ContainerTypeDescription[] getDescriptionsForContainerAdapter(Class containerAdapter) {
+ if (containerAdapter == null)
+ throw new NullPointerException(Messages.ContainerFactory_Exception_Adapter_Not_Null);
+ List result = new ArrayList();
+ List descriptions = getDescriptions();
+ for (Iterator i = descriptions.iterator(); i.hasNext();) {
+ ContainerTypeDescription description = (ContainerTypeDescription) i.next();
+ String[] supportedAdapters = description.getSupportedAdapterTypes();
+ if (supportedAdapters != null) {
+ for (int j = 0; j < supportedAdapters.length; j++) {
+ if (supportedAdapters[j].equals(containerAdapter.getName()))
+ result.add(description);
+ }
+ }
+ }
+ return (ContainerTypeDescription[]) result.toArray(new ContainerTypeDescription[] {});
+ }
+
+ protected void throwContainerCreateException(String message, Throwable cause, String method) throws ContainerCreateException {
+ ContainerCreateException except = (cause == null) ? new ContainerCreateException(message) : new ContainerCreateException(message, cause);
+ Trace.throwing(ECFPlugin.PLUGIN_ID, ECFDebugOptions.EXCEPTIONS_THROWING, ContainerFactory.class, method, except);
throw except;
}
/*
* (non-Javadoc)
*
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer()
+ */
+ public IContainer createContainer() throws ContainerCreateException {
+ return createContainer(BASE_CONTAINER_NAME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(org.eclipse.ecf.core.identity.ID)
+ */
+ public IContainer createContainer(ID containerID) throws ContainerCreateException {
+ if (containerID == null)
+ throw new ContainerCreateException(Messages.ContainerFactory_EXCEPTION_CONTAINERID_NOT_NULL);
+ return createContainer(BASE_CONTAINER_NAME, new Object[] {containerID});
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(org.eclipse.ecf.core.ContainerTypeDescription)
+ */
+ public IContainer createContainer(ContainerTypeDescription containerTypeDescription) throws ContainerCreateException {
+ return createContainer(containerTypeDescription, (Object[]) null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(java.lang.String)
+ */
+ public IContainer createContainer(String containerTypeDescriptionName) throws ContainerCreateException {
+ return createContainer(getDescriptionByName(containerTypeDescriptionName), (Object[]) null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.ecf.core.IContainerFactory#createContainer(org.eclipse.ecf.core.ContainerTypeDescription,
* java.lang.Object[])
*/
- public IContainer createContainer(ContainerTypeDescription description,
- Object[] args) throws ContainerCreateException {
- String method = "createContainer";
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ContainerFactory.class,
- method, new Object[] { description,Trace.getArgumentsString(args) });
- if (description == null)
- throwContainerCreateException(
- "ContainerTypeDescription cannot be null", null, method);
- ContainerTypeDescription cd = getDescription0(description);
+ public IContainer createContainer(ContainerTypeDescription containerTypeDescription, Object[] parameters) throws ContainerCreateException {
+ String method = "createContainer"; //$NON-NLS-1$
+ Trace.entering(ECFPlugin.PLUGIN_ID, ECFDebugOptions.METHODS_ENTERING, ContainerFactory.class, method, new Object[] {containerTypeDescription, Trace.getArgumentsString(parameters)});
+ if (containerTypeDescription == null)
+ throwContainerCreateException(Messages.ContainerFactory_Exception_Create_Container, null, method);
+ ContainerTypeDescription cd = getDescription0(containerTypeDescription);
if (cd == null)
- throwContainerCreateException("ContainerTypeDescription '"
- + description.getName() + "' not found", null, method);
+ throwContainerCreateException("ContainerTypeDescription '" //$NON-NLS-1$
+ + containerTypeDescription.getName() + "' not found", null, method); //$NON-NLS-1$
IContainerInstantiator instantiator = null;
try {
- instantiator = (IContainerInstantiator) cd.getInstantiator();
+ instantiator = cd.getInstantiator();
} catch (Exception e) {
- throwContainerCreateException(
- "createContainer cannot get IContainerInstantiator for description : "
- + description, e, method);
+ throwContainerCreateException("createContainer cannot get IContainerInstantiator for description : " //$NON-NLS-1$
+ + containerTypeDescription, e, method);
}
// Ask instantiator to actually create instance
- IContainer container = instantiator.createInstance(description,
- args);
+ IContainer container = instantiator.createInstance(containerTypeDescription, parameters);
if (container == null)
- throwContainerCreateException("Instantiator returned null for '"
- + cd.getName() + "'", null, method);
- // Add to containers map
- addContainer(container);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ContainerFactory.class, method, container);
+ throwContainerCreateException("Instantiator returned null for '" //$NON-NLS-1$
+ + cd.getName() + "'", null, method); //$NON-NLS-1$
+ // Add to containers map if container.getID() provides a valid value.
+ ID containerID = container.getID();
+ if (containerID != null)
+ addContainer(container);
+ Trace.exiting(ECFPlugin.PLUGIN_ID, ECFDebugOptions.METHODS_EXITING, ContainerFactory.class, method, container);
return container;
}
/*
* (non-Javadoc)
*
- * @see org.eclipse.ecf.core.IContainerFactory#createContainer(java.lang.String)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(java.lang.String,
+ * java.lang.Object[])
+ */
+ public IContainer createContainer(String containerTypeDescriptionName, Object[] parameters) throws ContainerCreateException {
+ return createContainer(getDescriptionByName(containerTypeDescriptionName), parameters);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(org.eclipse.ecf.core.ContainerTypeDescription, org.eclipse.ecf.core.identity.ID, java.lang.Object[])
*/
- public IContainer createContainer(String descriptionName)
- throws ContainerCreateException {
- return createContainer(getDescriptionByName(descriptionName), null);
+ public IContainer createContainer(ContainerTypeDescription containerTypeDescription, ID containerID, Object[] parameters) throws ContainerCreateException {
+ if (containerID == null)
+ throw new ContainerCreateException(Messages.ContainerFactory_EXCEPTION_CONTAINERID_NOT_NULL);
+ Object[] params = (parameters == null || parameters.length == 0) ? new Object[1] : new Object[parameters.length + 1];
+ params[0] = containerID;
+ if (parameters != null && parameters.length != 0)
+ System.arraycopy(parameters, 0, params, 1, parameters.length);
+ return createContainer(containerTypeDescription, params);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(java.lang.String, org.eclipse.ecf.core.identity.ID, java.lang.Object[])
+ */
+ public IContainer createContainer(String containerTypeDescriptionName, ID containerID, Object[] parameters) throws ContainerCreateException {
+ if (containerID == null)
+ throw new ContainerCreateException(Messages.ContainerFactory_EXCEPTION_CONTAINERID_NOT_NULL);
+ return createContainer(getDescriptionByName(containerTypeDescriptionName), containerID, parameters);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(org.eclipse.ecf.core.ContainerTypeDescription, org.eclipse.ecf.core.identity.ID)
+ */
+ public IContainer createContainer(ContainerTypeDescription containerTypeDescription, ID containerID) throws ContainerCreateException {
+ if (containerID == null)
+ throw new ContainerCreateException(Messages.ContainerFactory_EXCEPTION_CONTAINERID_NOT_NULL);
+ return createContainer(containerTypeDescription, new Object[] {containerID});
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerFactory#createContainer(java.lang.String, org.eclipse.ecf.core.identity.ID)
+ */
+ public IContainer createContainer(String containerTypeDescriptionName, ID containerID) throws ContainerCreateException {
+ return createContainer(getDescriptionByName(containerTypeDescriptionName), new Object[] {containerID});
}
/*
* (non-Javadoc)
*
- * @see org.eclipse.ecf.core.IContainerFactory#createContainer(java.lang.String,
- * java.lang.Object[])
+ * @see org.eclipse.ecf.core.IContainerManager#getAllContainers()
*/
- public IContainer createContainer(String descriptionName, Object[] args)
- throws ContainerCreateException {
- return createContainer(getDescriptionByName(descriptionName), args);
+ public IContainer[] getAllContainers() {
+ List containersList = null;
+ synchronized (containers) {
+ containersList = new ArrayList(containers.values());
+ }
+ return (IContainer[]) containersList.toArray(new IContainer[] {});
}
/*
* (non-Javadoc)
*
- * @see org.eclipse.ecf.core.IContainerFactory#removeDescription(org.eclipse.ecf.core.ContainerTypeDescription)
+ * @see org.eclipse.ecf.core.IContainerManager#getContainer(org.eclipse.ecf.core.identity.ID)
+ */
+ public IContainer getContainer(ID containerID) {
+ if (containerID == null)
+ return null;
+ synchronized (containers) {
+ return (IContainer) containers.get(containerID);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainerManager#hasContainer(org.eclipse.ecf.core.identity.ID)
+ */
+ public boolean hasContainer(ID containerID) {
+ Assert.isNotNull(containerID);
+ synchronized (containers) {
+ return containers.containsKey(containerID);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerManager#addListener(org.eclipse.ecf.core.IContainerManagerListener)
+ */
+ public boolean addListener(IContainerManagerListener listener) {
+ Assert.isNotNull(listener);
+ synchronized (managerListeners) {
+ return managerListeners.add(listener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.core.IContainerManager#removeListener(org.eclipse.ecf.core.IContainerManagerListener)
*/
- public ContainerTypeDescription removeDescription(
- ContainerTypeDescription scd) {
- Trace.entering(ECFPlugin.getDefault(),
- ECFDebugOptions.METHODS_ENTERING, ContainerFactory.class,
- "removeDescription", scd);
- ContainerTypeDescription description = removeDescription0(scd);
- Trace.exiting(ECFPlugin.getDefault(), ECFDebugOptions.METHODS_EXITING,
- ContainerFactory.class, "removeDescription", description);
- return description;
+ public boolean removeListener(IContainerManagerListener listener) {
+ Assert.isNotNull(listener);
+ synchronized (managerListeners) {
+ return managerListeners.remove(listener);
+ }
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainerManager#addContainer(org.eclipse.ecf.core.IContainer)
+ */
+ public IContainer addContainer(IContainer container) {
+ Assert.isNotNull(container);
+ ID containerID = container.getID();
+ Assert.isNotNull(containerID, Messages.ContainerFactory_EXCEPTION_CONTAINER_ID_NOT_NULL);
+ IContainer result = null;
+ synchronized (containers) {
+ result = (IContainer) containers.put(containerID, container);
+ }
+ if (result == null)
+ fireContainerAdded(container);
+ return result;
}
- protected ContainerTypeDescription removeDescription0(
- ContainerTypeDescription n) {
- if (n == null)
+ /**
+ * @param result
+ */
+ private void fireContainerAdded(IContainer result) {
+ List toNotify = null;
+ synchronized (managerListeners) {
+ toNotify = new ArrayList(managerListeners);
+ }
+ for (Iterator i = toNotify.iterator(); i.hasNext();) {
+ IContainerManagerListener cml = (IContainerManagerListener) i.next();
+ cml.containerAdded(result);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.core.IContainerManager#removeContainer(org.eclipse.ecf.core.IContainer)
+ */
+ public IContainer removeContainer(IContainer container) {
+ Assert.isNotNull(container);
+ ID containerID = container.getID();
+ if (containerID == null)
return null;
- return (ContainerTypeDescription) containerdescriptions.remove(n
- .getName());
+ IContainer result = null;
+ synchronized (containers) {
+ result = (IContainer) containers.remove(containerID);
+ }
+ if (result != null)
+ fireContainerRemoved(result);
+ return result;
}
+
+ /**
+ * @param result
+ */
+ private void fireContainerRemoved(IContainer result) {
+ List toNotify = null;
+ synchronized (managerListeners) {
+ toNotify = new ArrayList(managerListeners);
+ }
+ for (Iterator i = toNotify.iterator(); i.hasNext();) {
+ IContainerManagerListener cml = (IContainerManagerListener) i.next();
+ cml.containerRemoved(result);
+ }
+ }
+
} \ No newline at end of file

Back to the top