Weibock Maximilian's modified RemoteObject.java for a configurable RMI
port (see
http://www.objectweb.org/messages/JonasUsers/2000/12/msg00070.html)
required some further alterations in order to work with Jonas 2.2.4
Jeremie.

To save anyone else the trouble of figuring it out, here it is...
Joe

==========================================================
// RemoteObject.java
// NB. For Jeremie.

// CLASS TO PATCH JONAS 2.2.4 SERVER (JEREMIE)
// SO THAT THE PORT USED CAN BE CONFIGURED

package org.objectweb.common;

import org.objectweb.jeremie.libs.contexts.moa.UnicastRemoteObject;
import java.rmi.RemoteException;

import org.objectweb.jonas.common.JProp;
import java.util.Random;

/**Modified version of org.objectweb.common.RemoteObject (for
JEREMIE_jonas.jar)
in order to make the port used for JRMI connections configurable.*/
public class RemoteObject extends UnicastRemoteObject
{
   protected static int serverPort;

   /**The JProp constructor is declared with "throws Exception".
   This means we can't use it directly in the RemoteObject constructor,
   since that only throws a RemoteException [and you can't bracket
super()
   with a try...catch].
   So get jonas.server.port in this static initializer and cache it.*/
   static
   {
      int iDefaultPort = 12341;
      String sDefaultPort = new Integer(iDefaultPort).toString();

      try
      {
         JProp props = new JProp("jonas");
         String sPort =
props.getValue("jonas.server.port",sDefaultPort);
         serverPort = Integer.parseInt(sPort);
      }
      catch (Exception e)
      {
         System.err.println("Error getting jonas.server.port! " + e);
         serverPort = iDefaultPort;
      }

      System.out.println("Set server port to " + serverPort);
   }

   protected RemoteObject() throws RemoteException
   {
      super(serverPort);

        // Normally should comment this out.
      // System.out.println("Used " + serverPort + "!");
   }
}


----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to