User: starksm
Date: 01/04/26 00:50:52
Modified: src/main/org/jnp/server Main.java NamingServer.java
Log:
Fix bug 419015 and rmiPort externalization.
Revision Changes Path
1.5 +21 -24 jnp/src/main/org/jnp/server/Main.java
Index: Main.java
===================================================================
RCS file: /cvsroot/jboss/jnp/src/main/org/jnp/server/Main.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Main.java 2001/04/23 07:13:10 1.4
+++ Main.java 2001/04/26 07:50:52 1.5
@@ -31,9 +31,9 @@
/** A main() entry point for running the jnp naming service implementation as
a standalone process.
-@author $Author: starksm $
+@author oberg
@author [EMAIL PROTECTED]
-@version $Revision: 1.4 $
+@version $Revision: 1.5 $
*/
public class Main
implements Runnable, MainMBean
@@ -53,6 +53,13 @@
public static void main(String[] args)
throws Exception
{
+ // Make sure the config file can be found
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ URL url = loader.getResource("log4j.properties");
+ if( url == null )
+ System.err.println("Failed to find log4j.properties");
+ else
+ PropertyConfigurator.configure(url);
new Main().start();
}
@@ -68,9 +75,10 @@
// Ignore
}
- // Set configuration
+ // Set configuration from the system properties
setPort(Integer.getInteger("jnp.port",getPort()).intValue());
- // log = Category.getInstance("org.jnp.Naming");
+ setRmiPort(Integer.getInteger("jnp.rmiPort",getRmiPort()).intValue());
+ log = Category.getInstance("Naming");
}
// Public --------------------------------------------------------
@@ -83,14 +91,7 @@
public void start()
throws Exception
{
- /* Make sure the config file can be found
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- URL url = loader.getResource("log4j.properties");
- if( url == null )
- throw new FileNotFoundException("Failed to find log4j.properties");
- PropertyConfigurator.configure(url);
log.info("Starting jnp server");
-*/
// Create remote object
theServer = new NamingServer();
@@ -105,12 +106,11 @@
{
serverSocket = null;
serverSocket = new ServerSocket(getPort());
- // log.info("Started on port " + getPort());
+ log.info("Started jnpPort=" + getPort()+", rmiPort="+getRmiPort());
listen();
} catch (IOException e)
{
- // log.error("Could not start on port " + getPort(), e);
- e.printStackTrace();
+ log.error("Could not start on port " + getPort(), e);
}
}
@@ -118,7 +118,7 @@
{
try
{
- // log.info("Stopping");
+ log.info("Stopping");
// Unexport server
UnicastRemoteObject.unexportObject(theServer, false);
@@ -127,11 +127,10 @@
ServerSocket s = serverSocket;
serverSocket = null;
s.close();
- // log.info("Stopped");
+ log.info("Stopped");
} catch (Exception e)
{
- // log.error("Exception during shutdown", e);
- e.printStackTrace();
+ log.error("Exception during shutdown", e);
}
}
@@ -147,15 +146,14 @@
} catch (IOException e)
{
if (serverSocket == null) return; // Stopped by normal means
- // log.error("Naming stopped", e);
- // log.info("Restarting naming");
+ log.error("Naming stopped", e);
+ log.info("Restarting naming");
try
{
start();
} catch (Exception ex)
{
- // log.error("Restart failed", ex);
- ex.printStackTrace();
+ log.error("Restart failed", ex);
return;
}
}
@@ -171,8 +169,7 @@
}
catch (IOException ex)
{
- // log.error("Error writing response", ex);
- ex.printStackTrace();
+ log.error("Error writing response", ex);
}
finally
{
1.6 +4 -5 jnp/src/main/org/jnp/server/NamingServer.java
Index: NamingServer.java
===================================================================
RCS file: /cvsroot/jboss/jnp/src/main/org/jnp/server/NamingServer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NamingServer.java 2001/04/23 06:08:06 1.5
+++ NamingServer.java 2001/04/26 07:50:52 1.6
@@ -40,7 +40,7 @@
*
* @see <related>
* @author $Author: starksm $
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class NamingServer
implements Naming, java.io.Serializable
@@ -52,9 +52,8 @@
Hashtable table = new Hashtable();
Name prefix;
NamingParser parser = new NamingParser();
-
NamingServer parent;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -398,7 +397,7 @@
{
if (name.size() > 1)
{
- System.out.println("create#"+name.get(0)+"#");
+ // System.out.println("create#"+name.get(0)+"#");
Object ctx = getObject(name);
if (ctx != null)
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development