User: reverbel
Date: 02/02/18 14:10:35
Modified: iiop/src/main/org/jboss/ejb/plugins/iiop/server
IIOPContainerInvoker.java
Log:
- Better exception handling in stop() method.
- Logging changes: better messages, logging level corrections.
Revision Changes Path
1.13 +63 -27
contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/server/IIOPContainerInvoker.java
Index: IIOPContainerInvoker.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/iiop/src/main/org/jboss/ejb/plugins/iiop/server/IIOPContainerInvoker.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- IIOPContainerInvoker.java 15 Feb 2002 21:42:34 -0000 1.12
+++ IIOPContainerInvoker.java 18 Feb 2002 22:10:34 -0000 1.13
@@ -49,6 +49,8 @@
import org.omg.PortableServer.CurrentHelper;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAManager;
+import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
+import org.omg.PortableServer.POAPackage.ObjectNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import org.omg.PortableServer.Servant;
import org.omg.PortableServer.IdAssignmentPolicyValue;
@@ -61,6 +63,8 @@
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.CosNaming.NamingContextHelper;
+import org.omg.CosNaming.NamingContextPackage.CannotProceed;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
import org.omg.CosNaming.NamingContextPackage.NotFound;
import org.omg.CosNaming.NameComponent;
@@ -116,7 +120,7 @@
* CORBA reference for the corresponding <code>EJBObject</code>.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Francisco Reverbel</a>
- * @version $Revision: 1.12 $
+ * @version $Revision: 1.13 $
*/
public class IIOPContainerInvoker
extends Servant
@@ -126,8 +130,8 @@
// Constants --------------------------------------------------------------
private static final byte[] nullId = createNullId();
- private static final Logger staticLogger = Logger.getLogger(
- IIOPContainerInvoker.class);
+ private static final Logger staticLogger =
+ Logger.getLogger(IIOPContainerInvoker.class);
// Attributes -------------------------------------------------------------
@@ -256,7 +260,7 @@
}
// Create bean method mappings for container invoker
- logger.debug("Bean methods: ---------------------");
+ logger.debug("Bean methods:");
//iri.mapClass(((ContainerInvokerContainer)container).getRemoteClass());
//iri.finishBuild();
@@ -296,7 +300,7 @@
beanRepositoryIds = interfaceAnalysis.getAllTypeIds();
// Create home method mappings for container invoker
- logger.debug("Home methods: ---------------------");
+ logger.debug("Home methods:");
//iri.mapClass(((ContainerInvokerContainer)container).getHomeClass());
//iri.finishBuild();
@@ -500,7 +504,7 @@
+ " to " + jndiName);
}
catch (NamingException e) {
- throw new RuntimeException("Could not bind EJBHome in JNDI:\n" + e);
+ throw new RuntimeException("Cannot bind EJBHome in JNDI:\n" + e);
}
NamingContextExt corbaContext = null;
@@ -521,7 +525,7 @@
}
catch (Exception e) {
throw new RuntimeException(
- "Could not bind EJBHome in CORBA naming service:\n" + e);
+ "Cannot bind EJBHome in CORBA naming service:\n" + e);
}
// TODO: this should be after all beans were deployed
@@ -531,36 +535,64 @@
public void stop()
{
- // TODO: put each call that might throw exceptions within a separate
- // try block so that if one fails the following ones will be
- // executed anyway
try {
-
- // Unbind bean home from the JNDI initial context
+ // Get initial JNDI context and local (in-VM) CORBA naming context
Context initialContext = new InitialContext();
- initialContext.unbind(jndiName);
-
- // Obtain local (in-VM) CORBA naming context
NamingContextExt corbaContext =
NamingContextExtHelper.narrow((org.omg.CORBA.Object)
initialContext.lookup("java:/"
+ CorbaORBService.NAMING_NAME));
+ // Unbind bean home from the JNDI initial context
+ try {
+ initialContext.unbind(jndiName);
+ }
+ catch (NamingException namingException) {
+ logger.error("Cannot unbind EJBHome from JNDI", namingException);
+ }
+
// Unregister bean home from local CORBA naming context
- NameComponent[] name = corbaContext.to_name(jndiName);
- corbaContext.unbind(name);
+ try {
+ NameComponent[] name = corbaContext.to_name(jndiName);
+ corbaContext.unbind(name);
+ }
+ catch (InvalidName invalidName) {
+ logger.error("Cannot unregister EJBHome from CORBA naming service",
+ invalidName);
+ }
+ catch (NotFound notFound) {
+ logger.error("Cannot unregister EJBHome from CORBA naming service",
+ notFound);
+ }
+ catch (CannotProceed cannotProceed) {
+ logger.error("Cannot unregister EJBHome from CORBA naming service",
+ cannotProceed);
+ }
+ }
+ catch (NamingException namingException) {
+ logger.error("Unexpected error in JNDI lookup", namingException);
+ }
- // Deactivate the EJBHome
+ // Deactivate the EJBHome
+ try {
homePOA.deactivate_object(jndiName.getBytes());
-
- // Destroy its POA
+ }
+ catch (WrongPolicy wrongPolicy) {
+ logger.error("Cannot deactivate EJBHome", wrongPolicy);
+ }
+ catch (ObjectNotActive objectNotActive) {
+ logger.error("Cannot deactivate EJBHome", objectNotActive);
+ }
+
+ // Destroy its POA
+ try {
poa.the_POAManager().deactivate(false, /* etherealize_objects */
true /* wait_for_completion */ );
poa.destroy(false, /* etherealize_objects */
false /* wait_for_completion */ );
- }
- catch (Exception e) {
- logger.warn(null, e);
+ }
+ catch (AdapterInactive adapterInactive) {
+ logger.error("Cannot deactivate home POA", adapterInactive);
}
}
@@ -689,7 +721,7 @@
}
}
catch (Exception e) {
- logger.warn(null, e);
+ logger.error("Error getting EJBObject id", e);
throw new UnknownException(e);
}
@@ -726,7 +758,9 @@
}
}
catch (Exception e) {
- logger.warn(null, e);
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exception in EJBObject invocation", e);
+ }
out = (org.omg.CORBA_2_3.portable.OutputStream)
handler.createExceptionReply();
op.writeException(out, e);
@@ -770,7 +804,7 @@
}
}
catch (Exception e) {
- logger.warn(null, e);
+ logger.error("Error getting EJBObject id", e);
throw new UnknownException(e);
}
@@ -1050,7 +1084,9 @@
}
}
catch (Exception e) {
- logger.warn(null, e);
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exception in EJBHome invocation", e);
+ }
out = (org.omg.CORBA_2_3.portable.OutputStream)
handler.createExceptionReply();
op.writeException(out, e);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development