Adopt change in TomcatInstanceManager to make it compatible with Tomcat 7.0.53 - bug 440190
diff --git a/build.versions b/build.versions
index 1284d5e..78f8390 100644
--- a/build.versions
+++ b/build.versions
@@ -63,7 +63,7 @@
 org.apache.openwebbeans.impl=1.1.7.v201304201405
 org.apache.openwebbeans.jsf=1.1.7.v201304201405
 org.apache.openwebbeans.spi=1.1.7.v201304201405
-org.apache.openwebbeans.tomcat7=1.1.7.v201304201405
+org.apache.openwebbeans.tomcat7=1.1.7.v201304201405-virgo-1
 org.apache.openwebbeans.web=1.1.7.v201304201405
 org.apache.sshd.core=0.5.0.v201108120515
 org.apache.tomcat.api=7.0.53.v201406060720
diff --git a/hotfix/plugins/org.apache.openwebbeans.tomcat7_1.1.7.v201304201405-virgo-1.jar b/hotfix/plugins/org.apache.openwebbeans.tomcat7_1.1.7.v201304201405-virgo-1.jar
new file mode 100755
index 0000000..e9ccd76
--- /dev/null
+++ b/hotfix/plugins/org.apache.openwebbeans.tomcat7_1.1.7.v201304201405-virgo-1.jar
Binary files differ
diff --git a/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/README.txt b/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/README.txt
new file mode 100755
index 0000000..ccda5c4
--- /dev/null
+++ b/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/README.txt
@@ -0,0 +1,4 @@
+These are the modified classes and their compiled versions that are patched into the original org.apache.openwebbeans.tomcat7 jar.
+
+Original source can be found at:
+http://svn.apache.org/repos/asf/openwebbeans/tags/openwebbeans-1.1.7/webbeans-tomcat7/
\ No newline at end of file
diff --git a/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/TomcatInstanceManager.class b/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/TomcatInstanceManager.class
new file mode 100755
index 0000000..e13528b
--- /dev/null
+++ b/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/TomcatInstanceManager.class
Binary files differ
diff --git a/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/TomcatInstanceManager.java b/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/TomcatInstanceManager.java
new file mode 100755
index 0000000..9619b6a
--- /dev/null
+++ b/hotfix/source/org.apache.openwebbeans.tomcat7_1.1.7/TomcatInstanceManager.java
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+package org.apache.webbeans.web.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.naming.NamingException;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.InstanceManager;
+
+public class TomcatInstanceManager implements InstanceManager
+{
+    private static final Log log = LogFactory.getLog(TomcatInstanceManager.class);
+
+    private InstanceManager processor;
+
+    private ClassLoader loader;
+
+    private Map<Object, Object> objects = new ConcurrentHashMap<Object, Object>();
+
+    public TomcatInstanceManager(ClassLoader loader, InstanceManager processor)
+    {
+        this.processor = processor;
+        this.loader = loader;
+    }
+
+    @Override
+    public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException
+    {
+        Object injectorInstance = objects.get(instance);
+        if (injectorInstance != null)
+        {
+            try
+            {
+                if (log.isDebugEnabled())
+                {
+                    log.debug("Destroying the OpenWebBeans injector instance");
+                }
+                TomcatUtil.destroy(injectorInstance, loader);
+            }
+            catch (Exception e)
+            {
+                log.error("Erros is occured while destroying the OpenWebBeans injector instance", e);
+            }
+        }
+        this.processor.destroyInstance(instance);
+    }
+
+    @Override
+    public Object newInstance(String str) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException
+    {
+        // Creates a defaut instance
+        Object object = this.processor.newInstance(str);
+
+        // Inject dependencies
+        inject(object);
+
+        return object;
+    }
+
+    @Override
+    public void newInstance(Object object) throws IllegalAccessException, InvocationTargetException, NamingException
+    {
+        // Inject dependencies
+        inject(object);
+    }
+
+    @Override
+    public Object newInstance(String str, ClassLoader cl) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException, ClassNotFoundException
+    {
+        // Creates a defaut instance
+        Object object = this.processor.newInstance(str, cl);
+
+        // Inject dependencies
+        inject(object);
+
+        return object;
+    }
+    
+    @Override
+    public Object newInstance(Class<?> clazz) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException
+    {
+        // Creates a defaut instance
+        Object object = this.processor.newInstance(clazz);
+
+        // Inject dependencies
+        inject(object);
+
+        return object;
+    }
+
+    private void inject(Object object)
+    {
+        try
+        {
+            if(log.isDebugEnabled())
+            {
+                log.debug("Injecting the dependencies for OpenWebBeans, " +
+                          "instance : " + object);
+            }
+
+            Object injectorInstance = TomcatUtil.inject(object, loader);
+            if (injectorInstance != null)
+            {
+                objects.put(object, injectorInstance);
+            }
+        }
+        catch (Exception e)
+        {
+            log.error("Error is occured while injecting the OpenWebBeans " +
+                      "dependencies for instance " + object,e);
+        }
+    }
+
+}