Issue #23628 Cleanup + minor fixes

- formatting of the code to make it easier to read
- fixed several log messages (wrong formatting)
- ContainerInfo used to reduce duplications
- replaced several deprecated method calls with simple straight replacements
- deleted 20 years old TODOs
diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java
index 4515ff2..64c7a27 100644
--- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java
+++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java
@@ -85,12 +85,12 @@
 
     private JavaInfo java = new JavaInfo();
     private GlassFishInfo gfInfo = new GlassFishInfo();
-    private UserVMArgs userVMArgs = new UserVMArgs(System.getProperty(ENV_VAR_PROP_PREFIX + "VMARGS"));
+    private final UserVMArgs userVMArgs = new UserVMArgs(System.getProperty(ENV_VAR_PROP_PREFIX + "VMARGS"));
 
     /**
      * Set up with various sub-types of command line elements
      */
-    private CommandLineElement
+    private final CommandLineElement
         /** options to the ACC that take a value */
         accValuedOptions = new ACCValuedOption("-mainclass|-name|-xml|-configxml|-user|-password|-passwordfile|-targetserver"),
 
@@ -106,7 +106,7 @@
     private final JVMMainOption jvmMainSetting = new JVMMainOption();
 
     /** command line elements from most specific to least specific matching pattern */
-    private CommandLineElement[] elementsInScanOrder = new CommandLineElement[] {
+    private final CommandLineElement[] elementsInScanOrder = new CommandLineElement[] {
             accValuedOptions,   // collects options into "agentArgs"
             accUnvaluedOptions, // collects options into "agentArgs"
             jvmValuedOptions,
@@ -119,7 +119,7 @@
      * Command line elements in the order they should appear on the generated command line
      * Add the elements in this order so they appear in the generated java command in the correct positions.
      */
-    private CommandLineElement[] elementsInOutputOrder = new CommandLineElement[] {
+    private final CommandLineElement[] elementsInOutputOrder = new CommandLineElement[] {
             jvmValuedOptions,
             jvmPropertySettings,
             otherJVMOptions,
@@ -380,7 +380,7 @@
      */
     private static class AgentArgs {
         private final StringBuilder args = new StringBuilder("=mode=acscript");
-        private char sep = ',';
+        private final char sep = ',';
 
         AgentArgs() {
             final String appcPath = System.getProperty(ENV_VAR_PROP_PREFIX + "APPCPATH");
@@ -429,7 +429,7 @@
         private final Pattern whiteSpacePattern = Pattern.compile("[\\r\\n]");
 
         /** Allows multiple values; not all command line elements support this */
-        final List<String> values = new ArrayList<String>();
+        final List<String> values = new ArrayList<>();
 
         CommandLineElement(String patternString) {
             this(patternString, 0);
@@ -583,8 +583,8 @@
     private class ValuedOption extends Option {
 
         class OptionValue {
-            private String option;
-            private String value;
+            private final String option;
+            private final String value;
 
             OptionValue(String option, String value) {
                 this.option = option;
@@ -1034,7 +1034,7 @@
         private CommandLineElement evJVMValuedOptions;
         private CommandLineElement evOtherJVMOptions;
 
-        private final List<CommandLineElement> evElements = new ArrayList<CommandLineElement>();
+        private final List<CommandLineElement> evElements = new ArrayList<>();
 
         UserVMArgs(String vmargs) throws UserError {
 
diff --git a/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java b/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java
index a909336..d23ca31 100644
--- a/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java
+++ b/appserver/common/container-common/src/main/java/com/sun/enterprise/container/common/impl/util/JavaEEIOUtilsImpl.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -16,23 +17,28 @@
 
 package com.sun.enterprise.container.common.impl.util;
 
-import org.jvnet.hk2.annotations.Contract;
-import jakarta.inject.Inject;
-import org.jvnet.hk2.annotations.Service;
-import org.glassfish.hk2.api.PostConstruct;
-import org.glassfish.hk2.api.ServiceLocator;
-
-import com.sun.enterprise.container.common.spi.util.GlassFishOutputStreamHandler;
 import com.sun.enterprise.container.common.spi.util.GlassFishInputStreamHandler;
+import com.sun.enterprise.container.common.spi.util.GlassFishOutputStreamHandler;
 import com.sun.enterprise.container.common.spi.util.JavaEEIOUtils;
 import com.sun.logging.LogDomains;
 
-import java.io.*;
+import jakarta.inject.Inject;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.glassfish.hk2.api.ServiceLocator;
+import org.jvnet.hk2.annotations.Service;
+
 /**
  * A contract that defines a set of methods to serialize / deserialze Java EE
  * objects (even if they are not directly serializable).
@@ -53,20 +59,23 @@
     @Inject
     ServiceLocator habitat;
 
-    private Collection<GlassFishOutputStreamHandler> outputHandlers = new HashSet<GlassFishOutputStreamHandler>();
+    private final Collection<GlassFishOutputStreamHandler> outputHandlers = new HashSet<>();
 
-    private Collection<GlassFishInputStreamHandler> inputHandlers = new HashSet<GlassFishInputStreamHandler>();
+    private final Collection<GlassFishInputStreamHandler> inputHandlers = new HashSet<>();
 
+    @Override
     public ObjectInputStream createObjectInputStream(InputStream is,
             boolean resolveObject, ClassLoader loader) throws Exception {
         return new GlassFishObjectInputStream(inputHandlers, is, loader, resolveObject);
     }
 
+    @Override
     public ObjectOutputStream createObjectOutputStream(OutputStream os,
             boolean replaceObject) throws IOException {
         return new GlassFishObjectOutputStream(outputHandlers, os, replaceObject);
     }
 
+    @Override
     public byte[] serializeObject(Object obj, boolean replaceObject)
             throws java.io.IOException {
 
@@ -101,6 +110,7 @@
         return data;
     }
 
+    @Override
     public Object deserializeObject(byte[] data, boolean resolveObject,
             ClassLoader appClassLoader) throws Exception {
 
@@ -129,20 +139,24 @@
         return obj;
     }
 
+    @Override
     public void addGlassFishOutputStreamHandler(GlassFishOutputStreamHandler handler) {
         outputHandlers.add(handler);
 
     }
 
+    @Override
     public void removeGlassFishOutputStreamHandler(GlassFishOutputStreamHandler handler) {
         outputHandlers.remove(handler);
     }
 
+    @Override
     public void addGlassFishInputStreamHandler(
             GlassFishInputStreamHandler handler) {
         inputHandlers.add(handler);
     }
 
+    @Override
     public void removeGlassFishInputStreamHandler(
             GlassFishInputStreamHandler handler) {
         inputHandlers.remove(handler);
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/appserv/ejb/.gitkeep_empty_dir b/appserver/ejb/ejb-container/src/main/java/com/sun/appserv/ejb/.gitkeep_empty_dir
deleted file mode 100644
index e69de29..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/appserv/ejb/.gitkeep_empty_dir
+++ /dev/null
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/ClassGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/ClassGenerator.java
deleted file mode 100644
index 025edee..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/ClassGenerator.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.ejb;
-
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-import java.security.ProtectionDomain;
-
-/**
- * @author David Matejcek
- */
-public final class ClassGenerator {
-
-    private static Method defineClassMethod;
-    private static Method defineClassMethodSM;
-
-    static {
-        try {
-            final PrivilegedExceptionAction<Void> action = () -> {
-                final Class<?> cl = Class.forName("java.lang.ClassLoader");
-                final String name = "defineClass";
-                defineClassMethod = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class);
-                defineClassMethod.setAccessible(true);
-                defineClassMethodSM = cl.getDeclaredMethod(
-                    name, String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
-                defineClassMethodSM.setAccessible(true);
-                return null;
-            };
-            AccessController.doPrivileged(action);
-        } catch (final Exception e) {
-            throw new Error("Could not initialize access to ClassLoader.defineClass method.", e);
-        }
-    }
-
-
-    public static Class<?> defineClass(final ClassLoader loader, final String className, final byte[] b) {
-        return defineClass(loader, className, b, 0, b.length);
-    }
-
-
-    public static Class<?> defineClass(
-        final ClassLoader loader, final String className,
-        final byte[] b, final int off, final int len,
-        final ProtectionDomain protectionDomain) {
-        try {
-            return (Class<?>) defineClassMethodSM.invoke(loader, className, b, 0, len, protectionDomain);
-        } catch (final Exception e) {
-            throw new ClassDefinitionException(className, loader, e);
-        }
-    }
-
-    public static Class<?> defineClass(final ClassLoader loader, final String className, final byte[] b,
-        final ProtectionDomain protectionDomain) {
-        return defineClass(loader, className, b, 0, b.length, protectionDomain);
-    }
-
-
-    public static Class<?> defineClass(
-        final ClassLoader loader, final String className,
-        final byte[] b, final int off, final int len) {
-        try {
-            return (Class<?>) defineClassMethod.invoke(loader, className, b, 0, len);
-        } catch (final Exception e) {
-            throw new ClassDefinitionException(className, loader, e);
-        }
-    }
-
-
-    public static class ClassDefinitionException extends RuntimeException {
-        private static final long serialVersionUID = -8955780830818904365L;
-
-        ClassDefinitionException(final String className, final ClassLoader loader, final Exception cause) {
-            super("Could not define class '" + className + "' by the class loader: " + loader, cause);
-        }
-    }
-
-}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java
index 52c6ad5..df490db 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/EJBUtils.java
@@ -351,10 +351,9 @@
             .getGeneratedSerializableClassName(originalClass.getName());
         try {
             return loader.loadClass(generatedClassName);
-        } catch(ClassNotFoundException e) {
+        } catch (ClassNotFoundException e) {
             // Not loaded yet. Just continue
         }
-
         AsmSerializableBeanGenerator gen = new AsmSerializableBeanGenerator(loader, originalClass, generatedClassName);
         return gen.generateSerializableSubclass();
     }
@@ -443,25 +442,22 @@
         return java.security.AccessController.doPrivileged(action);
     }
 
-    public static void serializeObjectFields(
-                                             Object instance,
-                                             ObjectOutputStream oos)
-        throws IOException {
 
+    // warning: accessed by reflection (AsmSerializableBeanGenerator)
+    public static void serializeObjectFields(Object instance, ObjectOutputStream oos) throws IOException {
         serializeObjectFields(instance, oos, true);
     }
 
-    public static void serializeObjectFields(
-                                             Object instance,
-                                             ObjectOutputStream oos,
-                                             boolean usesSuperClass)
+
+    // warning: accessed by reflection (AsmSerializableBeanGenerator)
+    public static void serializeObjectFields(Object instance, ObjectOutputStream oos, boolean usesSuperClass)
         throws IOException {
 
         Class clazz = (usesSuperClass)? instance.getClass().getSuperclass() : instance.getClass();
         final ObjectOutputStream objOutStream = oos;
 
         // Write out list of fields eligible for serialization in sorted order.
-        for(Field next : getSerializationFields(clazz)) {
+        for (Field next : getSerializationFields(clazz)) {
 
             final Field nextField = next;
             final Object theInstance = instance;
@@ -489,41 +485,26 @@
                 }
 
                 objOutStream.writeObject(value);
-            } catch(Throwable t) {
-                if( _logger.isLoggable(FINE) ) {
-                    _logger.log(FINE, "=====> failed serializing field: " + nextField +
-                             " =====> of class: " + clazz + " =====> using: " + oos.getClass() +
-                             " =====> serializing value of type: " + ((value == null)? null : value.getClass().getName()) +
-                             " ===> Error: " + t);
-                    _logger.log(FINE, "", t);
+            } catch (Throwable t) {
+                if (_logger.isLoggable(FINE)) {
+                    _logger.log(FINE,
+                        "Failed serializing field: " + nextField + " of " + clazz
+                            + " using: " + oos.getClass() + " serializing value of type: "
+                            + (value == null ? null : value.getClass().getName()) + ", cause: " + t);
                 }
-                IOException ioe = new IOException();
-                Throwable cause = (t instanceof InvocationTargetException) ?
-                    ((InvocationTargetException)t).getCause() : t;
-                ioe.initCause( cause );
-                throw ioe;
+                throw new IOException(t instanceof InvocationTargetException ? t.getCause() : t);
             }
         }
     }
 
     // note: accessed by reflection!
-    public static void deserializeObjectFields(
-                                               Object instance,
-                                               ObjectInputStream ois)
-        throws IOException {
-
+    public static void deserializeObjectFields(Object instance, ObjectInputStream ois) throws IOException {
         deserializeObjectFields(instance, ois, null, true);
-
     }
 
     // note: accessed by reflection!
-    public static void deserializeObjectFields(
-                                               Object instance,
-                                               ObjectInputStream ois,
-                                               Object replaceValue,
-                                               boolean usesSuperClass)
-        throws IOException {
-
+    public static void deserializeObjectFields(Object instance, ObjectInputStream ois, Object replaceValue,
+        boolean usesSuperClass) throws IOException {
         Class clazz = (usesSuperClass)? instance.getClass().getSuperclass() : instance.getClass();
         if( _logger.isLoggable(FINE) ) {
             _logger.log(FINE, "=====> Deserializing class: " + clazz);
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java
index 44c4f02..4d27c32 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/base/io/EJBObjectOutputStreamHandler.java
@@ -32,12 +32,16 @@
 import javax.naming.NamingException;
 import java.io.IOException;
 import java.io.Serializable;
+import java.rmi.Remote;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.glassfish.enterprise.iiop.api.ProtocolManager;
 import org.glassfish.enterprise.iiop.api.GlassFishORBHelper;
 import org.glassfish.internal.api.Globals;
+
+import static com.sun.logging.LogDomains.EJB_LOGGER;
+
 import org.glassfish.api.naming.GlassfishNamingManager;
 
 import com.sun.enterprise.container.common.spi.util.GlassFishOutputStreamHandler;
@@ -48,21 +52,19 @@
  *
  * @author Mahesh Kannan
  */
-public class EJBObjectOutputStreamHandler
-    implements GlassFishOutputStreamHandler
-{
+public class EJBObjectOutputStreamHandler implements GlassFishOutputStreamHandler {
+
     static JavaEEIOUtils _javaEEIOUtils;
 
-    protected static final Logger _ejbLogger =
-            LogDomains.getLogger(EJBObjectOutputStreamHandler.class, LogDomains.EJB_LOGGER);
+    private static final Logger LOG = LogDomains.getLogger(EJBObjectOutputStreamHandler.class, EJB_LOGGER);
 
     static final int EJBID_OFFSET = 0;
     static final int INSTANCEKEYLEN_OFFSET = 8;
     static final int INSTANCEKEY_OFFSET = 12;
 
-    private static final byte HOME_KEY = (byte)0xff;
+    private static final byte HOME_KEY = (byte) 0xff;
 
-    //Ugly,
+    // FIXME: @JavaEEIOUtils is a Service, but this is really a bad thing!
     public static final void setJavaEEIOUtils(JavaEEIOUtils javaEEIOUtils) {
         _javaEEIOUtils = javaEEIOUtils;
     }
@@ -72,24 +74,21 @@
      * can be part of a bean's state. See EJB2.0 section 7.4.1.
      */
     @Override
-    public Object replaceObject(Object obj)
-            throws IOException {
+    public Object replaceObject(Object obj) throws IOException {
         Object result = obj;
 
         // Until we've identified a remote object, we can't assume the orb is
-        // available in the container.  If the orb is not present, this will be null.
+        // available in the container. If the orb is not present, this will be null.
         ProtocolManager protocolMgr = getProtocolManager();
 
         if (obj instanceof RemoteBusinessWrapperBase) {
-            result = getRemoteBusinessObjectFactory
-                    ((RemoteBusinessWrapperBase) obj);
+            result = getRemoteBusinessObjectFactory((RemoteBusinessWrapperBase) obj);
         } else if ((protocolMgr != null) && protocolMgr.isStub(obj) && protocolMgr.isLocal(obj)) {
             org.omg.CORBA.Object target = (org.omg.CORBA.Object) obj;
             // If we're here, it's always for the 2.x RemoteHome view.
             // There is no remote business wrapper class.
             result = getSerializableEJBReference(target, protocolMgr, null);
         }
-
         return result;
     }
 
@@ -104,75 +103,47 @@
         return orbHelper.isORBInitialized() ? orbHelper.getProtocolManager() : null;
     }
 
-    private Serializable getRemoteBusinessObjectFactory
-        (RemoteBusinessWrapperBase remoteBusinessWrapper)
+
+    private Serializable getRemoteBusinessObjectFactory(RemoteBusinessWrapperBase remoteBusinessWrapper)
         throws IOException {
         // Create a serializable object with the remote delegate and
         // the name of the client wrapper class.
-        org.omg.CORBA.Object target = (org.omg.CORBA.Object)
-            remoteBusinessWrapper.getStub();
-        return getSerializableEJBReference(target,
-                       getProtocolManager(),
-                      remoteBusinessWrapper.getBusinessInterfaceName());
+        org.omg.CORBA.Object target = (org.omg.CORBA.Object) remoteBusinessWrapper.getStub();
+        return getSerializableEJBReference(target, getProtocolManager(), remoteBusinessWrapper.getBusinessInterfaceName());
     }
 
-    private Serializable getSerializableEJBReference(org.omg.CORBA.Object obj,
-                             ProtocolManager protocolMgr,
-                             String remoteBusinessInterface)
-    throws IOException
-    {
-        Serializable result = (Serializable) obj;
+
+    private Serializable getSerializableEJBReference(
+        org.omg.CORBA.Object obj, ProtocolManager protocolMgr, String remoteBusinessInterface) throws IOException {
         try {
-
-
             byte[] oid = protocolMgr.getObjectID(obj);
-
-
-            if ((oid != null) && (oid.length > INSTANCEKEY_OFFSET)) {
+            if (oid != null && oid.length > INSTANCEKEY_OFFSET) {
                 long containerId = Utility.bytesToLong(oid, EJBID_OFFSET);
-                //To be really sure that is indeed a ref generated
+                // To be really sure that is indeed a ref generated
                 //  by our container we do the following checks
                 int keyLength = Utility.bytesToInt(oid, INSTANCEKEYLEN_OFFSET);
                 if (oid.length == keyLength + INSTANCEKEY_OFFSET) {
-                    boolean isHomeReference =
-                        ((keyLength == 1) && (oid[INSTANCEKEY_OFFSET] == HOME_KEY));
+                    boolean isHomeReference = keyLength == 1 && oid[INSTANCEKEY_OFFSET] == HOME_KEY;
                     if (isHomeReference) {
-                        result = new SerializableS1ASEJBHomeReference(containerId);
-                    } else {
-                        SerializableS1ASEJBObjectReference serRef =
-                            new SerializableS1ASEJBObjectReference(containerId,
-                            oid, keyLength, remoteBusinessInterface);
-                        result = serRef;
-                        /* TODO
-                        if (serRef.isHAEnabled()) {
-                            SimpleKeyGenerator gen = new SimpleKeyGenerator();
-                            Object key = gen.byteArrayToKey(oid, INSTANCEKEY_OFFSET, 20);
-                            long version = SFSBClientVersionManager.getClientVersion(
-                                    containerId, key);
-                            serRef.setSFSBClientVersion(key, version);
-                        } */
+                        return new SerializableS1ASEJBHomeReference(containerId);
                     }
+                    return new SerializableS1ASEJBObjectReference(containerId, oid, keyLength, remoteBusinessInterface);
                 }
             }
+            return (Serializable) obj;
         } catch (Exception ex) {
-            _ejbLogger.log(Level.WARNING, "Exception while getting serializable object", ex);
-            IOException ioEx = new IOException("Exception during extraction of instance key");
-            ioEx.initCause(ex);
-            throw ioEx;
+            LOG.log(Level.WARNING, "Exception while getting serializable object", ex);
+            throw new IOException("Exception during extraction of instance key", ex);
         }
-        return result;
     }
-
 }
 
-final class SerializableJNDIContext
-    implements SerializableObjectFactory
-{
+
+final class SerializableJNDIContext implements SerializableObjectFactory {
+
     private String name;
 
-    SerializableJNDIContext(Context ctx)
-        throws IOException
-    {
+    SerializableJNDIContext(Context ctx) throws IOException {
         try {
             // Serialize state for a jndi context.  The spec only requires
             // support for serializing contexts pointing to java:comp/env
@@ -183,127 +154,92 @@
             // throw an exception during deserialization.
             this.name = ctx.getNameInNamespace();
         } catch (NamingException ex) {
-            IOException ioe = new IOException();
-            ioe.initCause(ex);
-            throw ioe;
+            throw new IOException(ex);
         }
     }
 
+
     @Override
-    public Object createObject()
-        throws IOException
-    {
+    public Object createObject() throws IOException {
         try {
-            if ((name == null) || (name.length() == 0)) {
+            if (name == null || name.isEmpty()) {
                 return new InitialContext();
-            } else {
-                return Globals.getDefaultHabitat().<GlassfishNamingManager>getService(GlassfishNamingManager.class).restoreJavaCompEnvContext(name);
             }
-        } catch (NamingException namEx) {
-            IOException ioe = new IOException();
-            ioe.initCause(namEx);
-            throw ioe;
-    }
+            return Globals.getDefaultHabitat().<GlassfishNamingManager> getService(GlassfishNamingManager.class)
+                .restoreJavaCompEnvContext(name);
+        } catch (NamingException e) {
+            throw new IOException(e);
+        }
     }
 
 }
 
-abstract class AbstractSerializableS1ASEJBReference
-    implements SerializableObjectFactory
-{
+
+abstract class AbstractSerializableS1ASEJBReference implements SerializableObjectFactory {
+
+    protected static final Logger LOG = LogDomains.getLogger(AbstractSerializableS1ASEJBReference.class, EJB_LOGGER);
     protected long containerId;
-    protected String debugStr;    //used for loggin purpose only
 
 
-    protected static Logger _ejbLogger =
-       LogDomains.getLogger(AbstractSerializableS1ASEJBReference.class, LogDomains.EJB_LOGGER);
-
     AbstractSerializableS1ASEJBReference(long containerId) {
-    this.containerId = containerId;
-    BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
-
-    //container can be null if the app has been undeployed
-    //  after this was serialized
-    if (container == null) {
-        _ejbLogger.log(Level.WARNING, "ejb.base.io.EJBOutputStream.null_container: "
-        + containerId);
-        debugStr = "" + containerId;
-    } else {
-        debugStr = container.toString();
-    }
-    }
-
-
-    protected static java.rmi.Remote doRemoteRefClassLoaderConversion
-        (java.rmi.Remote reference) throws IOException {
-
-        Thread currentThread = Thread.currentThread();
-        ClassLoader contextClassLoader =
-            currentThread.getContextClassLoader();
-
-        java.rmi.Remote returnReference = reference;
-
-        if( reference.getClass().getClassLoader() !=
-            contextClassLoader) {
-            try {
-                byte[] serializedRef = EJBObjectOutputStreamHandler._javaEEIOUtils.serializeObject
-                    (reference, false);
-                returnReference = (java.rmi.Remote)
-                        EJBObjectOutputStreamHandler._javaEEIOUtils.deserializeObject(serializedRef, false,
-                                             contextClassLoader);
-                GlassFishORBHelper orbHelper = EjbContainerUtilImpl.getInstance().getORBHelper();
-                ProtocolManager protocolMgr = orbHelper.getProtocolManager();
-
-               protocolMgr.connectObject(returnReference);
-
-            } catch(IOException ioe) {
-                throw ioe;
-            } catch(Exception e) {
-                IOException ioEx = new IOException(e.getMessage());
-                ioEx.initCause(e);
-                throw ioEx;
-            }
+        this.containerId = containerId;
+        BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
+        // container can be null if the app has been undeployed after this was serialized
+        if (container == null) {
+            LOG.log(Level.WARNING, "ejb.base.io.null_container", containerId);
         }
+    }
 
-        return returnReference;
+
+    protected static java.rmi.Remote doRemoteRefClassLoaderConversion(final java.rmi.Remote reference) throws IOException {
+        ClassLoader contextClassLoader =  Thread.currentThread().getContextClassLoader();
+        if (contextClassLoader == reference.getClass().getClassLoader()) {
+            return reference;
+        }
+        try {
+            byte[] serializedRef = EJBObjectOutputStreamHandler._javaEEIOUtils.serializeObject(reference, false);
+            Remote returnReference = (java.rmi.Remote) EJBObjectOutputStreamHandler._javaEEIOUtils
+                .deserializeObject(serializedRef, false, contextClassLoader);
+            GlassFishORBHelper orbHelper = EjbContainerUtilImpl.getInstance().getORBHelper();
+            ProtocolManager protocolMgr = orbHelper.getProtocolManager();
+            protocolMgr.connectObject(returnReference);
+            return returnReference;
+        } catch (IOException ioe) {
+            throw ioe;
+        } catch (Exception e) {
+            throw new IOException(e.getMessage(), e);
+        }
     }
 }
 
-final class SerializableS1ASEJBHomeReference
-    extends AbstractSerializableS1ASEJBReference
-{
+
+final class SerializableS1ASEJBHomeReference extends AbstractSerializableS1ASEJBReference {
+
+    private static final long serialVersionUID = 1L;
 
     SerializableS1ASEJBHomeReference(long containerId) {
-    super(containerId);
+        super(containerId);
     }
 
     @Override
-    public Object createObject()
-        throws IOException
-    {
-        Object result = null;
+    public Object createObject() throws IOException {
         BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
         //container can be null if the app has been undeployed
         //  after this was serialized
         if (container == null) {
-            _ejbLogger.log(Level.WARNING, "ejb.base.io.EJBOutputStream.null_container "
-            + debugStr);
-            result = null;
-        } else {
-            // Note that we can assume it's a RemoteHome stub because an
-            // application never sees a reference to the internal
-            // Home for the Remote Business view.
-            result = AbstractSerializableS1ASEJBReference.
-                doRemoteRefClassLoaderConversion(container.getEJBHomeStub());
+            LOG.log(Level.WARNING, "ejb.base.io.null_container", containerId);
+            return null;
         }
-
-        return result;
+        // Note that we can assume it's a RemoteHome stub because an
+        // application never sees a reference to the internal
+        // Home for the Remote Business view.
+        return AbstractSerializableS1ASEJBReference.doRemoteRefClassLoaderConversion(container.getEJBHomeStub());
     }
 }
 
-final class SerializableS1ASEJBObjectReference
-    extends AbstractSerializableS1ASEJBReference
-{
+
+final class SerializableS1ASEJBObjectReference extends AbstractSerializableS1ASEJBReference {
+    private static final long serialVersionUID = 1L;
     private final byte[] instanceKey;
     private Object sfsbKey;
     private long sfsbClientVersion;
@@ -322,8 +258,7 @@
         }
         remoteBusinessInterface = remoteBusinessInterfaceName;
         instanceKey = new byte[keySize];
-        System.arraycopy(objKey, EJBObjectOutputStreamHandler.INSTANCEKEY_OFFSET,
-                instanceKey, 0, keySize);
+        System.arraycopy(objKey, EJBObjectOutputStreamHandler.INSTANCEKEY_OFFSET, instanceKey, 0, keySize);
     }
 
     void setSFSBClientVersion(Object key, long val) {
@@ -336,63 +271,30 @@
     }
 
     @Override
-    public Object createObject()
-        throws IOException
-    {
-        Object result = null;
+    public Object createObject() throws IOException {
         BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(containerId);
-        //container can be null if the app has been undeployed
-        //  after this was serialized
+        //container can be null if the app has been undeployed after this was serialized
         if (container == null) {
-            _ejbLogger.log(Level.WARNING,
-                               "ejb.base.io.EJBOutputStream.null_container: "
-                               + debugStr);
-            result = null;
-        } else {
-                try {
-                    if( remoteBusinessInterface == null ) {
-                        java.rmi.Remote reference = container.
-                            createRemoteReferenceWithId(instanceKey, null);
-                        result = AbstractSerializableS1ASEJBReference.
-                            doRemoteRefClassLoaderConversion(reference);
-
-                    } else {
-
-                        String generatedRemoteIntfName = RemoteGenerator.
-                            getGeneratedRemoteIntfName(remoteBusinessInterface);
-
-                        java.rmi.Remote remoteRef = container.
-                            createRemoteReferenceWithId(instanceKey,
-                                                        generatedRemoteIntfName);
-
-                        java.rmi.Remote newRemoteRef =
-                            AbstractSerializableS1ASEJBReference.
-                                doRemoteRefClassLoaderConversion(remoteRef);
-
-
-                        Thread currentThread = Thread.currentThread();
-                        ClassLoader contextClassLoader =
-                            currentThread.getContextClassLoader();
-
-                        result = EJBUtils.createRemoteBusinessObject
-                            (contextClassLoader, remoteBusinessInterface,
-                             newRemoteRef);
-
-                    }
-                    /*TODO
-                    if (haEnabled) {
-                        SFSBClientVersionManager.setClientVersion(
-                                containerId, sfsbKey, sfsbClientVersion);
-                    }*/
-                } catch(Exception e) {
-                    IOException ioex = new IOException("remote ref create error");
-                    ioex.initCause(e);
-                    throw ioex;
-                }
+            LOG.log(Level.WARNING, "ejb.base.io.null_container", containerId);
+            return null;
         }
+        try {
+            if (remoteBusinessInterface == null) {
+                java.rmi.Remote reference = container.createRemoteReferenceWithId(instanceKey, null);
+                return AbstractSerializableS1ASEJBReference.doRemoteRefClassLoaderConversion(reference);
+            }
+            String generatedRemoteIntfName = RemoteGenerator.getGeneratedRemoteIntfName(remoteBusinessInterface);
+            java.rmi.Remote remoteRef = container.createRemoteReferenceWithId(instanceKey, generatedRemoteIntfName);
+            java.rmi.Remote newRemoteRef = AbstractSerializableS1ASEJBReference
+                .doRemoteRefClassLoaderConversion(remoteRef);
 
-        return result;
+            ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+            return EJBUtils.createRemoteBusinessObject(contextClassLoader, remoteBusinessInterface, newRemoteRef);
+        } catch (Exception e) {
+            IOException ioex = new IOException("remote ref create error");
+            ioex.initCause(e);
+            throw ioex;
+        }
     }
 }
 
-
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java
index beaa51d..a184973 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/AsmSerializableBeanGenerator.java
@@ -17,8 +17,6 @@
 
 package com.sun.ejb.codegen;
 
-import com.sun.ejb.ClassGenerator;
-
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.security.AccessController;
@@ -40,11 +38,9 @@
 
     private static final int INTF_FLAGS = ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES;
 
-    private final Class baseClass;
-    private final String subclassName;
     private final ClassLoader loader;
-
-    private Class loadedClass;
+    private final Class<?> baseClass;
+    private final String subclassName;
 
 
     /**
@@ -70,9 +66,8 @@
         return subclassName;
     }
 
-    public Class generateSerializableSubclass()
-        throws Exception {
 
+    public Class generateSerializableSubclass() throws Exception {
         ClassWriter cw = new ClassWriter(INTF_FLAGS);
 
         //ClassVisitor tv = //(_debug)
@@ -93,9 +88,9 @@
         // JSR 299 added requirements that allow a single constructor to define
         // parameters injected by CDI.
 
-        Constructor[] ctors = baseClass.getConstructors();
-        Constructor ctorWithParams = null;
-        for(Constructor ctor : ctors) {
+        Constructor<?>[] ctors = baseClass.getConstructors();
+        Constructor<?> ctorWithParams = null;
+        for(Constructor<?> ctor : ctors) {
             if(ctor.getParameterTypes().length == 0) {
                 ctorWithParams = null;    //exists the no-arg ctor, use it
                 break;
@@ -107,26 +102,25 @@
         int numArgsToPass = 1; // default is 1 to just handle 'this'
         String paramTypeString = "()V";
 
-        if( ctorWithParams != null ) {
-            Class[] paramTypes = ctorWithParams.getParameterTypes();
+        if (ctorWithParams != null) {
+            Class<?>[] paramTypes = ctorWithParams.getParameterTypes();
             numArgsToPass = paramTypes.length + 1;
             paramTypeString = Type.getConstructorDescriptor(ctorWithParams);
         }
 
         MethodVisitor ctorv = tv.visitMethod(ACC_PUBLIC, "<init>", paramTypeString, null, null);
 
-        for(int i = 0; i < numArgsToPass; i++) {
+        for (int i = 0; i < numArgsToPass; i++) {
             ctorv.visitVarInsn(ALOAD, i);
         }
-
-        ctorv.visitMethodInsn(INVOKESPECIAL,  Type.getType(baseClass).getInternalName(), "<init>", paramTypeString);
+        ctorv.visitMethodInsn(INVOKESPECIAL,  Type.getType(baseClass).getInternalName(), "<init>", paramTypeString, false);
         ctorv.visitInsn(RETURN);
         ctorv.visitMaxs(numArgsToPass, numArgsToPass);
 
         MethodVisitor cv = cw.visitMethod(ACC_PRIVATE, "writeObject", "(Ljava/io/ObjectOutputStream;)V", null, new String[] { "java/io/IOException" });
         cv.visitVarInsn(ALOAD, 0);
         cv.visitVarInsn(ALOAD, 1);
-        cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "serializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectOutputStream;)V");
+        cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "serializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectOutputStream;)V", false);
         cv.visitInsn(RETURN);
         cv.visitMaxs(2, 2);
 
@@ -134,7 +128,7 @@
         cv = cw.visitMethod(ACC_PRIVATE, "readObject", "(Ljava/io/ObjectInputStream;)V", null, new String[] { "java/io/IOException", "java/lang/ClassNotFoundException" });
         cv.visitVarInsn(ALOAD, 0);
         cv.visitVarInsn(ALOAD, 1);
-        cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "deserializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V");
+        cv.visitMethodInsn(INVOKESTATIC, "com/sun/ejb/EJBUtils", "deserializeObjectFields", "(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V", false);
         cv.visitInsn(RETURN);
         cv.visitMaxs(2, 2);
 
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGenerator.java
new file mode 100644
index 0000000..14289c3
--- /dev/null
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/ClassGenerator.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.ejb.codegen;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.ProtectionDomain;
+import java.util.logging.Logger;
+
+import static java.util.logging.Level.CONFIG;
+
+/**
+ * This class serves to generate classes, which cannot be generated by the
+ * {@link java.lang.invoke.MethodHandles.Lookup} class, because it restricts
+ * the generated class to use an already existing class as a source of the package
+ * and {@link ProtectionDomain}.
+ * <p>
+ * Also {@link Proxy#newProxyInstance(ClassLoader, Class[], java.lang.reflect.InvocationHandler)}
+ * has another requirements, ie. all referred classes must be loadable by used classloader.
+ *
+ * @author David Matejcek
+ */
+public final class ClassGenerator {
+
+    private static final Logger LOG = Logger.getLogger(ClassGenerator.class.getName());
+    private static Method defineClassMethod;
+    private static Method defineClassMethodSM;
+
+    static {
+        try {
+            final PrivilegedExceptionAction<Void> action = () -> {
+                final Class<?> cl = Class.forName("java.lang.ClassLoader");
+                final String name = "defineClass";
+                defineClassMethod = cl.getDeclaredMethod(name, String.class, byte[].class, int.class, int.class);
+                defineClassMethod.setAccessible(true);
+                defineClassMethodSM = cl.getDeclaredMethod(
+                    name, String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
+                defineClassMethodSM.setAccessible(true);
+                return null;
+            };
+            AccessController.doPrivileged(action);
+            LOG.config("ClassLoader methods capable of generating classes were successfully detected.");
+        } catch (final Exception e) {
+            throw new Error("Could not initialize access to ClassLoader.defineClass method.", e);
+        }
+    }
+
+
+    private ClassGenerator() {
+        // hidden
+    }
+
+
+    /**
+     * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+     *
+     * @param loader the classloader instance used to generate the class
+     * @param className expected binary name or null
+     * @param classData the valid bytes that make up the class data.
+     * @return the new generated class
+     * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+     *             to the class generation
+     */
+    public static Class<?> defineClass(final ClassLoader loader, final String className, final byte[] classData)
+        throws ClassDefinitionException {
+        return defineClass(loader, className, classData, 0, classData.length);
+    }
+
+
+    /**
+     * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+     *
+     * @param loader the classloader instance used to generate the class
+     * @param className expected binary name or null
+     * @param classData the valid bytes that make up the class data.
+     * @param offset The start offset in {@code b} of the class data
+     * @param length The length of the class data
+     * @return the new generated class
+     * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+     *             to the class generation
+     */
+    public static Class<?> defineClass(
+        final ClassLoader loader, final String className,
+        final byte[] classData, final int offset, final int length) throws ClassDefinitionException {
+        LOG.log(CONFIG, "Defining class: {0} by loader: {1}", new Object[] {className, loader});
+        try {
+            return (Class<?>) defineClassMethod.invoke(loader, className, classData, 0, length);
+        } catch (final Exception | NoClassDefFoundError | ClassFormatError e) {
+            throw new ClassDefinitionException(className, loader, e);
+        }
+    }
+
+
+    /**
+     * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+     *
+     * @param loader the classloader instance used to generate the class
+     * @param className expected binary name or null
+     * @param classData the valid bytes that make up the class data.
+     * @param protectionDomain The {@code ProtectionDomain} of the class
+     * @return the new generated class
+     * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+     *             to the class generation
+     */
+    public static Class<?> defineClass(final ClassLoader loader, final String className, final byte[] classData,
+        final ProtectionDomain protectionDomain) throws ClassDefinitionException {
+        return defineClass(loader, className, classData, 0, classData.length, protectionDomain);
+    }
+
+
+    /**
+     * Calls the {@link ClassLoader}'s protected defineClass method to create a new class
+     *
+     * @param loader the classloader instance used to generate the class
+     * @param className expected binary name or null
+     * @param classData the valid bytes that make up the class data.
+     * @param offset The start offset in {@code b} of the class data
+     * @param length The length of the class data
+     * @param protectionDomain The {@code ProtectionDomain} of the class
+     * @return the new generated class
+     * @throws ClassDefinitionException invalid data, missing dependency, or another error related
+     *             to the class generation
+     */
+    public static Class<?> defineClass(
+        final ClassLoader loader, final String className,
+        final byte[] classData, final int offset, final int length,
+        final ProtectionDomain protectionDomain) throws ClassDefinitionException {
+        LOG.log(CONFIG, "Defining class: {0} by loader: {1}", new Object[] {className, loader});
+        try {
+            return (Class<?>) defineClassMethodSM.invoke(loader, className, classData, 0, length, protectionDomain);
+        } catch (final Exception | NoClassDefFoundError | ClassFormatError e) {
+            throw new ClassDefinitionException(className, loader, e);
+        }
+    }
+
+
+    /**
+     * The class wasn't generated. See the message and cause to see what happened.
+     */
+    public static class ClassDefinitionException extends RuntimeException {
+        private static final long serialVersionUID = -8955780830818904365L;
+
+        ClassDefinitionException(final String className, final ClassLoader loader, final Throwable cause) {
+            super("Could not define class '" + className + "' by the class loader: " + loader, cause);
+        }
+    }
+}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java
index 25e1822..862a30d 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/EjbOptionalIntfGenerator.java
@@ -17,7 +17,6 @@
 
 package com.sun.ejb.codegen;
 
-import com.sun.ejb.ClassGenerator;
 import com.sun.ejb.spi.container.OptionalLocalInterfaceProvider;
 import com.sun.enterprise.container.common.spi.util.IndirectlySerializable;
 import com.sun.enterprise.container.common.spi.util.SerializableObjectFactory;
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java
index a96940a..eee719a 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Generator.java
@@ -17,7 +17,6 @@
 
 package com.sun.ejb.codegen;
 
-import com.sun.ejb.ClassGenerator;
 import com.sun.enterprise.loader.ASURLClassLoader;
 
 import java.io.ByteArrayOutputStream;
@@ -138,14 +137,6 @@
     private boolean useMethodHandles() {
         // The bootstrap CL used by embedded glassfish doesn't remember generated classes
         // Further ClassLoader.findClass calls will fail.
-        System.out.println(
-            "loader: " + loader + "\n"
-            + "loader.parent: " + loader.getParent() + "\n"
-            + "system CL: " + ClassLoader.getSystemClassLoader() + "\n"
-            + "platform CL: " + ClassLoader.getPlatformClassLoader()
-        );
-
-
         if (loader.getParent() == null || loader.getClass() == ASURLClassLoader.class) {
             return false;
         }
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidBean.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidBean.java
deleted file mode 100644
index 1825148..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidBean.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2022 Contributors to the Eclipse Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.ejb.codegen;
-
-public class InvalidBean extends GeneratorException {
-
-    private static final long serialVersionUID = -4858134858891698917L;
-
-    /**
-     * Constructs the InvalidBean exception with the specified string.
-     */
-    public InvalidBean(String message) {
-        super(message);
-    }
-}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidHome.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidHome.java
deleted file mode 100644
index 6c7f3f0..0000000
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/InvalidHome.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2022 Contributors to the Eclipse Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package com.sun.ejb.codegen;
-
-public class InvalidHome extends GeneratorException {
-
-    private static final long serialVersionUID = -3827373233818420596L;
-
-    /**
-     * Constructs the InvalidHome exception with the specified string.
-     */
-    public InvalidHome(String message) {
-        super(message);
-    }
-}
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java
index c2c977d..2c3dae7 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/Remote30WrapperGenerator.java
@@ -38,8 +38,6 @@
 import java.rmi.RemoteException;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.logging.Logger;
-
 import org.glassfish.pfl.dynamic.codegen.spi.Expression;
 import org.glassfish.pfl.dynamic.codegen.spi.Type;
 import org.omg.CORBA.SystemException;
@@ -48,10 +46,13 @@
 import static java.lang.reflect.Modifier.PUBLIC;
 import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper.*;
 
+
+/**
+ * Generator of EJB 3.0+ Remote client stub implementations.
+ */
 public final class Remote30WrapperGenerator extends Generator {
 
-    private static final LocalStringManagerImpl localStrings = new LocalStringManagerImpl(Remote30WrapperGenerator.class);
-    private static final Logger LOG = Logger.getLogger(Remote30WrapperGenerator.class.getName());
+    private static final LocalStringManagerImpl I18N = new LocalStringManagerImpl(Remote30WrapperGenerator.class);
 
     private final String remoteInterfaceName;
     private final Class<?> businessInterface;
@@ -64,6 +65,7 @@
      * Adds _Wrapper to the original name.
      *
      * @param businessIntf full class name
+     * @return [businessIntf]_Wrapper
      */
     public static String getGeneratedRemoteWrapperName(final String businessIntf) {
         final String packageName = getPackageName(businessIntf);
@@ -91,7 +93,7 @@
         try {
             businessInterface = loader.loadClass(businessIntfName);
         } catch (final ClassNotFoundException ex) {
-            throw new InvalidBean(localStrings.getLocalString(
+            throw new GeneratorException(I18N.getLocalString(
                 "generator.remote_interface_not_found",
                 "Business interface " + businessIntfName + " not found "));
         }
@@ -107,7 +109,7 @@
 
         methodsToGenerate = removeRedundantMethods(businessInterface.getMethods());
 
-        // NOTE : no need to remove ejb object methods because EJBObject
+        // NOTE: no need to remove ejb object methods because EJBObject
         // is only visible through the RemoteHome view.
     }
 
@@ -148,16 +150,6 @@
         }
 
         _end();
-//
-//        try {
-//            Properties p = new Properties();
-//            p.put("Wrapper.DUMP_AFTER_SETUP_VISITOR", "true");
-//            p.put("Wrapper.TRACE_BYTE_CODE_GENERATION", "true");
-//            p.put("Wrapper.USE_ASM_VERIFIER", "true");
-//            _byteCode(loader, p);
-//        } catch(Exception e) {
-//            LOG.log(Level.WARNING, "Got exception when generating byte code", e);
-//        }
     }
 
 
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java
index 5a65ff4..3a7f5d2 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/codegen/RemoteGenerator.java
@@ -36,8 +36,7 @@
 import static org.glassfish.pfl.dynamic.codegen.spi.Wrapper._t;
 
 /**
- * This class is used to generate the RMI-IIOP version of a
- * remote business interface.
+ * This class is used to generate the RMI-IIOP version of a remote business interface.
  */
 public final class RemoteGenerator extends Generator {
 
@@ -69,14 +68,14 @@
      *
      * @param classLoader
      * @param businessIntf
-     * @throws InvalidBean if the businessInterface doesn't exist.
+     * @throws GeneratorException if the businessInterface doesn't exist.
      */
-    public RemoteGenerator(ClassLoader classLoader, String businessIntf) throws InvalidBean {
+    public RemoteGenerator(ClassLoader classLoader, String businessIntf) throws GeneratorException {
         super(classLoader);
         try {
             businessInterface = classLoader.loadClass(businessIntf);
         } catch (ClassNotFoundException ex) {
-            throw new InvalidBean(
+            throw new GeneratorException(
                 localStrings.getLocalString("generator.remote_interface_not_found", "Remote interface not found "));
         }
 
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java
index 3ea8e5c..426fa2b 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java
@@ -152,7 +152,6 @@
  * subclasses provide the remaining implementation of the container functionality.
  *
  */
-
 public abstract class BaseContainer implements Container, EjbContainerFacade, JavaEEContainer {
     public enum ContainerType {
         STATELESS, STATEFUL, SINGLETON, MESSAGE_DRIVEN, ENTITY, READ_ONLY
@@ -195,9 +194,7 @@
 
     protected static final Class[] NO_PARAMS = new Class[] {};
 
-    protected Object[] logParams = null;
-
-    protected ContainerType containerType;
+    protected final ContainerInfo containerInfo;
 
     // constants for EJB(Local)Home/EJB(Local)Object methods,
     // used in authorizeRemoteMethod and authorizeLocalMethod
@@ -230,19 +227,19 @@
     protected static final String SINGLETON_BEAN_POOL_PROP = "singleton-bean-pool";
 
     protected final ClassLoader loader;
-    protected Class ejbClass = null;
-    protected Class sfsbSerializedClass = null;
-    protected Method ejbPassivateMethod = null;
-    protected Method ejbActivateMethod = null;
-    protected Method ejbRemoveMethod = null;
-    private Method ejbTimeoutMethod = null;
+    protected Class<?> ejbClass;
+    protected Class sfsbSerializedClass;
+    protected Method ejbPassivateMethod;
+    protected Method ejbActivateMethod;
+    protected Method ejbRemoveMethod;
+    private Method ejbTimeoutMethod;
 
-    protected Class webServiceEndpointIntf = null;
+    protected Class webServiceEndpointIntf;
 
     // true if exposed as a web service endpoint.
-    protected boolean isWebServiceEndpoint = false;
+    protected boolean isWebServiceEndpoint;
 
-    private boolean isTimedObject_ = false;
+    private boolean isTimedObject_;
 
     /*****************************************
      * Data members for Local views *
@@ -250,15 +247,15 @@
 
     // True if bean has a LocalHome/Local view
     // OR a Local business view OR both.
-    protected boolean isLocal = false;
+    protected boolean isLocal;
 
     // True if bean exposes a local home view
-    protected boolean hasLocalHomeView = false;
+    protected boolean hasLocalHomeView;
 
     // True if bean exposes a local business view
-    protected boolean hasLocalBusinessView = false;
+    protected boolean hasLocalBusinessView;
 
-    protected boolean hasOptionalLocalBusinessView = false;
+    protected boolean hasOptionalLocalBusinessView;
 
     protected Class ejbGeneratedOptionalLocalBusinessIntfClass;
     //
@@ -266,10 +263,10 @@
     //
 
     // LocalHome interface written by developer
-    protected Class localHomeIntf = null;
+    protected Class localHomeIntf;
 
     // Local interface written by developer
-    private Class localIntf = null;
+    private Class localIntf;
 
     // Client reference to ejb local home
     protected EJBLocalHome ejbLocalHome;
@@ -284,8 +281,8 @@
 
     // Internal interface describing operation used to create an
     // instance of a local business object. (GenericEJBLocalHome)
-    protected Class localBusinessHomeIntf = null;
-    protected Class ejbOptionalLocalBusinessHomeIntf = null;
+    protected Class localBusinessHomeIntf;
+    protected Class ejbOptionalLocalBusinessHomeIntf;
 
     // Local business interface written by developer
     protected Set<Class> localBusinessIntfs = new HashSet();
@@ -303,7 +300,7 @@
     // Implementation of internal local business home interface.
     protected EJBLocalHomeImpl ejbOptionalLocalBusinessHomeImpl;
 
-    private Collection<EjbContainerInterceptor> interceptors = null;
+    private Collection<EjbContainerInterceptor> interceptors;
 
     /*****************************************
      * Data members for Remote views *
@@ -311,23 +308,23 @@
 
     // True if bean has a RemoteHome/Remote view
     // OR a Remote business view OR both.
-    protected boolean isRemote = false;
+    protected boolean isRemote;
 
     // True if bean exposes a RemoteHome view
-    protected boolean hasRemoteHomeView = false;
+    protected boolean hasRemoteHomeView;
 
     // True if bean exposes a Remote Business view.
-    protected boolean hasRemoteBusinessView = false;
+    protected boolean hasRemoteBusinessView;
 
     //
     // Data members for RemoteHome/Remote view
     //
 
     // Home interface written by developer.
-    protected Class homeIntf = null;
+    protected Class homeIntf;
 
     // Remote interface written by developer.
-    protected Class remoteIntf = null;
+    protected Class remoteIntf;
 
     // Container implementation of EJB Home. May or may not be the same
     // object as ejbHome, for example in the case of dynamic proxies.
@@ -344,7 +341,7 @@
     private Class ejbObjectProxyClass;
 
     // RemoteReference Factory for RemoteHome view
-    protected RemoteReferenceFactory remoteHomeRefFactory = null;
+    protected RemoteReferenceFactory remoteHomeRefFactory;
 
     //
     // Data members for 3.x Remote business view
@@ -376,7 +373,7 @@
     // END -- Data members for Remote views
     //
 
-    protected EJBMetaData metadata = null;
+    protected EJBMetaData metadata;
 
     protected final SecurityManager securityManager;
 
@@ -408,9 +405,9 @@
     protected InvocationInfo[] ejbIntfMethodInfo;
 
     protected Properties envProps;
-    protected boolean isBeanManagedTran = false;
+    protected boolean isBeanManagedTran;
 
-    protected boolean debugMonitorFlag = false;
+    protected boolean debugMonitorFlag;
 
     private static LocalStringManagerImpl localStrings = new LocalStringManagerImpl(BaseContainer.class);
 
@@ -425,7 +422,7 @@
     protected int containerState = CONTAINER_INITIALIZING;
 
     protected HashMap methodMonitorMap;
-    protected boolean monitorOn = false;
+    protected boolean monitorOn;
 
     protected EjbMonitoringStatsProvider ejbProbeListener;
     protected EjbMonitoringProbeProvider ejbProbeNotifier;
@@ -435,19 +432,16 @@
     protected EjbCacheProbeProvider cacheProbeNotifier;
     protected EjbCacheStatsProvider cacheProbeListener;
 
-    protected ContainerInfo containerInfo;
-
     private final String _debugDescription;
 
-    //protected Agent callFlowAgent;
-
     protected CallFlowInfo callFlowInfo;
 
     protected InterceptorManager interceptorManager;
 
     // the order must be the same as CallbackType and getPre30LifecycleMethodNames
-    private static final Class[] lifecycleCallbackAnnotationClasses = { AroundConstruct.class, PostConstruct.class, PreDestroy.class,
-        PrePassivate.class, PostActivate.class };
+    private static final Class[] lifecycleCallbackAnnotationClasses = {
+        AroundConstruct.class, PostConstruct.class, PreDestroy.class, PrePassivate.class, PostActivate.class
+    };
 
     private final Set<Class> monitoredGeneratedClasses = new HashSet<>();
 
@@ -479,10 +473,10 @@
 
     // Used to track whether we've done the base container cleanup (JNDI entries, etc.)
     // Only.  Not applicable to concrete containers.
-    private boolean baseContainerCleanupDone = false;
+    private boolean baseContainerCleanupDone;
 
     // True if there is at least one asynchronous method exposed from the bean.
-    private boolean hasAsynchronousInvocations = false;
+    private boolean hasAsynchronousInvocations;
 
     // Information about a web service ejb endpoint.  Used as a conduit
     // between webservice runtime and ejb container.  Contains a Remote
@@ -507,16 +501,12 @@
      */
     protected BaseContainer(final ContainerType type, final EjbDescriptor ejbDesc, final ClassLoader loader,
         final SecurityManager sm) throws Exception {
-        this.containerType = type;
+        this.ejbDescriptor = ejbDesc;
+        this.loader = loader;
         this.securityManager = sm;
+        this.containerInfo = createContainerInfo(type, ejbDesc);
 
         try {
-            this.loader = loader;
-            this.ejbDescriptor = ejbDesc;
-            //this.callFlowAgent = ejbContainerUtilImpl.getCallFlowAgent();
-
-            logParams = new Object[1];
-            logParams[0] = ejbDesc.getName();
             invocationManager = ejbContainerUtilImpl.getInvocationManager();
             injectionManager = ejbContainerUtilImpl.getInjectionManager();
             namingManager = ejbContainerUtilImpl.getGlassfishNamingManager();
@@ -653,13 +643,11 @@
             if (isStatelessSession || isSingleton) {
                 EjbBundleDescriptorImpl bundle = ejbDescriptor.getEjbBundleDescriptor();
                 WebServicesDescriptor webServices = bundle.getWebServices();
-                Collection endpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
+                Collection<?> endpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
                 // JSR 109 doesn't require support for a single ejb
                 // implementing multiple port ex.
                 if (endpoints.size() == 1) {
-
                     assertFullProfile("is a Web Service Endpoint");
-
                     webServiceEndpointIntf = loader.loadClass(ejbDescriptor.getWebServiceEndpointInterfaceName());
                     isWebServiceEndpoint = true;
                 }
@@ -696,9 +684,7 @@
                                 ejbClass.getName(), schd.getTimeoutMethod().getFormattedString()));
                     }
 
-                    if (_logger.isLoggable(Level.FINE)) {
-                        _logger.log(Level.FINE, "... processing " + method);
-                    }
+                    _logger.log(Level.FINE, "... processing {0}", method);
                     processEjbTimeoutMethod(method);
 
                     List<ScheduledTimerDescriptor> list = schedules.get(method);
@@ -748,7 +734,7 @@
 
             initEjbInterceptors();
         } catch (Exception ex) {
-            _logger.log(Level.FINE, "Exception creating BaseContainer : [{0}]", logParams);
+            _logger.log(Level.FINE, "Exception creating BaseContainer : [{0}]", containerInfo);
             _logger.log(Level.FINE, "", ex);
             throw ex;
         }
@@ -761,8 +747,8 @@
         return protocolMgr;
     }
 
-    public ContainerType getContainerType() {
-        return containerType;
+    public ContainerInfo getContainerInfo() {
+        return this.containerInfo;
     }
 
     protected void doEJBHomeRemove(Object pk, Method m, boolean isLocal) throws RemoteException, RemoveException {
@@ -1026,12 +1012,11 @@
                     }
                 });
             }
-            java.rmi.Remote remoteRef = null;
+            final java.rmi.Remote remoteRef;
             if (generatedRemoteBusinessIntf == null) {
                 remoteRef = remoteHomeRefFactory.createRemoteReference(instanceKey);
             } else {
                 RemoteReferenceFactory remoteBusinessRefFactory = remoteBusinessIntfInfo.get(generatedRemoteBusinessIntf).referenceFactory;
-
                 remoteRef = remoteBusinessRefFactory.createRemoteReference(instanceKey);
             }
             return remoteRef;
@@ -1073,14 +1058,12 @@
 
             EjbBundleDescriptorImpl bundle = ejbDescriptor.getEjbBundleDescriptor();
             WebServicesDescriptor webServices = bundle.getWebServices();
-            Collection myEndpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
+            Collection<WebServiceEndpoint> myEndpoints = webServices.getEndpointsImplementedBy(ejbDescriptor);
 
             // An ejb can only be exposed through 1 web service endpoint
-            Iterator iter = myEndpoints.iterator();
-            webServiceEndpoint = (com.sun.enterprise.deployment.WebServiceEndpoint) iter.next();
+            webServiceEndpoint = myEndpoints.iterator().next();
 
-            Class serviceEndpointIntfClass = loader.loadClass(webServiceEndpoint.getServiceEndpointInterface());
-
+            Class<?> serviceEndpointIntfClass = loader.loadClass(webServiceEndpoint.getServiceEndpointInterface());
             if (!serviceEndpointIntfClass.isInterface()) {
                 serviceEndpointIntfClass = EJBUtils.generateSEI(loader, ejbClass);
                 if (serviceEndpointIntfClass == null) {
@@ -1089,7 +1072,7 @@
                 }
             }
 
-            Class tieClass = null;
+            Class<?> tieClass = null;
 
             WebServiceInvocationHandler invocationHandler = new WebServiceInvocationHandler(ejbClass, webServiceEndpoint,
                 serviceEndpointIntfClass, ejbContainerUtilImpl, webServiceInvocationInfoMap);
@@ -1102,16 +1085,13 @@
                 tieClass = loader.loadClass(webServiceEndpoint.getTieClassName());
             }
 
-            // Create a facade for container services to be used by web services runtime.
-            EjbEndpointFacade endpointFacade = new EjbEndpointFacadeImpl(this, ejbContainerUtilImpl);
-
             wsejbEndpointRegistry = Globals.getDefaultHabitat().getService(WSEjbEndpointRegistry.class);
-            if (wsejbEndpointRegistry != null) {
-                wsejbEndpointRegistry.registerEndpoint(webServiceEndpoint, endpointFacade, servant, tieClass);
-            } else {
+            if (wsejbEndpointRegistry == null) {
                 throw new DeploymentException(localStrings.getLocalString("ejb.no_webservices_module",
                     "EJB-based Webservice endpoint is detected but there is no webservices module installed to handle it"));
             }
+            EjbEndpointFacade endpointFacade = new EjbEndpointFacadeImpl(this, ejbContainerUtilImpl);
+            wsejbEndpointRegistry.registerEndpoint(webServiceEndpoint, endpointFacade, servant, tieClass);
         }
 
         Map<String, Object> intfsForPortableJndi = new HashMap<>();
@@ -1794,7 +1774,7 @@
             }
 
         } catch (Exception ex) {
-            _logger.log(Level.FINE, "Exception while running pre-invoke : ejbName = [{0}]", logParams);
+            _logger.log(Level.FINE, "Exception while running pre-invoke : ejb: [{0}]", containerInfo);
             _logger.log(Level.FINE, "", ex);
 
             EJBException ejbEx;
@@ -2433,7 +2413,7 @@
                     // be released.
 
                 } catch (EJBException e) {
-                    _logger.log(Level.WARNING, CONTEXT_FAILURE_JACC, logParams[0]);
+                    _logger.log(Level.WARNING, CONTEXT_FAILURE_JACC, containerInfo);
                     _logger.log(Level.WARNING, "", e);
                 }
 
@@ -2956,7 +2936,7 @@
                 if (initMethod != null) {
                     invInfo.targetMethod1 = initMethod;
                 } else {
-                    Object[] params = { logParams[0], (isLocal ? "LocalHome" : "Home"), invInfo.method.toString() };
+                    Object[] params = { containerInfo, (isLocal ? "LocalHome" : "Home"), invInfo.method.toString() };
                     _logger.log(Level.WARNING, BEAN_CLASS_METHOD_NOT_FOUND, params);
                     // Treat this as a warning instead of a fatal error.
                     // That matches the behavior of the generated code.
@@ -3005,7 +2985,7 @@
             }
 
         } catch (NoSuchMethodException nsme) {
-            Object[] params = { logParams[0] + ":" + nsme.toString(), (isLocal ? "Local" : "Remote"), invInfo.method.toString() };
+            Object[] params = { containerInfo + ":" + nsme.toString(), (isLocal ? "Local" : "Remote"), invInfo.method.toString() };
             _logger.log(Level.WARNING, BEAN_CLASS_METHOD_NOT_FOUND, params);
             // Treat this as a warning instead of a fatal error.
             // That matches the behavior of the generated code.
@@ -3920,7 +3900,7 @@
                     }
 
                 } catch (Exception ex) {
-                    _logger.log(Level.FINE, "Exception during undeploy", logParams);
+                    _logger.log(Level.FINE, "Exception during undeploy {0}", containerInfo);
                     _logger.log(Level.FINE, "", ex);
                 }
             }
@@ -3928,7 +3908,7 @@
             try {
                 ejbContainerUtilImpl.getComponentEnvManager().unbindFromComponentNamespace(ejbDescriptor);
             } catch (javax.naming.NamingException namEx) {
-                _logger.log(Level.FINE, "Exception during undeploy", logParams);
+                _logger.log(Level.FINE, "Exception during undeploy: {0}", containerInfo);
                 _logger.log(Level.FINE, "", namEx);
             }
 
@@ -4267,45 +4247,46 @@
     protected abstract EjbMonitoringStatsProvider getMonitoringStatsProvider(String appName, String modName, String ejbName);
 
     protected void createMonitoringRegistry() {
-        String appName = null;
-        String modName = null;
-        String ejbName = null;
         boolean isMonitorRegistryMediatorCreated = false;
         try {
-            appName = (ejbDescriptor.getApplication().isVirtual()) ? null : ejbDescriptor.getApplication().getRegistrationName();
-            if (appName == null) {
-                modName = ejbDescriptor.getApplication().getRegistrationName();
-            } else {
-                String archiveuri = ejbDescriptor.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri();
-                modName = com.sun.enterprise.util.io.FileUtils.makeFriendlyFilename(archiveuri);
-            }
-            ejbName = ejbDescriptor.getName();
-            containerInfo = new ContainerInfo(appName, modName, ejbName);
-
             isMonitorRegistryMediatorCreated = true;
-            registerEjbMonitoringProbeProvider(appName, modName, ejbName);
-            ejbProbeListener = getMonitoringStatsProvider(appName, modName, ejbName);
-            ejbProbeListener.addMethods(getContainerId(), appName, modName, ejbName, getMonitoringMethodsArray());
+            registerEjbMonitoringProbeProvider();
+            ejbProbeListener = getMonitoringStatsProvider(containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
+            ejbProbeListener.addMethods(getContainerId(), containerInfo.appName, containerInfo.modName, containerInfo.ejbName, getMonitoringMethodsArray());
             ejbProbeListener.register();
 
             if (_logger.isLoggable(Level.FINE)) {
                 _logger.log(Level.FINE,
-                    "Created MonitoringRegistry: " + EjbMonitoringUtils.getDetailedLoggingName(appName, modName, ejbName));
+                    "Created MonitoringRegistry: " + EjbMonitoringUtils.getDetailedLoggingName(containerInfo.appName, containerInfo.modName, containerInfo.ejbName));
             }
         } catch (Exception ex) {
             _logger.log(Level.SEVERE, COULD_NOT_CREATE_MONITORREGISTRYMEDIATOR,
-                new Object[] { EjbMonitoringUtils.getDetailedLoggingName(appName, modName, ejbName), ex });
+                new Object[] { EjbMonitoringUtils.getDetailedLoggingName(containerInfo.appName, containerInfo.modName, containerInfo.ejbName), ex });
             if (!isMonitorRegistryMediatorCreated) {
-                registerEjbMonitoringProbeProvider(appName, modName, ejbName);
+                registerEjbMonitoringProbeProvider();
             }
         }
     }
 
-    private void registerEjbMonitoringProbeProvider(String appName, String modName, String ejbName) {
+    private static ContainerInfo createContainerInfo(final ContainerType type, final EjbDescriptor ejbDescriptor) {
+        final String appName = ejbDescriptor.getApplication().isVirtual() ? null
+            : ejbDescriptor.getApplication().getRegistrationName();
+        final String modName;
+        if (appName == null) {
+            modName = ejbDescriptor.getApplication().getRegistrationName();
+        } else {
+            String archiveuri = ejbDescriptor.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri();
+            modName = com.sun.enterprise.util.io.FileUtils.makeFriendlyFilename(archiveuri);
+        }
+        return new ContainerInfo(type, appName, modName, ejbDescriptor.getName());
+    }
+
+    private void registerEjbMonitoringProbeProvider() {
         // Always create to avoid NPE
         try {
             ProbeProviderFactory probeFactory = ejbContainerUtilImpl.getProbeProviderFactory();
-            String invokerId = EjbMonitoringUtils.getInvokerId(appName, modName, ejbName);
+            String invokerId = EjbMonitoringUtils.getInvokerId(
+                containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
             ejbProbeNotifier = probeFactory.getProbeProvider(EjbMonitoringProbeProvider.class, invokerId);
             if (_logger.isLoggable(Level.FINE)) {
                 _logger.log(Level.FINE, "Got ProbeProvider: " + ejbProbeNotifier.getClass().getName());
@@ -4464,38 +4445,46 @@
     }
 
     /**
-     * PreInvokeException is used to wrap exceptions thrown from BaseContainer.preInvoke, so it indicates that the bean's method will
-     * not be called.
+     * PreInvokeException is used to wrap exceptions thrown from BaseContainer.preInvoke,
+     * so it indicates that the bean's method will not be called.
      */
     public final static class PreInvokeException extends EJBException {
-
         Exception exception;
 
         public PreInvokeException(Exception ex) {
             this.exception = ex;
         }
-    } //PreInvokeException{}
+    }
 
     /**
-     * Strings for monitoring info
+     * Informations about this container.
      */
     public static final class ContainerInfo {
-        public String appName;
-        public String modName;
-        public String ejbName;
+        public final String appName;
+        public final String modName;
+        public final String ejbName;
+        public final ContainerType type;
 
-        ContainerInfo(String appName, String modName, String ejbName) {
+        ContainerInfo(ContainerType type, String appName, String modName, String ejbName) {
+            this.type = type;
             this.appName = appName;
             this.modName = modName;
             this.ejbName = ejbName;
         }
-    } //ContainerInfo
+
+        @Override
+        public String toString() {
+            return new StringBuilder(64).append(appName).append('_').append(this.modName).append('_')
+                .append(this.ejbName).append('(').append(this.type).append(')').toString();
+        }
+    }
 
     private static class BeanContext {
         ClassLoader previousClassLoader;
         boolean classLoaderSwitched;
     }
-} //BaseContainer{}
+
+} // BaseContainer class
 
 final class CallFlowInfoImpl implements CallFlowInfo {
 
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java
index f17efe9..8efa71d 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeImpl.java
@@ -107,6 +107,7 @@
      * This is the implementation of the jakarta.ejb.EJBHome remove method.
      * @exception RemoveException on error during removal
      */
+    @Override
     public final void remove(Handle handle)
         throws RemoteException, RemoveException
     {
@@ -130,10 +131,11 @@
      * This is the implementation of the jakarta.ejb.EJBHome remove method.
      * @exception RemoveException on error during removal
      */
+    @Override
     public final void remove(Object primaryKey)
         throws RemoteException, RemoveException
     {
-        if (container.getContainerType() != BaseContainer.ContainerType.ENTITY) {
+        if (container.getContainerInfo().type != BaseContainer.ContainerType.ENTITY) {
             // Session beans dont have primary keys. EJB2.0 Section 6.6
             throw new RemoveException("Invalid remove operation.");
         }
@@ -155,6 +157,7 @@
     /**
      * This is the implementation of the jakarta.ejb.EJBHome method.
      */
+    @Override
     public final EJBMetaData getEJBMetaData()
         throws RemoteException
     {
@@ -167,6 +170,7 @@
      * This is the implementation of the jakarta.ejb.EJBHome getHomeHandle
      * method.
      */
+    @Override
     public final HomeHandle getHomeHandle()
         throws RemoteException
     {
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java
index ecc02f5..918f301 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBHomeInvocationHandler.java
@@ -56,7 +56,7 @@
     // but only has InvocationHandler.
     private EJBHome proxy_;
 
-    private Class homeIntfClass_;
+    private final Class homeIntfClass_;
 
     // Cache reference to invocation info.  There is one of these per
     // container.  It's populated during container initialization and
@@ -65,7 +65,7 @@
     // is created.
     private MethodMap invocationInfoMap_;
 
-    private EjbContainerUtil ejbContainerUtil = EjbContainerUtilImpl.getInstance();
+    private final EjbContainerUtil ejbContainerUtil = EjbContainerUtilImpl.getInstance();
 
 
     protected EJBHomeInvocationHandler(EjbDescriptor ejbDescriptor,
@@ -93,6 +93,7 @@
         invocationInfoMap_ = map;
     }
 
+    @Override
     protected EJBHome getEJBHome() {
         return proxy_;
     }
@@ -100,6 +101,7 @@
     /**
      * Called by EJBHome proxy.
      */
+    @Override
     public Object invoke(Object proxy, Method method, Object[] args)
         throws Throwable {
 
@@ -119,17 +121,14 @@
             // proceeding. Otherwise, the context classloader could still
             // reflect the caller's class loader.
 
-            if( Thread.currentThread().getContextClassLoader() !=
-                getContainer().getClassLoader() ) {
-                originalClassLoader = Utility.setContextClassLoader
-                    (getContainer().getClassLoader());
+            if (Thread.currentThread().getContextClassLoader() != getContainer().getClassLoader()) {
+                originalClassLoader = Utility.setContextClassLoader(getContainer().getClassLoader());
             }
 
             Class methodClass = method.getDeclaringClass();
 
-            if( methodClass == java.lang.Object.class )  {
-                return InvocationHandlerUtil.invokeJavaObjectMethod
-                    (this, method, args);
+            if (methodClass == java.lang.Object.class) {
+                return InvocationHandlerUtil.invokeJavaObjectMethod(this, method, args);
             } else if (invokeSpecialEJBHomeMethod(method, methodClass, args)) {
                 return null;
             }
@@ -236,7 +235,7 @@
                 inv.invocationInfo = invInfo;
 
                 if( ejbObjectImpl != null && invInfo.startsWithCreate ) {
-                    inv.ejbObject = (EJBLocalRemoteObject) ejbObjectImpl;
+                    inv.ejbObject = ejbObjectImpl;
                 }
 
                 BaseContainer container = (BaseContainer) getContainer();
@@ -335,24 +334,24 @@
         try {
             if( methodName.equals("getEJBMetaData") ) {
 
-                methodIndex = container.EJBHome_getEJBMetaData;
+                methodIndex = BaseContainer.EJBHome_getEJBMetaData;
                 container.onEjbMethodStart(methodIndex);
                 returnValue = super.getEJBMetaData();
 
             } else if( methodName.equals("getHomeHandle") ) {
 
-                methodIndex = container.EJBHome_getHomeHandle;
+                methodIndex = BaseContainer.EJBHome_getHomeHandle;
                 container.onEjbMethodStart(methodIndex);
                 returnValue = super.getHomeHandle();
 
             } else if( methodName.equals("remove") ) {
 
                 if( args[0] instanceof jakarta.ejb.Handle ) {
-                    methodIndex = container.EJBHome_remove_Handle;
+                    methodIndex = BaseContainer.EJBHome_remove_Handle;
                     container.onEjbMethodStart(methodIndex);
                     super.remove((jakarta.ejb.Handle)args[0]);
                 } else {
-                    methodIndex = container.EJBHome_remove_Pkey;
+                    methodIndex = BaseContainer.EJBHome_remove_Pkey;
                     container.onEjbMethodStart(methodIndex);
                     super.remove(args[0]);
                 }
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java
index 905cab1..071912a 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EJBLocalHomeImpl.java
@@ -95,10 +95,11 @@
     /**
      * This is the implementation of the jakarta.ejb.EJBLocalHome remove method.
      */
+    @Override
     public final void remove(Object primaryKey)
         throws RemoveException, EJBException
     {
-        if (container.getContainerType() != BaseContainer.ContainerType.ENTITY) {
+        if (container.getContainerInfo().type != BaseContainer.ContainerType.ENTITY) {
             // Session beans dont have primary keys. EJB2.0 Section 6.6.
             throw new RemoveException("Attempt to call remove(Object primaryKey) on a session bean.");
         }
@@ -119,12 +120,11 @@
             // This should never be thrown for local invocations, but it's
             // part of the removeBean signature.  If for some strange
             // reason it happens, convert to EJBException
-            EJBException ejbEx =new EJBException("unexpected RemoteException");
-            ejbEx.initCause(re);
-            throw ejbEx;
+            throw new EJBException("unexpected RemoteException", re);
         }
     }
 
+    @Override
     public SerializableObjectFactory getSerializableObjectFactory() {
         return new SerializableLocalHome(
             container.getEjbDescriptor().getUniqueId());
@@ -133,12 +133,13 @@
     public static final class SerializableLocalHome
         implements SerializableObjectFactory
     {
-        private long ejbId;
+        private final long ejbId;
 
         public SerializableLocalHome(long uniqueId) {
             this.ejbId = uniqueId;
         }
 
+        @Override
         public Object createObject()
             throws IOException
         {
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java
index 271d11f..274480b 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/EjbEndpointFacadeImpl.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -30,30 +31,36 @@
 import java.util.logging.Logger;
 
 
-/*
+/**
+ * A facade for container services to be used by web services runtime.
+ *
  * @author Kenneth Saks
  */
-
 public class EjbEndpointFacadeImpl implements EjbEndpointFacade {
 
-    private BaseContainer container_;
-    private InvocationManager invManager_;
-    private static Logger logger_ = EjbContainerUtilImpl.getLogger();
+    private static final Logger LOG = EjbContainerUtilImpl.getLogger();
+    private final BaseContainer container;
+    private final InvocationManager invocationManager;
 
-
+    /**
+     * Creates a facade for container services to be used by web services runtime.
+     *
+     * @param container
+     * @param util
+     */
     public EjbEndpointFacadeImpl(BaseContainer container, EjbContainerUtil util) {
-        container_ = container;
-        invManager_ = util.getInvocationManager();
+        this.container = container;
+        this.invocationManager = util.getInvocationManager();
     }
 
 
+    @Override
     public ClassLoader getEndpointClassLoader() {
-
-        return container_.getClassLoader();
-
+        return container.getClassLoader();
     }
 
 
+    @Override
     public ComponentInvocation startInvocation() {
 
         // We need to split the preInvoke tasks into stages since handlers
@@ -61,29 +68,23 @@
         // place before handlers are run.  Note that the application
         // classloader was set much earlier when the invocation first arrived
         // so we don't need to set it here.
-        EjbInvocation inv = container_.createEjbInvocation();
+        EjbInvocation inv = container.createEjbInvocation();
 
         // Do the portions of preInvoke that don't need a Method object.
         inv.isWebService = true;
-        inv.container = container_;
+        inv.container = container;
         inv.transactionAttribute = Container.TX_NOT_INITIALIZED;
 
-        // AS per latest spec change, the MessageContext object in WebSvcCtxt
-        // should be the same one as used in the ejb's interceptors'
-        // TODO
-        // inv.setContextData(wsCtxt);
-
         // In all cases, the WebServiceInvocationHandler will do the
         // remaining preInvoke tasks : getContext, preInvokeTx, etc.
-        invManager_.preInvoke(inv);
-
+        invocationManager.preInvoke(inv);
         return inv;
 
     }
 
 
+    @Override
     public void endInvocation(ComponentInvocation inv) {
-
         try {
             EjbInvocation ejbInv = (EjbInvocation) inv;
 
@@ -96,19 +97,13 @@
             // and WebServiceInvocationHandler rather than change the
             // behavior of BaseContainer.preInvoke and
             // BaseContainer.postInvoke.
-
-
-            if( ejbInv.ejb != null ) {
-                container_.webServicePostInvoke(ejbInv);
+            if (ejbInv.ejb == null) {
+                invocationManager.postInvoke(inv);
             } else {
-                invManager_.postInvoke(inv);
+                container.webServicePostInvoke(ejbInv);
             }
-
-        } catch(Throwable t) {
-            logger_.log(Level.WARNING,
-                       "Unexpected error in EJB WebService endpoint post processing", t);
+        } catch (Throwable t) {
+            LOG.log(Level.WARNING, "Unexpected error in EJB WebService endpoint post processing", t);
         }
-
     }
-
 }
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java
index 1a12569..e353d03 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessObjectFactory.java
@@ -30,26 +30,13 @@
 
 public class RemoteBusinessObjectFactory implements ObjectFactory {
 
-
-
-    public Object getObjectInstance(Object obj,
-                    Name name,
-                    Context nameCtx,
-                    Hashtable env) throws Exception
-    {
-
-    InitialContext ic = new InitialContext(env);
-
-    Reference ref = (Reference) obj;
-
-    RefAddr refAddr = ref.get("url");
-
-    Object genericRemoteHomeObj = ic.lookup((String) refAddr.getContent());
-
-    String busInterface = ref.getClassName();
-
-    return EJBUtils.lookupRemote30BusinessObject(genericRemoteHomeObj,
-                                                     busInterface);
+    @Override
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env) throws Exception {
+        InitialContext ic = new InitialContext(env);
+        Reference ref = (Reference) obj;
+        RefAddr refAddr = ref.get("url");
+        Object genericRemoteHomeObj = ic.lookup((String) refAddr.getContent());
+        String busInterface = ref.getClassName();
+        return EJBUtils.lookupRemote30BusinessObject(genericRemoteHomeObj, busInterface);
     }
-
 }
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java
index df70245..fe6c8bc 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/RemoteBusinessWrapperBase.java
@@ -25,10 +25,9 @@
 
 import com.sun.ejb.EJBUtils;
 
-public class RemoteBusinessWrapperBase
-    implements java.io.Serializable {
+public class RemoteBusinessWrapperBase implements java.io.Serializable {
 
-    // This is the name of the developer-written business interface.
+    /** This is the name of the developer-written business interface. */
     private String businessInterface_;
 
     private Remote stub_;
@@ -41,16 +40,20 @@
         this.hashCode_ = busIntf.hashCode();
     }
 
+
     public Remote getStub() {
         return stub_;
     }
 
+
+    @Override
     public int hashCode() {
         return hashCode_;
     }
 
-    public boolean equals(Object obj) {
 
+    @Override
+    public boolean equals(Object obj) {
         boolean result = (obj == this); //Most efficient
         if ((result == false) && (obj != null)) { //Do elaborate checks
             if (obj instanceof RemoteBusinessWrapperBase) {
@@ -70,59 +73,45 @@
         return result;
     }
 
+
     public String getBusinessInterfaceName() {
         return businessInterface_;
     }
 
+
     public Object writeReplace() throws ObjectStreamException {
         return new RemoteBusinessWrapperBase(stub_, businessInterface_);
     }
 
-    private void writeObject(java.io.ObjectOutputStream oos)
-        throws java.io.IOException
-    {
 
+    private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException {
         oos.writeObject(businessInterface_);
         oos.writeObject(stub_);
-
     }
 
-    private void readObject(ObjectInputStream ois)
-        throws IOException, ClassNotFoundException {
 
+    private void readObject(ObjectInputStream ois) throws IOException {
         try {
-
             businessInterface_ = (String) ois.readObject();
             hashCode_ = businessInterface_.hashCode();
 
             EJBUtils.loadGeneratedRemoteBusinessClasses(businessInterface_);
 
             stub_ = (Remote) ois.readObject();
-
-        } catch(Exception e) {
-            IOException ioe = new IOException("RemoteBusinessWrapper.readObj "
-                                              + " error");
-            ioe.initCause(e);
-            throw ioe;
+        } catch (Exception e) {
+            throw new IOException("RemoteBusinessWrapper.readObj error", e);
         }
     }
 
+
     public Object readResolve() throws ObjectStreamException {
-
         try {
-
-            return EJBUtils.createRemoteBusinessObject(businessInterface_,
-                                                       stub_);
-        } catch(Exception e) {
-            WriteAbortedException wae = new WriteAbortedException
-                ("RemoteBusinessWrapper.readResolve error", e);
+            return EJBUtils.createRemoteBusinessObject(businessInterface_, stub_);
+        } catch (Exception e) {
+            WriteAbortedException wae = new WriteAbortedException("RemoteBusinessWrapper.readResolve error", e);
             throw wae;
         }
 
     }
-
-
-
-
 }
 
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java
index 8927b90..5000e92 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatefulSessionContainer.java
@@ -263,8 +263,8 @@
     private final static long CONCURRENCY_NOT_ALLOWED = 0;
     private final static long BLOCK_INDEFINITELY = -1;
 
-    private ArrayList passivationCandidates = new ArrayList();
-    private Object asyncTaskSemaphore = new Object();
+    private final ArrayList passivationCandidates = new ArrayList();
+    private final Object asyncTaskSemaphore = new Object();
 
 
     private int asyncTaskCount = 0;
@@ -278,21 +278,21 @@
     private LruSessionCache sessionBeanCache;
     private BackingStore<Serializable, SimpleMetadata> backingStore;
     private SFSBUUIDUtil uuidGenerator;
-    private ArrayList scheduledTimerTasks = new ArrayList();
+    private final ArrayList scheduledTimerTasks = new ArrayList();
 
     private int statMethodReadyCount = 0;
 
-    private Level TRACE_LEVEL = Level.FINE;
+    private final Level TRACE_LEVEL = Level.FINE;
 
-    private String ejbName;
+    private final String ejbName;
 
     private boolean isHAEnabled;
     private int removalGracePeriodInSeconds;
 
-    private InvocationInfo postConstructInvInfo;
-    private InvocationInfo preDestroyInvInfo;
-    private InvocationInfo postActivateInvInfo;
-    private InvocationInfo prePassivateInvInfo;
+    private final InvocationInfo postConstructInvInfo;
+    private final InvocationInfo preDestroyInvInfo;
+    private final InvocationInfo postActivateInvInfo;
+    private final InvocationInfo prePassivateInvInfo;
 
     private StatefulSessionStoreMonitor sfsbStoreMonitor;
 
@@ -303,7 +303,7 @@
     private Method afterBeginMethod;
     private Method beforeCompletionMethod;
     private Method afterCompletionMethod;
-    private boolean isPassivationCapable;
+    private final boolean isPassivationCapable;
 
     /*
      * Cache for keeping ref count for shared extended entity manager.
@@ -311,10 +311,10 @@
      */
 
     private static final Map<EntityManager, EEMRefInfo> extendedEMReferenceCountMap
-            = new HashMap<EntityManager, EEMRefInfo>();
+            = new HashMap<>();
 
     private static final Map<EEMRefInfoKey, EntityManager> eemKey2EEMMap
-            = new HashMap<EEMRefInfoKey, EntityManager>();
+            = new HashMap<>();
 
     /**
      * This constructor is called from the JarManager when a Jar is deployed.
@@ -346,6 +346,7 @@
         isPassivationCapable = sfulDesc.isPassivationCapable();
     }
 
+    @Override
     public boolean isPassivationCapable() {
         return isPassivationCapable;
     }
@@ -361,6 +362,7 @@
         return inv;
     }
 
+    @Override
     protected void initializeHome()
             throws Exception {
         super.initializeHome();
@@ -427,6 +429,7 @@
 
         java.security.AccessController.doPrivileged(
             new java.security.PrivilegedExceptionAction() {
+                @Override
                 public java.lang.Object run() throws Exception {
                     if( !methodAccessible.isAccessible() ) {
                         methodAccessible.setAccessible(true);
@@ -439,6 +442,7 @@
 
     // Called before invoking a bean with no Tx or with a new Tx.
     // Check if the bean is associated with an unfinished tx.
+    @Override
     protected void checkUnfinishedTx(Transaction prevTx, EjbInvocation inv) {
         try {
             if ( inv.invocationInfo.isBusinessMethod && prevTx != null &&
@@ -488,6 +492,7 @@
         }
     }
 
+    @Override
     protected void registerMonitorableComponents() {
         registerEjbCacheProbeProvider();
         super.registerMonitorableComponents();
@@ -552,6 +557,7 @@
         return sbuf.toString();
     }
 
+    @Override
     protected EjbMonitoringStatsProvider getMonitoringStatsProvider(
             String appName, String modName, String ejbName) {
         StatefulSessionBeanStatsProvider statsProvider = new StatefulSessionBeanStatsProvider(
@@ -578,7 +584,7 @@
     }
 **/
 
-    private static final String convertCtxStateToString(
+    private static String convertCtxStateToString(
             SessionContextImpl sc) {
         switch (sc.getState()) {
             case PASSIVATED:
@@ -595,18 +601,20 @@
         return "UNKNOWN-STATE";
     }
 
+    @Override
     protected boolean isIdentical(EJBObjectImpl ejbo, EJBObject other)
             throws RemoteException {
 
-        if (other == ejbo.getStub())
+        if (other == ejbo.getStub()) {
             return true;
-        else {
+        } else {
             try {
                 // other may be a stub for a remote object.
-                if (getProtocolManager().isIdentical(ejbo.getStub(), other))
+                if (getProtocolManager().isIdentical(ejbo.getStub(), other)) {
                     return true;
-                else
+                } else {
                     return false;
+                }
             } catch (Exception ex) {
                 _logger.log(Level.FINE,
                         "Exception while getting stub for ejb", ex);
@@ -622,6 +630,7 @@
      * ejbCreate on the new bean after createEJBObject() returns.
      * Return the EJBObject for the bean.
      */
+    @Override
     protected EJBObjectImpl createEJBObjectImpl()
             throws CreateException, RemoteException {
         try {
@@ -634,9 +643,9 @@
 
             _logger.log(Level.WARNING, CREATE_EJBOBJECT_EXCEPTION, new Object[]{ejbDescriptor.getName(), ex});
 
-            if (ex instanceof EJBException)
+            if (ex instanceof EJBException) {
                 throw (EJBException) ex;
-            else {
+            } else {
                 CreateException ce =
                         new CreateException("ERROR creating stateful SessionBean");
                 ce.initCause(ex);
@@ -645,6 +654,7 @@
         }
     }
 
+    @Override
     protected EJBObjectImpl createRemoteBusinessObjectImpl()
             throws CreateException, RemoteException {
         try {
@@ -658,9 +668,9 @@
 
             _logger.log(Level.WARNING, CREATE_EJBOBJECT_EXCEPTION, new Object[]{ejbDescriptor.getName(), ex});
 
-            if (ex instanceof EJBException)
+            if (ex instanceof EJBException) {
                 throw (EJBException) ex;
-            else {
+            } else {
                 CreateException ce =
                         new CreateException("ERROR creating stateful SessionBean");
                 ce.initCause(ex);
@@ -677,6 +687,7 @@
      * ejbCreate on the new bean after createEJBLocalObjectImpl() returns.
      * Return the EJBLocalObject for the bean.
      */
+    @Override
     protected EJBLocalObjectImpl createEJBLocalObjectImpl()
             throws CreateException {
         try {
@@ -693,9 +704,9 @@
 
             _logger.log(Level.WARNING, CREATE_EJBLOCALOBJECT_EXCEPTION, new Object[]{ejbDescriptor.getName(), ex});
 
-            if (ex instanceof EJBException)
+            if (ex instanceof EJBException) {
                 throw (EJBException) ex;
-            else {
+            } else {
                 CreateException ce =
                         new CreateException("ERROR creating stateful SessionBean");
                 ce.initCause(ex);
@@ -707,6 +718,7 @@
     /**
      * Internal creation event for Local Business view of SFSB
      */
+    @Override
     EJBLocalObjectImpl createEJBLocalBusinessObjectImpl(boolean localBeanView)
             throws CreateException {
         try {
@@ -830,7 +842,7 @@
         Set<EntityManagerReferenceDescriptor> emRefs
                 = ejbDescriptor.getEntityManagerReferenceDescriptors();
         Iterator<EntityManagerReferenceDescriptor> iter = emRefs.iterator();
-        Set<EEMRefInfo> eemRefInfos = new HashSet<EEMRefInfo>();
+        Set<EEMRefInfo> eemRefInfos = new HashSet<>();
         while (iter.hasNext()) {
             EntityManagerReferenceDescriptor refDesc = iter.next();
             if (refDesc.getPersistenceContextType() ==
@@ -898,8 +910,7 @@
     private PhysicalEntityManagerWrapper findExtendedEMFromInvList(EntityManagerFactory emf) {
         PhysicalEntityManagerWrapper em = null;
 
-        ComponentInvocation compInv = (ComponentInvocation)
-                invocationManager.getCurrentInvocation();
+        ComponentInvocation compInv = invocationManager.getCurrentInvocation();
         if (compInv != null) {
             if (compInv.getInvocationType() == ComponentInvocation.ComponentInvocationType.EJB_INVOCATION) {
                 EjbInvocation ejbInv = (EjbInvocation) compInv;
@@ -915,6 +926,7 @@
         return em;
     }
 
+    @Override
     public EntityManager lookupExtendedEntityManager(EntityManagerFactory emf) {
         PhysicalEntityManagerWrapper physicalEntityManagerWrapper = findExtendedEMFromInvList(emf);
         return physicalEntityManagerWrapper == null ? null : physicalEntityManagerWrapper.getEM();
@@ -976,8 +988,9 @@
     // called from createEJBObject and activateEJB and createEJBLocalObjectImpl
     private EJBLocalObjectImpl createEJBLocalObjectImpl
             (SessionContextImpl context) throws Exception {
-        if (context.getEJBLocalObjectImpl() != null)
+        if (context.getEJBLocalObjectImpl() != null) {
             return context.getEJBLocalObjectImpl();
+        }
 
         // create EJBLocalObject
         EJBLocalObjectImpl localObjImpl = instantiateEJBLocalObjectImpl(context.getInstanceKey());
@@ -1007,8 +1020,9 @@
 
     private EJBLocalObjectImpl createEJBLocalBusinessObjectImpl
             (SessionContextImpl context) throws Exception {
-        if (context.getEJBLocalBusinessObjectImpl() != null)
+        if (context.getEJBLocalBusinessObjectImpl() != null) {
             return context.getEJBLocalBusinessObjectImpl();
+        }
 
         EJBLocalObjectImpl localBusinessObjImpl =
                 instantiateEJBLocalBusinessObjectImpl();
@@ -1038,8 +1052,9 @@
 
     private EJBLocalObjectImpl createOptionalEJBLocalBusinessObjectImpl
             (SessionContextImpl context) throws Exception {
-        if (context.getOptionalEJBLocalBusinessObjectImpl() != null)
+        if (context.getOptionalEJBLocalBusinessObjectImpl() != null) {
             return context.getOptionalEJBLocalBusinessObjectImpl();
+        }
 
         EJBLocalObjectImpl optionalLocalBusinessObjImpl =
                 instantiateOptionalEJBLocalBusinessObjectImpl();
@@ -1071,8 +1086,9 @@
     private EJBObjectImpl createEJBObjectImpl(SessionContextImpl context)
             throws Exception {
 
-        if (context.getEJBObjectImpl() != null)
+        if (context.getEJBObjectImpl() != null) {
             return context.getEJBObjectImpl();
+        }
 
         // create EJBObject and associate it with the key
         Object sessionKey = context.getInstanceKey();
@@ -1115,8 +1131,9 @@
     private EJBObjectImpl createRemoteBusinessObjectImpl
             (SessionContextImpl context) throws Exception {
 
-        if (context.getEJBRemoteBusinessObjectImpl() != null)
+        if (context.getEJBRemoteBusinessObjectImpl() != null) {
             return context.getEJBRemoteBusinessObjectImpl();
+        }
 
         // create EJBObject
         EJBObjectImpl ejbBusinessObjImpl =
@@ -1163,6 +1180,7 @@
 
     // Called from EJBObjectImpl.remove, EJBLocalObjectImpl.remove,
     // EJBHomeImpl.remove(Handle).
+    @Override
     protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod,
                     boolean local)
             throws RemoveException, EJBException {
@@ -1273,12 +1291,14 @@
      * Note: EJB2.0 section 18.3.1 says that discarding an EJB
      * means that no methods other than finalize() should be invoked on it.
      */
+    @Override
     protected void forceDestroyBean(EJBContextImpl ctx) {
         SessionContextImpl sc = (SessionContextImpl) ctx;
 
         synchronized (sc) {
-            if (sc.getState() == EJBContextImpl.BeanState.DESTROYED)
+            if (sc.getState() == EJBContextImpl.BeanState.DESTROYED) {
                 return;
+            }
 
             // mark context as destroyed so no more invocations happen on it
             sc.setState(BeanState.DESTROYED);
@@ -1349,7 +1369,7 @@
                     // disconnect the EJBLocalObject from the context
                     // and vice versa
                     EJBLocalObjectImpl localObjImpl =
-                            (EJBLocalObjectImpl) sc.getEJBLocalObjectImpl();
+                            sc.getEJBLocalObjectImpl();
                     localObjImpl.clearContext();
                     localObjImpl.setRemoved(true);
                     sc.setEJBLocalObjectImpl(null);
@@ -1358,14 +1378,14 @@
                     // disconnect the EJBLocalObject from the context
                     // and vice versa
                     EJBLocalObjectImpl localBusinessObjImpl =
-                            (EJBLocalObjectImpl) sc.getEJBLocalBusinessObjectImpl();
+                            sc.getEJBLocalBusinessObjectImpl();
                     localBusinessObjImpl.clearContext();
                     localBusinessObjImpl.setRemoved(true);
                     sc.setEJBLocalBusinessObjectImpl(null);
                 }
                 if (hasOptionalLocalBusinessView) {
                     EJBLocalObjectImpl optionalLocalBusinessObjImpl =
-                            (EJBLocalObjectImpl) sc.getOptionalEJBLocalBusinessObjectImpl();
+                            sc.getOptionalEJBLocalBusinessObjectImpl();
                     optionalLocalBusinessObjImpl.clearContext();
                     optionalLocalBusinessObjImpl.setRemoved(true);
                     sc.setOptionalEJBLocalBusinessObjectImpl(null);
@@ -1411,6 +1431,7 @@
         }
     }
 
+    @Override
     public boolean userTransactionMethodsAllowed(ComponentInvocation inv) {
         boolean utMethodsAllowed = false;
 
@@ -1494,11 +1515,13 @@
     }
 
 
+    @Override
     protected EJBObjectImpl getEJBObjectImpl(byte[] instanceKey) {
         SessionContextImpl sc = _getContextForInstance(instanceKey);
         return sc.getEJBObjectImpl();
     }
 
+    @Override
     EJBObjectImpl getEJBRemoteBusinessObjectImpl(byte[] instanceKey) {
         SessionContextImpl sc = _getContextForInstance(instanceKey);
         return sc.getEJBRemoteBusinessObjectImpl();
@@ -1508,6 +1531,7 @@
      * Called from EJBLocalObjectImpl.getLocalObject() while deserializing
      * a local object reference.
      */
+    @Override
     protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object sessionKey) {
 
         // Create an EJBLocalObject reference which
@@ -1532,6 +1556,7 @@
         return localObjImpl;
     }
 
+    @Override
     EJBLocalObjectImpl getEJBLocalBusinessObjectImpl(Object sessionKey) {
 
         // Create an EJBLocalObject reference which
@@ -1559,6 +1584,7 @@
         return localBusinessObjImpl;
     }
 
+    @Override
     EJBLocalObjectImpl getOptionalEJBLocalBusinessObjectImpl(Object sessionKey) {
 
         // Create an EJBLocalObject reference which
@@ -1591,17 +1617,19 @@
      *
      * @throws NoSuchObjectLocalException if the object has been removed.
      */
+    @Override
     protected void checkExists(EJBLocalRemoteObject ejbObj) {
-        if (ejbObj.isRemoved())
+        if (ejbObj.isRemoved()) {
             throw new NoSuchObjectLocalException("Bean has been removed");
+        }
     }
 
-    private final void logTraceInfo(EjbInvocation inv, Object key, String message) {
+    private void logTraceInfo(EjbInvocation inv, Object key, String message) {
         _logger.log(TRACE_LEVEL, traceInfoPrefix + message
                 + " for " + inv.method.getName() + "; key: " + key);
     }
 
-    private final void logTraceInfo(SessionContextImpl sc, String message) {
+    private void logTraceInfo(SessionContextImpl sc, String message) {
         _logger.log(TRACE_LEVEL, traceInfoPrefix + message
                 + " for key: " + sc.getInstanceKey()
                 + "; " + System.identityHashCode(sc));
@@ -1611,6 +1639,7 @@
      * Called from preInvoke which is called from the EJBObject
      * for local and remote invocations.
      */
+    @Override
     public ComponentContext _getContext(EjbInvocation inv) {
         EJBLocalRemoteObject ejbo = inv.ejbObject;
         SessionContextImpl sc = ejbo.getContext();
@@ -1756,6 +1785,7 @@
         return context;
     }
 
+    @Override
     public boolean isHAEnabled() {
         return isHAEnabled;
     }
@@ -1772,7 +1802,7 @@
 
         if (ejbLRO != null) {
             if (clientVersion ==
-                    sfsbVersionManager.NO_VERSION) {
+                    SFSBVersionManager.NO_VERSION) {
                 clientVersion = ejbLRO.getSfsbClientVersion();
             }
 
@@ -1825,6 +1855,7 @@
         }
     }
 
+    @Override
     protected void postInvokeTx(EjbInvocation inv) throws Exception {
 
         // Intercept postInvokeTx call to perform any @Remove logic
@@ -1884,6 +1915,7 @@
      * Called from preInvoke which is called from the EJBObject for local and
      * remote invocations.
      */
+    @Override
     public void releaseContext(EjbInvocation inv) {
         SessionContextImpl sc = (SessionContextImpl) inv.context;
 
@@ -1891,8 +1923,9 @@
         // any instance lock is released in the finally block.
         try {
             // check if the bean was destroyed
-            if (sc.getState() == BeanState.DESTROYED)
+            if (sc.getState() == BeanState.DESTROYED) {
                 return;
+            }
 
             // we're sure that no concurrent thread can be using this
             // context, so no need to synchronize.
@@ -1984,6 +2017,7 @@
 
     }
 
+    @Override
     protected void afterBegin(EJBContextImpl context) {
         // TX_BEAN_MANAGED EJBs cannot implement SessionSynchronization
         // Do not call afterBegin if it is a transactional lifecycle callback
@@ -2025,6 +2059,7 @@
     }
 
 
+    @Override
     protected void beforeCompletion(EJBContextImpl context) {
         // SessionSync calls on TX_BEAN_MANAGED SessionBeans
         // are not allowed
@@ -2067,6 +2102,7 @@
     // Called from SyncImpl.afterCompletion
     // May be called asynchronously during tx timeout
     // or on the same thread as tx.commit
+    @Override
     protected void afterCompletion(EJBContextImpl context, int status) {
         if (context.getState() == BeanState.DESTROYED) {
             return;
@@ -2237,13 +2273,14 @@
         }
     }
 
-    public final boolean canPassivateEJB(ComponentContext context) {
+    public boolean canPassivateEJB(ComponentContext context) {
         SessionContextImpl sc = (SessionContextImpl) context;
         return (sc.getState() == BeanState.READY);
     }
 
     // called asynchronously from the Recycler
-    public final boolean passivateEJB(ComponentContext context) {
+    @Override
+    public boolean passivateEJB(ComponentContext context) {
 
         SessionContextImpl sc = (SessionContextImpl) context;
 
@@ -2258,8 +2295,9 @@
                 }
             }
 
-            if (sc.getState() == BeanState.DESTROYED)
+            if (sc.getState() == BeanState.DESTROYED) {
                 return false;
+            }
 
             if (_logger.isLoggable(TRACE_LEVEL)) {
                 _logger.log(TRACE_LEVEL, traceInfoPrefix + "Passivating context "
@@ -2440,16 +2478,18 @@
 
     }
 
-    public final int getPassivationBatchCount() {
+    @Override
+    public int getPassivationBatchCount() {
         return this.passivationBatchCount;
     }
 
-    public final void setPassivationBatchCount(int count) {
+    public void setPassivationBatchCount(int count) {
         this.passivationBatchCount = count;
     }
 
     // called asynchronously from the Recycler
-    public final boolean passivateEJB(StatefulEJBContext sfsbCtx) {
+    @Override
+    public boolean passivateEJB(StatefulEJBContext sfsbCtx) {
         return passivateEJB((ComponentContext) sfsbCtx.getSessionContext());
     }
 
@@ -2463,6 +2503,7 @@
     }
 
     // called from StatefulSessionStore
+    @Override
     public void activateEJB(Object sessionKey, StatefulEJBContext sfsbCtx, Object cookie) {
         SessionContextImpl context = (SessionContextImpl) sfsbCtx.getSessionContext();
 
@@ -2640,10 +2681,12 @@
         }
     }
 
+    @Override
     public byte[] serializeContext(StatefulEJBContext ctx) throws IOException {
         return serializeContext((SessionContextImpl)ctx.getSessionContext());
     }
 
+    @Override
     public Object deserializeData(byte[] data) throws Exception {
         Object o = ejbContainerUtilImpl.getJavaEEIOUtils().deserializeObject(data, true, getClassLoader());
         if (o instanceof SessionContextImpl) {
@@ -2658,7 +2701,7 @@
                 try (ByteArrayInputStream bis = new ByteArrayInputStream(sejb.serializedFields);
                     ObjectInputStream ois = ejbContainerUtilImpl.getJavaEEIOUtils().createObjectInputStream(bis, true, getClassLoader());) {
 
-                    ejb = ejbClass.newInstance();
+                    ejb = ejbClass.getDeclaredConstructor().newInstance();
                     EJBUtils.deserializeObjectFields(ejb, ois, o, false);
                     ctx.setEJB(ejb);
                 }
@@ -2837,6 +2880,7 @@
         }
     }
 
+    @Override
     public void invokePeriodically(long delay, long periodicity, Runnable target) {
         java.util.Timer timer = ejbContainerUtilImpl.getTimer();
 
@@ -2851,14 +2895,14 @@
         undeploy((SessionContextImpl) sfsbCtx.getSessionContext());
     }
 
+    @Override
     protected String[] getPre30LifecycleMethodNames() {
         return new String[]{
                 null, null, "ejbRemove", "ejbPassivate", "ejbActivate"
         };
     }
 
-    ;
-
+    @Override
     protected void doConcreteContainerShutdown(boolean appBeingUndeployed) {
 
         cancelAllTimerTasks();
@@ -3105,6 +3149,7 @@
     }
 
     // CacheListener interface
+    @Override
     public void trimEvent(Object primaryKey, Object context) {
         boolean addTask = false;
         synchronized (asyncTaskSemaphore) {
@@ -3144,6 +3189,7 @@
 
     private class ASyncPassivator implements Runnable {
 
+        @Override
         public void run() {
             final Thread currentThread = Thread.currentThread();
             final ClassLoader previousClassLoader =
@@ -3159,6 +3205,7 @@
                 } else {
                     java.security.AccessController.doPrivileged
                             (new java.security.PrivilegedAction() {
+                                @Override
                                 public java.lang.Object run() {
                                     currentThread.setContextClassLoader(myClassLoader);
                                     return null;
@@ -3194,6 +3241,7 @@
                 } else {
                     java.security.AccessController.doPrivileged
                             (new java.security.PrivilegedAction() {
+                                @Override
                                 public java.lang.Object run() {
                                     currentThread.setContextClassLoader
                                             (previousClassLoader);
@@ -3444,13 +3492,13 @@
     static class EEMRefInfoKey
             implements Serializable {
 
-        private String emRefName;
+        private final String emRefName;
 
-        private long containerID;
+        private final long containerID;
 
-        private Object instanceKey;
+        private final Object instanceKey;
 
-        private int hc;
+        private final int hc;
 
         EEMRefInfoKey(String en, long cid, Object ikey) {
             this.emRefName = en;
@@ -3460,10 +3508,12 @@
             this.hc = instanceKey.hashCode();
         }
 
+        @Override
         public int hashCode() {
             return hc;
         }
 
+        @Override
         public boolean equals(Object obj) {
             boolean result = false;
             if (obj instanceof EEMRefInfoKey) {
@@ -3477,6 +3527,7 @@
             return result;
         }
 
+        @Override
         public String toString() {
             return "<" + instanceKey + ":" + emRefName + ":" + containerID + ">";
         }
@@ -3487,11 +3538,11 @@
 
         private transient int refCount = 0;
 
-        private String unitName;
+        private final String unitName;
 
-        private SynchronizationType synchronizationType;
+        private final SynchronizationType synchronizationType;
 
-        private EEMRefInfoKey eemRefInfoKey;
+        private final EEMRefInfoKey eemRefInfoKey;
 
         private byte[] serializedEEM;
 
@@ -3538,6 +3589,7 @@
         }
 
         //Method of IndirectlySerializable
+        @Override
         public SerializableObjectFactory getSerializableObjectFactory()
                 throws IOException {
 
@@ -3560,6 +3612,7 @@
         }
 
         //Method of SerializableObjectFactory
+        @Override
         public Object createObject()
                 throws IOException {
 
@@ -3596,6 +3649,7 @@
         }
 
         //Method of IndirectlySerializable
+        @Override
         public SerializableObjectFactory getSerializableObjectFactory()
                 throws IOException {
 
@@ -3603,6 +3657,7 @@
         }
 
         //Method of SerializableObjectFactory
+        @Override
         public Object createObject() throws IOException {
             return this;
         }
@@ -3619,12 +3674,14 @@
         this.ejbContainerUtil = ejbContainerUtil;
     }
 
+    @Override
     public void run() {
         if (!task.isExecuting()) {
             ejbContainerUtil.addWork(task);
         }
     }
 
+    @Override
     public boolean cancel() {
         boolean cancelled = super.cancel();
 
@@ -3651,6 +3708,7 @@
     }
 
     //This will be called with the correct ClassLoader
+    @Override
     public void run() {
         ClassLoader prevCL = Thread.currentThread().getContextClassLoader();
         try {
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java
index 9df09b4..42612ed 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/StatelessSessionContainer.java
@@ -19,8 +19,6 @@
 
 import java.lang.reflect.Method;
 import java.rmi.RemoteException;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.logging.Level;
 
 import jakarta.ejb.CreateException;
@@ -153,11 +151,13 @@
         return true;
     }
 
+    @Override
     protected EjbMonitoringStatsProvider getMonitoringStatsProvider(
             String appName, String modName, String ejbName) {
         return new StatelessSessionBeanStatsProvider(this, getContainerId(), appName, modName, ejbName);
     }
 
+    @Override
     protected void initializeHome()
         throws Exception
     {
@@ -234,6 +234,7 @@
            poolProp.poolIdleTimeoutInSeconds, loader, Boolean.parseBoolean(val));
     }
 
+    @Override
     protected void registerMonitorableComponents() {
         super.registerMonitorableComponents();
 
@@ -245,9 +246,11 @@
         _logger.log(Level.FINE, "[SLSB Container] registered monitorable");
     }
 
+    @Override
     public void onReady() {
     }
 
+    @Override
     public EJBObjectImpl createRemoteBusinessObjectImpl()
         throws CreateException, RemoteException
     {
@@ -266,6 +269,7 @@
     /**
      *
      */
+    @Override
     public EJBObjectImpl createEJBObjectImpl()
         throws CreateException, RemoteException
     {
@@ -289,6 +293,7 @@
     /**
      * Called during client creation request through EJB LocalHome view.
      */
+    @Override
     public EJBLocalObjectImpl createEJBLocalObjectImpl()
         throws CreateException
     {
@@ -312,6 +317,7 @@
     /**
      * Called during internal creation of session bean
      */
+    @Override
     public EJBLocalObjectImpl createEJBLocalBusinessObjectImpl(boolean localBeanView)
         throws CreateException
     {
@@ -327,6 +333,7 @@
 
     // Called from EJBObjectImpl.remove, EJBLocalObjectImpl.remove,
     // EJBHomeImpl.remove(Handle).
+    @Override
     protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod,
         boolean local)
     throws RemoveException, EJBException, RemoteException
@@ -346,9 +353,11 @@
      * Note: EJB2.0 section 18.3.1 says that discarding an EJB
      * means that no methods other than finalize() should be invoked on it.
      */
+    @Override
     protected void forceDestroyBean(EJBContextImpl sc) {
-        if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED )
-                return;
+        if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED ) {
+            return;
+        }
 
         // mark context as destroyed
         sc.setState(EJBContextImpl.BeanState.DESTROYED);
@@ -361,10 +370,12 @@
     /**
      * Called when a remote invocation arrives for an EJB.
      */
+    @Override
     protected EJBObjectImpl getEJBObjectImpl(byte[] instanceKey) {
         return theEJBObjectImpl;
     }
 
+    @Override
     EJBObjectImpl getEJBRemoteBusinessObjectImpl(byte[] instanceKey) {
         return theRemoteBusinessObjectImpl;
     }
@@ -373,6 +384,7 @@
     * Called from EJBLocalObjectImpl.getLocalObject() while deserializing
     * a local object reference.
     */
+    @Override
     protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key) {
         return theEJBLocalObjectImpl;
     }
@@ -381,6 +393,7 @@
     * Called from EJBLocalObjectImpl.getLocalObject() while deserializing
     * a local business object reference.
     */
+    @Override
     EJBLocalObjectImpl getEJBLocalBusinessObjectImpl(Object key) {
         return theEJBLocalBusinessObjectImpl;
     }
@@ -389,6 +402,7 @@
     * Called from EJBLocalObjectImpl.getLocalObject() while deserializing
     * a local business object reference.
     */
+    @Override
     EJBLocalObjectImpl getOptionalEJBLocalBusinessObjectImpl(Object key) {
         return theOptionalEJBLocalBusinessObjectImpl;
     }
@@ -398,6 +412,7 @@
     * Called from preInvoke which is called from the EJBObject
     * for local and remote invocations.
     */
+    @Override
     protected ComponentContext _getContext(EjbInvocation inv) {
         try {
             SessionContextImpl sessionCtx =
@@ -409,6 +424,7 @@
         }
     }
 
+    @Override
     protected EJBContextImpl _constructEJBContextImpl(Object instance) {
     return new SessionContextImpl(instance, this);
     }
@@ -483,7 +499,7 @@
             // EJBContext methods not allowed will throw exceptions
             context.setState(EJBContextImpl.BeanState.POOLED);
         } catch ( Throwable th ) {
-            _logger.log(Level.SEVERE, "ejb.stateless_ejbcreate_exception", logParams);
+            _logger.log(Level.SEVERE, "ejb.stateless_ejbcreate_exception", containerInfo);
             CreateException creEx = new CreateException("Could not create stateless EJB");
             creEx.initCause(th);
             throw creEx;
@@ -503,6 +519,7 @@
         }
     }
 
+    @Override
     protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey)
             throws Exception {
         // TODO I don't understand this check.  What is ejbObject used for?
@@ -515,6 +532,7 @@
         }
     }
 
+    @Override
     public boolean userTransactionMethodsAllowed(ComponentInvocation inv) {
         boolean utMethodsAllowed = false;
         if( isBeanManagedTran ) {
@@ -535,12 +553,14 @@
      * Called from preInvoke which is called from the EJBObject
      * for local and remote invocations.
      */
+    @Override
     public void releaseContext(EjbInvocation inv) {
         SessionContextImpl sc = (SessionContextImpl)inv.context;
 
         // check if the bean was destroyed
-        if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED )
+        if ( sc.getState() == EJBContextImpl.BeanState.DESTROYED ) {
             return;
+        }
 
             sc.setState(EJBContextImpl.BeanState.POOLED);
 
@@ -552,38 +572,34 @@
     }
 
 
+    @Override
     protected boolean isIdentical(EJBObjectImpl ejbo, EJBObject other)
         throws RemoteException
     {
 
         if ( other == ejbo.getStub() ) {
             return true;
-        }else {
-            try {
-                // other may be a stub for a remote object.
-                // Although all stateless sessionbeans for a bean type
-                // are identical, we dont know whether other is of the
-                // same bean type as ejbo.
-                if ( getProtocolManager().isIdentical(ejbo.getStub(), other) )
-                        return true;
-                else
-                        return false;
-            } catch ( Exception ex ) {
-                if(_logger.isLoggable(Level.SEVERE)) {
-                    _logger.log(Level.SEVERE,"ejb.ejb_getstub_exception",
-                        logParams);
-                    _logger.log(Level.SEVERE,"",ex);
-                }
-                throw new RemoteException("Error during isIdentical.", ex);
-            }
         }
-
+        try {
+            // other may be a stub for a remote object.
+            // Although all stateless sessionbeans for a bean type
+            // are identical, we dont know whether other is of the
+            // same bean type as ejbo.
+            return getProtocolManager().isIdentical(ejbo.getStub(), other);
+        } catch ( Exception ex ) {
+            if(_logger.isLoggable(Level.SEVERE)) {
+                _logger.log(Level.SEVERE,"ejb.ejb_getstub_exception", containerInfo);
+                _logger.log(Level.SEVERE,"",ex);
+            }
+            throw new RemoteException("Error during isIdentical.", ex);
+        }
     }
 
     /**
     * Check if the given EJBObject/LocalObject has been removed.
     * @exception NoSuchObjectLocalException if the object has been removed.
     */
+    @Override
     protected void checkExists(EJBLocalRemoteObject ejbObj)
     {
         // For stateless session beans, EJBObject/EJBLocalObj are never removed.
@@ -591,16 +607,19 @@
     }
 
 
+    @Override
     protected void afterBegin(EJBContextImpl context) {
         // Stateless SessionBeans cannot implement SessionSynchronization!!
         // EJB2.0 Spec 7.8.
     }
 
+    @Override
     protected void beforeCompletion(EJBContextImpl context) {
         // Stateless SessionBeans cannot implement SessionSynchronization!!
         // EJB2.0 Spec 7.8.
     }
 
+    @Override
     protected void afterCompletion(EJBContextImpl ctx, int status) {
         // Stateless SessionBeans cannot implement SessionSynchronization!!
         // EJB2.0 Spec 7.8.
@@ -609,6 +628,7 @@
     }
 
     // default
+    @Override
     public boolean passivateEJB(ComponentContext context) {
         return false;
     }
@@ -616,15 +636,8 @@
     // default
     public void activateEJB(Object ctx, Object instanceKey) {}
 
-/** TODO ???
-    public void appendStats(StringBuffer sbuf) {
-    sbuf.append("\nStatelessContainer: ")
-        .append("CreateCount=").append(statCreateCount).append("; ")
-        .append("RemoveCount=").append(statRemoveCount).append("; ")
-        .append("]");
-    }
-**/
 
+    @Override
     protected void doConcreteContainerShutdown(boolean appBeingUndeployed) {
 
         try {
@@ -666,6 +679,7 @@
         implements ObjectFactory
     {
 
+        @Override
         public Object create(Object param) {
             try {
                     return createStatelessEJB();
@@ -674,6 +688,7 @@
             }
         }
 
+        @Override
         public void destroy(Object obj) {
             SessionContextImpl sessionCtx = (SessionContextImpl) obj;
             // Note: stateless SessionBeans cannot have incomplete transactions
diff --git a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java
index 306895c..23b20b3 100644
--- a/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java
+++ b/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/interceptors/InterceptorManager.java
@@ -62,20 +62,20 @@
     // Set when initializing interceptors for a non-ejb
     private InterceptorInfo interceptorInfo;
 
-    private ClassLoader loader;
+    private final ClassLoader loader;
 
-    private Class beanClass;
+    private final Class beanClass;
 
-    private String beanClassName;
+    private final String beanClassName;
 
-    private Logger _logger;
+    private final Logger _logger;
 
     private Class[] interceptorClasses;
 
     private Class[] serializableInterceptorClasses;
 
-    private Map<String, Integer> instanceIndexMap
-            = new HashMap<String, Integer>();
+    private final Map<String, Integer> instanceIndexMap
+            = new HashMap<>();
 
     private boolean interceptorsExists;
 
@@ -88,7 +88,7 @@
     // Optionally specified delegate to be set on SystemInterceptorProxy
     private Object runtimeInterceptor;
 
-    List<InterceptorDescriptor> frameworkInterceptors = new LinkedList<InterceptorDescriptor>();
+    List<InterceptorDescriptor> frameworkInterceptors = new LinkedList<>();
 
 
     public InterceptorManager(Logger _logger, BaseContainer container,
@@ -191,7 +191,7 @@
             MethodDescriptor mDesc, Method beanMethod) {
 
         ArrayList<AroundInvokeInterceptor> interceptors =
-                new ArrayList<AroundInvokeInterceptor>();
+                new ArrayList<>();
 
         for(InterceptorDescriptor interceptor : frameworkInterceptors) {
             Set<LifecycleCallbackDescriptor> aroundInvokeDescs =
@@ -252,7 +252,7 @@
 
 
         ArrayList<AroundInvokeInterceptor> interceptors =
-                new ArrayList<AroundInvokeInterceptor>();
+                new ArrayList<>();
 
 
         for(InterceptorDescriptor interceptor : frameworkInterceptors) {
@@ -279,7 +279,7 @@
 
         List<EjbInterceptor> list = (ejbDesc != null) ?
                 ejbDesc.getAroundTimeoutInterceptors(mDesc) :
-                new LinkedList<EjbInterceptor>();
+                new LinkedList<>();
 
         for (EjbInterceptor interceptor : list) {
             String className = interceptor.getInterceptorClassName();
@@ -475,7 +475,6 @@
         serializableInterceptorClasses = new Class[size];
         int index = 0;
         for (Class<?> interClass : classes) {
-
             interceptorClasses[index] = interClass;
             serializableInterceptorClasses[index] = interClass;
             instanceIndexMap.put(interClass.getName(), index);
@@ -573,7 +572,7 @@
     private void initCallbackIndices(List<InterceptorDescriptor> callbackList,
                                      CallbackType callbackType) throws Exception {
 
-        ArrayList<CallbackInterceptor> callbacks = new ArrayList<CallbackInterceptor>();
+        ArrayList<CallbackInterceptor> callbacks = new ArrayList<>();
 
         int index = callbackType.ordinal();
 
@@ -614,7 +613,7 @@
     private List<CallbackInterceptor> createCallbackInterceptors(CallbackType eventType,
                                                           InterceptorDescriptor inter,
                                                           ClassLoader classLoaderToUse) throws Exception {
-        List<CallbackInterceptor> callbackList = new ArrayList<CallbackInterceptor>();
+        List<CallbackInterceptor> callbackList = new ArrayList<>();
 
         List<LifecycleCallbackDescriptor> orderedCallbackMethods =
             inter.getOrderedCallbackDescriptors(eventType, classLoaderToUse);
@@ -758,7 +757,7 @@
 
     public interface AroundInvokeContext extends InvocationContext {
 
-        public Object[] getInterceptorInstances();
+        Object[] getInterceptorInstances();
 
        /**
         * Called from Interceptor Chain to invoke the actual bean method.
@@ -768,13 +767,13 @@
         * interceptor code, so it must not be changed in order for any exception
         * handling logic in that code to function properly.
         */
-        public  Object invokeBeanMethod()
+        Object invokeBeanMethod()
             throws Throwable;
 
     }
 
     public interface InterceptorChain {
-    public Object invokeNext(int index, AroundInvokeContext invCtx)
+    Object invokeNext(int index, AroundInvokeContext invCtx)
         throws Throwable;
     }
 
diff --git a/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java b/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java
index da973f0..33f1dd0 100755
--- a/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java
+++ b/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/persistent/timer/PersistentEJBTimerService.java
@@ -26,7 +26,6 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -76,7 +75,7 @@
  */
 public class PersistentEJBTimerService extends EJBTimerService {
 
-    private TimerLocal timerLocal_;
+    private final TimerLocal timerLocal_;
 
     private static final Logger logger =
         LogDomains.getLogger(PersistentEJBTimerService.class, LogDomains.EJB_LOGGER);
@@ -160,6 +159,7 @@
     /**
      * Provide a count of timers owned by each server
      */
+    @Override
     public String[] listTimers( String[] serverIds ) {
         String[] totalTimers = null;
         try {
@@ -177,6 +177,7 @@
     /**
      * Take ownership of another server's timers.
      */
+    @Override
     public int migrateTimers(String fromOwnerId) {
 
         String ownerIdOfThisServer = getOwnerIdOfThisServer();
@@ -276,6 +277,7 @@
 
     } //migrateTimers()
 
+    @Override
     public boolean isPersistent() {
         return true;
     }
@@ -419,7 +421,7 @@
 
         Map timersToRestore = new HashMap();
         Set timerIdsToRemove = new HashSet();
-        Set<TimerState> result = new HashSet<TimerState>();
+        Set<TimerState> result = new HashSet<>();
 
         for(TimerState timer: timersEligibleForRestoration) {
 
@@ -452,7 +454,7 @@
                 // an entity bean.  That allows us to lazily load the underlying
                 // blob for stateless session and message-driven bean timers.
                 Object timedObjectPrimaryKey = null;
-                if( container.getContainerType() == BaseContainer.ContainerType.ENTITY) {
+                if (container.getContainerInfo().type == BaseContainer.ContainerType.ENTITY) {
                     timedObjectPrimaryKey = timer.getTimedObjectPrimaryKey();
                 }
 
@@ -570,16 +572,13 @@
             timerLocal_.remove(timerIdsToRemove);
         }
 
-        for(Iterator entries = timersToRestore.entrySet().iterator();
-            entries.hasNext(); ) {
-            Map.Entry next  = (Map.Entry) entries.next();
+        for (Object element : timersToRestore.entrySet()) {
+            Map.Entry next = (Map.Entry) element;
             RuntimeTimerState nextTimer = (RuntimeTimerState) next.getKey();
-            TimerPrimaryKey timerId    = nextTimer.getTimerId();
+            TimerPrimaryKey timerId = nextTimer.getTimerId();
             Date expiration = (Date) next.getValue();
             scheduleTask(timerId, expiration);
-            logger.log(Level.FINE,
-                       "EJBTimerService.restoreTimers(), scheduling timer " +
-                       nextTimer);
+            logger.log(Level.FINE, "EJBTimerService.restoreTimers(), scheduling timer " + nextTimer);
         }
 
         logger.log(Level.FINE, "DONE EJBTimerService.restoreTimers()");
@@ -708,14 +707,14 @@
             Map<Method, List<ScheduledTimerDescriptor>> schedules,
             boolean deploy) {
 
-        Map<TimerPrimaryKey, Method> result = new HashMap<TimerPrimaryKey, Method>();
+        Map<TimerPrimaryKey, Method> result = new HashMap<>();
 
         TransactionManager tm = ejbContainerUtil.getTransactionManager();
         try {
             tm.begin();
 
             Set<TimerState> timers = _restoreTimers(
-                    (Set<TimerState>)timerLocal_.findActiveTimersOwnedByThisServerByContainer(containerId));
+                    timerLocal_.findActiveTimersOwnedByThisServerByContainer(containerId));
 
             if (timers.size() > 0) {
                 logger.log(Level.FINE, "Found " + timers.size() +
@@ -756,9 +755,10 @@
      * Called in a clustered environment to eagerly create automatic persistent timers
      * on the specific server instance.
      */
+    @Override
     public void createSchedulesOnServer(EjbDescriptor ejbDescriptor, String server_name) {
         Map<MethodDescriptor, List<ScheduledTimerDescriptor>> schedules =
-                new HashMap<MethodDescriptor, List<ScheduledTimerDescriptor>>();
+                new HashMap<>();
         for (ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
             MethodDescriptor method = schd.getTimeoutMethod();
             if (method != null && schd.getPersistent()) {
@@ -768,7 +768,7 @@
 
                 List<ScheduledTimerDescriptor> list = schedules.get(method);
                 if (list == null) {
-                    list = new ArrayList<ScheduledTimerDescriptor>();
+                    list = new ArrayList<>();
                     schedules.put(method, list);
                 }
                 list.add(schd);
@@ -794,6 +794,7 @@
      * Only persistent schedule based timers for the containerId that has no timers associated
      * with it, will be created. And no timers will be scheduled.
      */
+    @Override
     public void createSchedules(long containerId, long applicationId,
             Map<MethodDescriptor, List<ScheduledTimerDescriptor>> methodDescriptorSchedules, String server_name) {
         TransactionManager tm = ejbContainerUtil.getTransactionManager();
@@ -894,7 +895,7 @@
         // timer cache to avoid some database access in PE/SE, or
         // even in EE with the appropriate consistency tradeoff.
 
-        Collection<TimerPrimaryKey> timerIdsForTimedObject = new HashSet<TimerPrimaryKey>();
+        Collection<TimerPrimaryKey> timerIdsForTimedObject = new HashSet<>();
 
         if (timedObjectPrimaryKey == null) {
             timerIdsForTimedObject = timerLocal_.findActiveTimerIdsByContainer(containerId);
@@ -921,7 +922,7 @@
      */
     @Override
     protected Collection<TimerPrimaryKey> getTimerIds(Collection<Long> containerIds) {
-        Collection<TimerPrimaryKey> timerIds = new HashSet<TimerPrimaryKey>(super.getTimerIds(containerIds));
+        Collection<TimerPrimaryKey> timerIds = new HashSet<>(super.getTimerIds(containerIds));
         timerIds.addAll(timerLocal_.findActiveTimerIdsByContainers(containerIds));
         return timerIds;
     }
@@ -1486,6 +1487,7 @@
                     success = h.executeDDLStatement(
                             dir.getCanonicalPath() + "/ejbtimer_upgrade_", resource);
                     ConfigSupport.apply(new SingleConfigCode<Property>() {
+                        @Override
                         public Object run(Property p) throws PropertyVetoException, TransactionFailure {
                             p.setValue("true");
                             return null;
diff --git a/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java b/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java
index 7d84301..cef20a5 100644
--- a/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java
+++ b/appserver/persistence/entitybean-container/src/main/java/org/glassfish/persistence/ejb/entitybean/container/EntityContainer.java
@@ -169,7 +169,8 @@
     implements CacheListener
 {
 
-    private ThreadLocal ejbServant = new ThreadLocal() {
+    private final ThreadLocal ejbServant = new ThreadLocal() {
+        @Override
         protected Object initialValue() {
             return null;
         }
@@ -276,10 +277,10 @@
 
         super.createCallFlowAgent(
                 isContainerManagedPers ? ComponentType.CMP : ComponentType.BMP);
-        _logger.log(Level.FINE,"[EntityContainer] Created EntityContainer: "
-                + logParams[0]);
+        _logger.log(Level.FINE,"[EntityContainer] Created EntityContainer: {0}", containerInfo);
     }
 
+    @Override
     protected void preInitialize(EjbDescriptor desc, ClassLoader loader) {
         EjbEntityDescriptor ed = (EjbEntityDescriptor)desc;
         isReentrant = ed.isReentrant();
@@ -402,6 +403,7 @@
         this.idleBeansPassivator = null;
     }
 
+    @Override
     protected InvocationInfo postProcessInvocationInfo(
             InvocationInfo invInfo) {
         Method method = invInfo.method;
@@ -431,6 +433,7 @@
     /**
      * Called from the ContainerFactory during initialization.
      */
+    @Override
     protected void initializeHome()
         throws Exception
     {
@@ -452,6 +455,7 @@
     registerMonitorableComponents();
     }
 
+    @Override
     protected void registerMonitorableComponents() {
         super.registerMonitorableComponents();
     if (readyStore != null) {
@@ -490,11 +494,13 @@
         _logger.log(Level.FINE, "[Entity Container] registered monitorable");
     }
 
+    @Override
     protected EjbMonitoringStatsProvider getMonitoringStatsProvider(
             String appName, String modName, String ejbName) {
         return new EntityBeanStatsProvider(this, getContainerId(), appName, modName, ejbName);
     }
 
+    @Override
     public void onReady() {
     }
 
@@ -557,6 +563,7 @@
     /**
      * Implementation of BaseContainer method. This is never called.
      */
+    @Override
     protected EJBObjectImpl createEJBObjectImpl()
         throws CreateException, RemoteException
     {
@@ -564,6 +571,7 @@
             "INTERNAL ERROR: EntityContainer.createEJBObject() called");
     }
 
+    @Override
     protected EJBLocalObjectImpl createEJBLocalObjectImpl()
         throws CreateException
     {
@@ -575,6 +583,7 @@
     /**
      * Called when a remote EjbInvocation arrives for an EJB.
      */
+    @Override
     protected EJBObjectImpl getEJBObjectImpl(byte[] streamKey) {
         // First get the primary key of the EJB
         Object primaryKey;
@@ -592,6 +601,7 @@
      * Called from EJBLocalObjectImpl.getLocalObject() while deserializing
      * a local object reference.
      */
+    @Override
     protected EJBLocalObjectImpl getEJBLocalObjectImpl(Object key) {
         return internalGetEJBLocalObjectImpl(key);
     }
@@ -600,6 +610,7 @@
      * Called from BaseContainer.preInvoke which is called from the EJBObject
      * for local and remote invocations, and from the EJBHome for create/find.
      */
+    @Override
     protected ComponentContext _getContext(EjbInvocation inv) {
         if ( inv.invocationInfo.isCreateHomeFinder ) {
             // create*, find*, home methods
@@ -614,10 +625,11 @@
             // context, so no need to synchronize.
             context.setState(BeanState.INVOKING);
 
-            if ( inv.invocationInfo.startsWithCreate )
+            if ( inv.invocationInfo.startsWithCreate ) {
                 preCreate(inv, context);
-            else if ( inv.invocationInfo.startsWithFind )
+            } else if ( inv.invocationInfo.startsWithFind ) {
                 preFind(inv, context);
+            }
 
 
             context.setLastTransactionStatus(-1);
@@ -632,15 +644,18 @@
         // If we would invoke the EJB with the client's Tx,
         // try to get an EJB with that incomplete Tx.
         EntityContextImpl context = null;
-        if ( willInvokeWithClientTx(inv) )
+        if ( willInvokeWithClientTx(inv) ) {
             context = getEJBWithIncompleteTx(inv);
-        if ( context == null )
+        }
+        if ( context == null ) {
             context = getReadyEJB(inv);
+        }
 
         synchronized ( context ) {
-            if ( context.isInState(BeanState.INVOKING) && !isReentrant )
+            if ( context.isInState(BeanState.INVOKING) && !isReentrant ) {
                 throw new EJBException(
                     "EJB is already executing another request");
+            }
             if (context.isInState(BeanState.POOLED) ||
                 context.isInState(BeanState.DESTROYED)) {
                 // somehow a concurrent thread must have changed state.
@@ -686,12 +701,14 @@
      * This is called from BaseContainer.postInvoke after
      * EntityContainer.preInvokeTx has been called.
      */
+    @Override
     public void releaseContext(EjbInvocation inv) {
         EntityContextImpl context = (EntityContextImpl)inv.context;
         boolean decrementedCalls = false; // End of IAS 4661771
 
-        if ( context.isInState(BeanState.DESTROYED) )
+        if ( context.isInState(BeanState.DESTROYED) ) {
             return;
+        }
 
         try {
             if ( context.hasReentrantCall() ) {
@@ -766,10 +783,11 @@
                 context.decrementCalls();
                 context.setLastTransactionStatus(-1);
                 if ( status == -1 || status == Status.STATUS_COMMITTED
-                || status == Status.STATUS_NO_TRANSACTION )
+                || status == Status.STATUS_NO_TRANSACTION ) {
                     addReadyEJB(context);
-                else
+                } else {
                     passivateAndPoolEJB(context);
+                }
             } else {
                 // biz methods and ejbCreate
                 // The EJB is still associated with a Tx.
@@ -779,8 +797,7 @@
                 doFlush( inv );
             }
         } catch ( Exception ex ) {
-            _logger.log(Level.FINE, "entitybean.container.release_context_exception",
-                        logParams);
+            _logger.log(Level.FINE, "entitybean.container.release_context_exception", containerInfo);
             _logger.log(Level.FINE, "",ex);
             throw new EJBException(ex);
         } finally {
@@ -808,12 +825,14 @@
      * is called.
      * Note: postCreate will not be called if ejbCreate throws an exception
      */
+    @Override
     public void postCreate(EjbInvocation inv, Object primaryKey)
         throws CreateException
     {
-        if ( primaryKey == null )
+        if ( primaryKey == null ) {
             throw new EJBException(
                 "Null primary key returned by ejbCreate method");
+        }
 
         if ( (isRemote) && (!inv.isLocal) ) {
             // remote EjbInvocation: create EJBObject
@@ -845,6 +864,7 @@
 
     //Called from EJB(Local)HomeInvocationHandler
     //Note: preFind is already called from getContext
+    @Override
     protected Object invokeFindByPrimaryKey(Method method,
         EjbInvocation inv, Object[] args)
     throws Throwable
@@ -854,12 +874,14 @@
     return postFind(inv, pKeys, null);
     }
 
+    @Override
     protected void authorizeLocalGetPrimaryKey(EJBLocalRemoteObject ejbObj)
             throws EJBException {
         authorizeLocalMethod(BaseContainer.EJBLocalObject_getPrimaryKey);
         checkExists(ejbObj);
     }
 
+    @Override
     protected void authorizeRemoteGetPrimaryKey(EJBLocalRemoteObject ejbObj)
             throws RemoteException {
         authorizeRemoteMethod(BaseContainer.EJBObject_getPrimaryKey);
@@ -890,6 +912,7 @@
     /**
      * Called from CMP PersistentManager
      */
+    @Override
     public void preSelect()
       throws jakarta.ejb.EJBException {
     // if the ejbSelect is being invoked with the client's transaction,
@@ -919,6 +942,7 @@
      * after ejb.ejbFind**() has been called.
      * Note: postFind will not be called if ejbFindXXX throws an exception
      */
+    @Override
     public Object postFind(EjbInvocation inv, Object primaryKeys,
         Object[] findParams)
         throws FinderException
@@ -933,10 +957,11 @@
                 Object primaryKey = e.nextElement();
                 Object ref;
                 if( primaryKey != null ) {
-                    if ( inv.isLocal )
+                    if ( inv.isLocal ) {
                         ref = getEJBLocalObjectForPrimaryKey(primaryKey);
-                    else
+                    } else {
                         ref = getEJBObjectStub(primaryKey, null);
+                    }
                     objrefs.add(ref);
                 } else {
                     objrefs.add(null);
@@ -952,10 +977,11 @@
                 Object primaryKey = it.next();
                 Object ref;
                 if( primaryKey != null ) {
-                    if ( inv.isLocal )
+                    if ( inv.isLocal ) {
                         ref = getEJBLocalObjectForPrimaryKey(primaryKey);
-                    else
+                    } else {
                         ref = getEJBObjectStub(primaryKey, null);
+                    }
                     objrefs.add(ref);
                 } else {
                     objrefs.add(null);
@@ -964,10 +990,11 @@
             return objrefs;
         } else {
             if( primaryKeys != null ) {
-                if ( inv.isLocal )
+                if ( inv.isLocal ) {
                     return getEJBLocalObjectForPrimaryKey(primaryKeys);
-                else
+                } else {
                     return getEJBObjectStub(primaryKeys, null);
+                }
             } else {
                 return null;
             }
@@ -981,6 +1008,7 @@
      * for a primary key (home.findByPrimaryKey cant be used because it may
      * not run in the same tx).
      */
+    @Override
     public EJBObject getEJBObjectForPrimaryKey(Object pkey) {
         // create stub without creating EJBObject
         return getEJBObjectStub(pkey, null);
@@ -1027,6 +1055,7 @@
      * @return The EJBLocalObject associated with the PK or null if it is cascade deleted.
      *
      */
+    @Override
     public EJBLocalObject getEJBLocalObjectForPrimaryKey
         (Object pkey, EJBContext ctx) {
         // EntityContextImpl should always be used in conjunction with EntityContainer so we can always cast
@@ -1045,8 +1074,7 @@
         ActiveTxCache activeTxCache = (current == null) ? null :
         (ActiveTxCache) (ejbContainerUtilImpl.getActiveTxCache(current));
             if (activeTxCache != null) {
-        EntityContextImpl ctx2 = (EntityContextImpl)
-            activeTxCache.get(this, pkey);
+        EntityContextImpl ctx2 = activeTxCache.get(this, pkey);
         if ((ctx2 != null) &&
             (ctx2.isCascadeDeleteAfterSuperEJBRemove())) {
             return null;
@@ -1065,6 +1093,7 @@
      * for a primary key (findByPrimaryKey cant be used because it may
      * not run in the same tx).
      */
+    @Override
     public EJBLocalObject getEJBLocalObjectForPrimaryKey(Object pkey) {
         EJBLocalObjectImpl localObjectImpl =
             internalGetEJBLocalObjectImpl(pkey);
@@ -1074,6 +1103,7 @@
 
     // Called from EJBHomeImpl.remove(primaryKey),
     // EJBLocalHomeImpl.remove(primaryKey)
+    @Override
     protected void doEJBHomeRemove(Object primaryKey, Method removeMethod,
         boolean local)
         throws RemoveException, EJBException, RemoteException
@@ -1090,6 +1120,7 @@
 
     // Called from EJBObjectImpl.remove, EJBLocalObjectImpl.remove,
     // and removeBean above.
+    @Override
     protected void removeBean(EJBLocalRemoteObject ejbo, Method removeMethod,
             boolean local)
         throws RemoveException, EJBException, RemoteException
@@ -1111,7 +1142,7 @@
             preInvoke(i);
             removeBean(i);
         } catch(Exception e) {
-            _logger.log(Level.SEVERE,"entitybean.container.preinvoke_exception",logParams);
+            _logger.log(Level.SEVERE,"entitybean.container.preinvoke_exception", containerInfo);
             _logger.log(Level.SEVERE,"",e);
             i.exception = e;
         } finally {
@@ -1177,14 +1208,14 @@
             cancelTimers(primaryKey);
         } catch ( RemoveException ex ) {
             if(_logger.isLoggable(Level.FINE)) {
-                _logger.log(Level.FINE,"entitybean.container.local_remove_exception",logParams);
+                _logger.log(Level.FINE,"entitybean.container.local_remove_exception", containerInfo);
                 _logger.log(Level.FINE,"",ex);
             }
             throw ex;
         }
         catch ( Exception ex ) {
             if(_logger.isLoggable(Level.FINE)) {
-                _logger.log(Level.FINE,"entitybean.container.remove_bean_exception",logParams);
+                _logger.log(Level.FINE,"entitybean.container.remove_bean_exception", containerInfo);
                 _logger.log(Level.FINE,"",ex);
             }
             throw new EJBException(ex);
@@ -1219,6 +1250,7 @@
      * Remove a bean. Used by the PersistenceManager.
      * This is needed because the PM's remove must bypass tx/security checks.
      */
+    @Override
     public void removeBeanUnchecked(EJBLocalObject localObj) {
         // First convert client EJBLocalObject to EJBLocalObjectImpl
         EJBLocalObjectImpl localObjectImpl =
@@ -1231,6 +1263,7 @@
      * Remove a bean. Used by the PersistenceManager.
      * This is needed because the PM's remove must bypass tx/security checks.
      */
+    @Override
     public void removeBeanUnchecked(Object primaryKey) {
         EJBLocalRemoteObject ejbo;
         if ( isLocal ) {
@@ -1336,6 +1369,7 @@
      * from BaseContainer.postInvokeTx, getReadyEJB,
      * afterBegin, beforeCompletion, passivateEJB.
      */
+    @Override
     protected void forceDestroyBean(EJBContextImpl ctx) {
         // Something bad happened (such as a RuntimeException),
         // so kill the bean and let it be GC'ed
@@ -1394,6 +1428,7 @@
 
     // Called before invoking a bean with no Tx or with a new Tx.
     // Check if the bean is associated with an unfinished tx.
+    @Override
     protected void checkUnfinishedTx(Transaction prevTx, EjbInvocation inv) {
 
         try {
@@ -1415,6 +1450,7 @@
      * Called before executing non-business methods of EJBLocalObject.
      * @exception NoSuchObjectLocalException if the object has been removed.
      */
+    @Override
     protected void checkExists(EJBLocalRemoteObject ejbObj) {
         // Need to call ejbLoad to see if persistent state is removed.
         // However, the non-business methods dont have a transaction attribute.
@@ -1422,12 +1458,14 @@
     }
 
     // Called from BaseContainer.SyncImpl
+    @Override
     protected void afterBegin(EJBContextImpl ctx) {
         EntityContextImpl context  = (EntityContextImpl)ctx;
 
         // Note: EntityBeans are not allowed to be TX_BEAN_MANAGED
-        if ( context.isInState(BeanState.DESTROYED) )
+        if ( context.isInState(BeanState.DESTROYED) ) {
             return;
+        }
 
         if ( !containerStateManager.isNullEJBObject(context)
              || !containerStateManager.isNullEJBLocalObject(context) ) {
@@ -1463,6 +1501,7 @@
     }
 
     // Called from BaseContainer.SyncImpl.beforeCompletion, postInvokeNoTx
+    @Override
     protected void beforeCompletion(EJBContextImpl ctx) {
         EntityContextImpl context = (EntityContextImpl)ctx;
         if ( context.isInState(BeanState.DESTROYED) ) {
@@ -1523,6 +1562,7 @@
     // getting reply from bean). So whatever is done here *MUST* be
     // consistent with releaseContext, and the bean should end up in
     // the correct state.
+    @Override
     protected void afterCompletion(EJBContextImpl ctx, int status) {
         EntityContextImpl context = (EntityContextImpl)ctx;
         if ( context.isInState(BeanState.DESTROYED) ) {
@@ -1670,6 +1710,7 @@
     }
 
     // CacheListener interface
+    @Override
     public void trimEvent(Object primaryKey, Object context) {
         synchronized (asyncTaskSemaphore) {
             passivationCandidates.add(context);
@@ -1692,6 +1733,7 @@
         implements Runnable
     {
 
+        @Override
         public void run() {
             final Thread currentThread = Thread.currentThread();
             final ClassLoader previousClassLoader =
@@ -1706,6 +1748,7 @@
                 } else {
                     java.security.AccessController.doPrivileged(
                             new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             currentThread.setContextClassLoader(myClassLoader);
                             return null;
@@ -1743,6 +1786,7 @@
                 } else {
                     java.security.AccessController.doPrivileged(
                             new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             currentThread.setContextClassLoader(previousClassLoader);
                             return null;
@@ -1755,6 +1799,7 @@
     }
 
     // Called from AbstractCache
+    @Override
     protected boolean passivateEJB(ComponentContext ctx) {
         if (containerState != CONTAINER_STARTED) {
             return false;
@@ -1779,8 +1824,9 @@
         boolean wasPassivated = false;
 
         // check state after locking ctx
-        if ( !context.isInState(BeanState.READY) )
+        if ( !context.isInState(BeanState.READY) ) {
             return false;
+        }
         try {
             invocationManager.preInvoke(inv);
 
@@ -1861,8 +1907,7 @@
             }
             return localObjImpl;
         } catch ( Exception ex ) {
-            _logger.log(Level.SEVERE,"entitybean.container.get_ejb_local_object_exception",
-                        logParams);
+            _logger.log(Level.SEVERE,"entitybean.container.get_ejb_local_object_exception", containerInfo);
             _logger.log(Level.SEVERE,"",ex);
             throw new EJBException(ex);
         }
@@ -1968,7 +2013,7 @@
             return ejbObjImpl;
         }
         catch ( Exception ex ) {
-            _logger.log(Level.FINE, "entitybean.container.get_ejb_context_exception", logParams);
+            _logger.log(Level.FINE, "entitybean.container.get_ejb_context_exception", containerInfo);
             _logger.log(Level.FINE,"",ex);
             throw new EJBException(ex);
         }
@@ -2004,8 +2049,9 @@
 
     // called from addReadyEJB and afterCompletion
     protected void passivateAndPoolEJB(EntityContextImpl context) {
-        if ( context.isInState(BeanState.DESTROYED) || context.isInState(BeanState.POOLED) )
+        if ( context.isInState(BeanState.DESTROYED) || context.isInState(BeanState.POOLED) ) {
             return;
+        }
 
         // if ( context.isPooled() ) {
         // context.isPooled(false);
@@ -2214,12 +2260,14 @@
             this.cache = cache;
         }
 
+        @Override
         public void run() {
             if (timerValid) {
                 cache.trimExpiredEntries(Integer.MAX_VALUE);
             }
         }
 
+    @Override
     public boolean cancel() {
         cache = null;
         return super.cancel();
@@ -2240,6 +2288,7 @@
             this.pkHashCode = primaryKey.hashCode();
         }
 
+        @Override
         public final int hashCode() {
             // Note: this hashcode need not be persistent across
             // activations of this process.
@@ -2251,6 +2300,7 @@
             return pkHashCode;
         }
 
+        @Override
         public final boolean equals(Object obj) {
             if ( !(obj instanceof EJBTxKey) ) {
                 return false;
@@ -2345,38 +2395,34 @@
     } //PoolProperties
 
 
+    @Override
     protected boolean isIdentical(EJBObjectImpl ejbObjImpl, EJBObject other)
             throws RemoteException {
-        if ( other == ejbObjImpl.getStub() ) {
+        if (other == ejbObjImpl.getStub()) {
             return true;
-        } else {
-            try {
-                // EJBObject may be a remote object.
-                // Compare homes. See EJB2.0 spec section 9.8.
-                if ( !getProtocolManager().isIdentical(ejbHomeStub,
-                                              other.getEJBHome()))
-                    return false;
-
-                // Compare primary keys.
-                if (!ejbObjImpl.getPrimaryKey().equals(other.getPrimaryKey())) {
-                    return false;
-                }
-
-                return true;
-            } catch ( Exception ex ) {
-                _logger.log(Level.INFO, "entitybean.container.ejb_comparison_exception",
-                            logParams);
-                _logger.log(Level.INFO, "", ex);
-                throw new RemoteException("Exception in isIdentical()", ex);
+        }
+        try {
+            // EJBObject may be a remote object.
+            // Compare homes. See EJB2.0 spec section 9.8.
+            if (!getProtocolManager().isIdentical(ejbHomeStub, other.getEJBHome())) {
+                return false;
             }
+
+            // Compare primary keys.
+            if (!ejbObjImpl.getPrimaryKey().equals(other.getPrimaryKey())) {
+                return false;
+            }
+
+            return true;
+        } catch (Exception ex) {
+            _logger.log(Level.INFO, "entitybean.container.ejb_comparison_exception", containerInfo);
+            _logger.log(Level.INFO, "", ex);
+            throw new RemoteException("Exception in isIdentical()", ex);
         }
     }
 
 
-    protected void callEJBLoad(EntityBean ejb, EntityContextImpl context,
-                               boolean activeTx)
-        throws Exception
-    {
+    protected void callEJBLoad(EntityBean ejb, EntityContextImpl context, boolean activeTx) throws Exception {
         try {
             context.setInEjbLoad(true);
             ejb.ejbLoad();
@@ -2389,9 +2435,8 @@
         }
     }
 
-    protected void callEJBStore(EntityBean ejb, EntityContextImpl context)
-        throws Exception
-    {
+
+    protected void callEJBStore(EntityBean ejb, EntityContextImpl context) throws Exception {
         try {
             context.setInEjbStore(true);
             ejb.ejbStore();
@@ -2401,8 +2446,8 @@
         }
     }
 
-    protected void callEJBRemove(EntityBean ejb, EntityContextImpl context)
-            throws Exception {
+
+    protected void callEJBRemove(EntityBean ejb, EntityContextImpl context) throws Exception {
         Exception exc = null;
         try {
             // TODO - check if it is needed: context.setInEjbRemove(true);
@@ -2422,6 +2467,7 @@
         }
     }
 
+    @Override
     protected void doTimerInvocationInit(EjbInvocation inv, Object primaryKey)
             throws Exception {
         if( isRemote ) {
@@ -2437,6 +2483,7 @@
         }
     }
 
+    @Override
     protected void doConcreteContainerShutdown(boolean appBeingUndeployed) {
 
         String ejbName = ejbDescriptor.getName();
@@ -2529,12 +2576,13 @@
     private class EntityContextFactory
         implements ObjectFactory
     {
-        private EntityContainer entityContainer;
+        private final EntityContainer entityContainer;
 
         public EntityContextFactory(EntityContainer entityContainer) {
             this.entityContainer = entityContainer;
         }
 
+        @Override
         public Object create(Object param) {
             EntityContextImpl entityCtx = null;
             EjbInvocation ejbInv = null;
@@ -2570,6 +2618,7 @@
         }
 
 
+        @Override
         public void destroy(Object object) {
             if (object == null) {
                 //means that this is called through forceDestroyBean
@@ -2752,6 +2801,7 @@
         readyStore.remove(primaryKey, context);
     }
 
+    @Override
     protected void addProxyInterfacesSetClass(Set proxyInterfacesSet, boolean local) {
         if( ejbDescriptor.getIASEjbExtraDescriptors().isIsReadOnlyBean() ) {
             if (local) {
@@ -2763,6 +2813,7 @@
 
     }
 
+    @Override
     protected void doFlush( EjbInvocation inv ) {
         if( !inv.invocationInfo.flushEnabled ||
             inv.exception != null )  {
@@ -2863,10 +2914,12 @@
         }
 
         //EJBObjectCacheListener interface
+        @Override
         public void handleOverflow(Object key) {
             doCleanup(key);
         }
 
+        @Override
         public void handleBatchOverflow(ArrayList paramKeys) {
             int size = paramKeys.size();
             synchronized (lock) {
@@ -2889,6 +2942,7 @@
             }
         }
 
+        @Override
         public void run() {
             final Thread currentThread = Thread.currentThread();
             final ClassLoader previousClassLoader =
@@ -2902,6 +2956,7 @@
                 } else {
                     java.security.AccessController.doPrivileged(
                             new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             currentThread.setContextClassLoader(myClassLoader);
                             return null;
@@ -2939,6 +2994,7 @@
                 } else {
                     java.security.AccessController.doPrivileged(
                             new java.security.PrivilegedAction() {
+                        @Override
                         public java.lang.Object run() {
                             currentThread.setContextClassLoader(previousClassLoader);
                             return null;
@@ -2961,6 +3017,7 @@
         protected EJBObjectCacheVictimHandler() {
         }
 
+        @Override
         protected void doCleanup(Object key) {
             removeEJBObjectFromStore(key, false);
         }
@@ -2971,48 +3028,57 @@
     class EntityCacheStatsProvider
     implements EjbCacheStatsProviderDelegate
     {
-    private BaseCache cache;
-    private int confMaxCacheSize;
+    private final BaseCache cache;
+    private final int confMaxCacheSize;
 
     EntityCacheStatsProvider(BaseCache cache, int maxCacheSize) {
         this.cache = cache;
         this.confMaxCacheSize = maxCacheSize;
     }
 
+    @Override
     public int getCacheHits() {
         return ((Integer) cache.getStatByName(
             Constants.STAT_BASECACHE_HIT_COUNT)).intValue();
     }
 
+    @Override
     public int getCacheMisses() {
         return ((Integer) cache.getStatByName(
             Constants.STAT_BASECACHE_MISS_COUNT)).intValue();
     }
 
+    @Override
     public int getNumBeansInCache() {
         return cache.getEntryCount();
     }
 
+    @Override
     public int getNumExpiredSessionsRemoved() {
         return 0;
     }
 
+    @Override
     public int getNumPassivationErrors() {
         return totalPassivationErrors;
     }
 
+    @Override
     public int getNumPassivations() {
         return totalPassivations;
     }
 
+    @Override
     public int getNumPassivationSuccess() {
         return totalPassivations - totalPassivationErrors;
     }
 
+    @Override
     public int getMaxCacheSize() {
         return this.confMaxCacheSize;
     }
 
+    @Override
     public void appendStats(StringBuffer sbuf) {
         sbuf.append("[Cache: ")
         .append("Size=").append(getNumBeansInCache()).append("; ")
@@ -3029,7 +3095,7 @@
 class ActiveTxCache {
 
     private EntityContextImpl[]        buckets;
-    private int                bucketMask;
+    private final int                bucketMask;
 
     ActiveTxCache(int numBuckets) {
     this.bucketMask = numBuckets - 1;
diff --git a/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java b/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java
index 1ccf137..683f895 100644
--- a/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java
+++ b/appserver/web/weld-integration/src/main/java/org/glassfish/weld/services/ProxyServicesImpl.java
@@ -17,14 +17,12 @@
 
 package org.glassfish.weld.services;
 
-import com.sun.ejb.ClassGenerator;
+import com.sun.ejb.codegen.ClassGenerator;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
 import java.security.ProtectionDomain;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 import org.glassfish.hk2.api.ServiceLocator;
 import org.glassfish.internal.api.ClassLoaderHierarchy;
 import org.jboss.weld.serialization.spi.ProxyServices;
@@ -44,8 +42,6 @@
  */
 public class ProxyServicesImpl implements ProxyServices {
 
-    private static final AtomicBoolean CL_METHODS_INITIALIZATION_FINISHED = new AtomicBoolean(false);
-
     private final ClassLoaderHierarchy classLoaderHierarchy;
 
 
diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java
index c4283df..473dc3d 100644
--- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java
+++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/generator/ASMClassWriter.java
@@ -17,7 +17,7 @@
 
 package org.glassfish.admin.rest.generator;
 
-import com.sun.ejb.ClassGenerator;
+import com.sun.ejb.codegen.ClassGenerator;
 import com.sun.enterprise.util.SystemPropertyConstants;
 
 import java.io.File;
diff --git a/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java b/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java
index 52736ce..f312c78 100644
--- a/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java
+++ b/nucleus/common/internal-api/src/main/java/org/glassfish/internal/api/ClassLoaderHierarchy.java
@@ -26,7 +26,7 @@
 import com.sun.enterprise.module.ResolveError;
 
 /**
- * This class is responsible foe creation of class loader hierarchy
+ * This class is responsible for creation of class loader hierarchy
  * of an application.
  *
  * @author Sanjeeb.Sahoo@Sun.COM
@@ -132,7 +132,7 @@
         * @return class loader capable of loading public APIs identified by the deployers
         * @throws com.sun.enterprise.module.ResolveError if one of the deployer's public API module is not found.
         */
-       public ClassLoader createApplicationParentCL(ClassLoader parent, DeploymentContext context)
+       ClassLoader createApplicationParentCL(ClassLoader parent, DeploymentContext context)
            throws ResolveError;
 
 }