User: mulder
Date: 00/10/24 16:18:01
Modified: src/main/org/jboss/ejb/plugins/jrmp/server
JRMPContainerInvoker.java
Log:
User the new RMI port option instead of hardcoding 4444. The default is
to use an anonymous port (it's OK if the option is left out of the config
file).
Revision Changes Path
1.26 +26 -12
jboss/src/main/org/jboss/ejb/plugins/jrmp/server/JRMPContainerInvoker.java
Index: JRMPContainerInvoker.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jrmp/server/JRMPContainerInvoker.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- JRMPContainerInvoker.java 2000/09/30 00:59:42 1.25
+++ JRMPContainerInvoker.java 2000/10/24 23:18:01 1.26
@@ -71,16 +71,18 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien
Alborini</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.25 $
+ * @version $Revision: 1.26 $
*/
public abstract class JRMPContainerInvoker
extends RemoteServer
implements ContainerRemote, ContainerInvoker, XmlLoadable
{
// Constants -----------------------------------------------------
+ protected final static int ANONYMOUS_PORT = -5;
// Attributes ----------------------------------------------------
protected boolean optimize = false;
+ protected int unicastObjectPort = ANONYMOUS_PORT;
protected Container container;
protected String jndiName;
protected EJBMetaDataImpl ejbMetaData;
@@ -128,8 +130,8 @@
public MarshalledObject invokeHome(MarshalledObject mimo)
throws Exception
{
-
-
+
+
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(container.getClassLoader());
@@ -146,10 +148,10 @@
// passed by the call, not implicitely...
//if (tx == null)
// tx = container.getTransactionManager().getTransaction();
+
-
//DEBUG Logger.debug("JRMPCI:invokeHome "+rmi.getMethod().getName());
-
+
return new MarshalledObject(invokeHome(rmi.getMethod(),
rmi.getArguments(), tx,
rmi.getPrincipal(), rmi.getCredential() ));
} catch (Exception e)
@@ -183,7 +185,7 @@
//DEBUG Logger.debug("JRMPCI:invoke "+m.getName());
-
+
return new MarshalledObject(invoke(id, m, args, tx,
rmi.getPrincipal(), rmi.getCredential()));
} finally
@@ -198,11 +200,11 @@
{
//DEBUG
//DEBUG Logger.debug("JRMPCI (local) :invokeHome "+m.getName());
-//DEBUG if (tx != null)
+//DEBUG if (tx != null)
//DEBUG Logger.debug("Tx is "+tx.toString());
-//DEBUG else
+//DEBUG else
//DEBUG Logger.debug("Tx is null");
-
+
//DEBUG
return container.invokeHome(new MethodInvocation(null , m, args, tx,
identity, credential));
@@ -214,9 +216,9 @@
{
// DEBUG
//DEBUG Logger.debug("JRMPCI (local) :invoke "+m.getName());
-//DEBUG if (tx != null)
+//DEBUG if (tx != null)
//DEBUG Logger.debug("Tx is "+tx.toString());
-//DEBUG else
+//DEBUG else
//DEBUG Logger.debug("Tx is null");
//DEBUG
return container.invoke(new MethodInvocation(id, m, args, tx, identity,
credential));
@@ -342,7 +344,10 @@
new SecureSocketFactory());
*/
- UnicastRemoteObject.exportObject(this,4444);
+ if(unicastObjectPort == ANONYMOUS_PORT)
+ UnicastRemoteObject.exportObject(this);
+ else
+ UnicastRemoteObject.exportObject(this,unicastObjectPort);
GenericProxy.addLocal(container.getBeanMetaData().getJndiName(), this);
InitialContext context = new InitialContext();
@@ -397,6 +402,15 @@
public void importXml(Element element) throws DeploymentException {
String opt = MetaData.getElementContent(MetaData.getUniqueChild(element,
"Optimized"));
optimize = Boolean.valueOf(opt).booleanValue();
+ try {
+ String port = MetaData.getElementContent(MetaData.getUniqueChild(element,
"RMIObjectPort"));
+ unicastObjectPort = Integer.parseInt(port);
+ } catch(NumberFormatException e) {
+ unicastObjectPort = ANONYMOUS_PORT;
+ } catch(DeploymentException e) {
+ unicastObjectPort = ANONYMOUS_PORT;
+ }
+ Logger.debug("Container Invoker RMI Port='"+(unicastObjectPort ==
ANONYMOUS_PORT ? "Anonymous" : Integer.toString(unicastObjectPort))+"'");
Logger.debug("Container Invoker Optimize='"+optimize+"'");
}