[Mulgara-svn] r1270 - trunk/src/jar/util/java/org/mulgara/util
pag at mulgara.org
pag at mulgara.org
Thu Sep 25 19:14:02 UTC 2008
Author: pag
Date: 2008-09-25 12:14:02 -0700 (Thu, 25 Sep 2008)
New Revision: 1270
Modified:
trunk/src/jar/util/java/org/mulgara/util/Rmi.java
Log:
Added a mechanism for loading a default port from system properties
Modified: trunk/src/jar/util/java/org/mulgara/util/Rmi.java
===================================================================
--- trunk/src/jar/util/java/org/mulgara/util/Rmi.java 2008-09-24 18:47:03 UTC (rev 1269)
+++ trunk/src/jar/util/java/org/mulgara/util/Rmi.java 2008-09-25 19:14:02 UTC (rev 1270)
@@ -17,6 +17,8 @@
import java.rmi.server.RemoteStub;
import java.rmi.server.UnicastRemoteObject;
+import org.apache.log4j.Logger;
+
/**
* A utility to centralize the port handling for RMI objects.
* This class is not set to handle different protocols. If this is needed, then the
@@ -30,12 +32,30 @@
*/
public class Rmi extends UnicastRemoteObject {
+ /** Logger */
+ private final static Logger logger = Logger.getLogger(Rmi.class.getName());
+
/** Generation UID */
private static final long serialVersionUID = -8087526398171872888L;
+ public static final String CLIENT_PEER_PORT = "mulgara.rmi.peerPort";
+
/** The default port used for exporting objects. */
protected static int defaultPort = 0;
+ // Check if a system property has been set for the default port
+ static {
+ String val = System.getProperty(CLIENT_PEER_PORT);
+ if (val != null) {
+ try {
+ defaultPort = Integer.parseInt(val);
+ } catch (NumberFormatException e) {
+ logger.warn("Unable to parse the client peer port for RMI: " + val);
+ }
+ }
+ }
+
+
/**
* Default constructor. Uses the default port.
* @throws RemoteException If the object could not be exported.
More information about the Mulgara-svn
mailing list