[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java
User: user57 Date: 01/08/08 17:25:00 Modified:src/main/org/jnp/server Main.java Log: o gave the main listen thread a name. Revision ChangesPath 1.9 +4 -2 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Main.java 2001/07/26 02:25:45 1.8 +++ Main.java 2001/08/09 00:25:00 1.9 @@ -38,7 +38,7 @@ @author oberg @author [EMAIL PROTECTED] - @version $Revision: 1.8 $ + @version $Revision: 1.9 $ */ public class Main implements Runnable, MainMBean { @@ -285,9 +285,11 @@ // Package protected - // Protected - + protected void listen() { - new Thread(this).start(); + Thread t = new Thread(this, JNP Server); + t.start(); } // Private --- ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java MainMBean.java
User: starksm Date: 01/07/25 19:25:45 Modified:src/main/org/jnp/server Main.java MainMBean.java Log: Add support for binding the jnp port on a specific address Revision ChangesPath 1.8 +255 -208 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Main.java 2001/06/22 19:08:25 1.7 +++ Main.java 2001/07/26 02:25:45 1.8 @@ -8,10 +8,13 @@ package org.jnp.server; import java.io.FileNotFoundException; +import java.io.InputStream; import java.io.IOException; import java.io.ObjectOutputStream; +import java.net.InetAddress; import java.net.Socket; import java.net.ServerSocket; +import java.net.UnknownHostException; import java.net.URL; import java.rmi.Remote; import java.rmi.RemoteException; @@ -31,219 +34,263 @@ import org.jnp.interfaces.java.javaURLContextFactory; /** A main() entry point for running the jnp naming service implementation as -a standalone process. - -@author oberg -@author [EMAIL PROTECTED] -@version $Revision: 1.7 $ -*/ -public class Main - implements Runnable, MainMBean + a standalone process. + + @author oberg + @author [EMAIL PROTECTED] + @version $Revision: 1.8 $ + */ +public class Main implements Runnable, MainMBean { -// Constants - - -// Attributes -/** The Naming interface server implementation */ -protected NamingServer theServer; -protected MarshalledObject serverStub; -/** The jnp server socket through which the NamingServer stub is vended */ -protected ServerSocket serverSocket; -/** An optional custom client socket factory */ -protected RMIClientSocketFactory clientSocketFactory; -/** An optional custom server socket factory */ -protected RMIServerSocketFactory serverSocketFactory; -/** The class name of the optional custom client socket factory */ -protected String clientSocketFactoryName; -/** The class name of the optional custom server socket factory */ -protected String serverSocketFactoryName; -/** The jnp protocol listening port. The default is 1099, the same as -the RMI registry default port. */ -protected int port = 1099; -/** The RMI port on which the Naming implementation will be exported. The -default is 0 which means use any available port. */ -protected int rmiPort = 0; -protected Category log; + // Constants - + + // Attributes + /** The Naming interface server implementation */ + protected NamingServer theServer; + protected MarshalledObject serverStub; + /** The jnp server socket through which the NamingServer stub is vended */ + protected ServerSocket serverSocket; + /** An optional custom client socket factory */ + protected RMIClientSocketFactory clientSocketFactory; + /** An optional custom server socket factory */ + protected RMIServerSocketFactory serverSocketFactory; + /** The class name of the optional custom client socket factory */ + protected String clientSocketFactoryName; + /** The class name of the optional custom server socket factory */ + protected String serverSocketFactoryName; + /** The interface to bind to. This is useful for multi-homed hosts +that want control over which interfaces accept connections. +*/ + protected InetAddress bindAddress; + /** The serverSocket listen queue depth */ + protected int backlog = 50; + /** The jnp protocol listening port. The default is 1099, the same as +the RMI registry default port. */ + protected int port = 1099; + /** The RMI port on which the Naming implementation will be exported. The +default is 0 which means use any available port. */ + protected int rmiPort = 0; + protected Category log; -// Static -public static void main(String[] args) + // Static + 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(); -} - -// Constructors
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java MainMBean.java
User: starksm Date: 01/07/19 13:09:40 Modified:src/main/org/jnp/server Tag: Branch_2_4 Main.java MainMBean.java Log: Add support for binding the jnp port on a specific address Revision ChangesPath No revision No revision 1.7.2.1 +255 -208 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.7 retrieving revision 1.7.2.1 diff -u -r1.7 -r1.7.2.1 --- Main.java 2001/06/22 19:08:25 1.7 +++ Main.java 2001/07/19 20:09:40 1.7.2.1 @@ -8,10 +8,13 @@ package org.jnp.server; import java.io.FileNotFoundException; +import java.io.InputStream; import java.io.IOException; import java.io.ObjectOutputStream; +import java.net.InetAddress; import java.net.Socket; import java.net.ServerSocket; +import java.net.UnknownHostException; import java.net.URL; import java.rmi.Remote; import java.rmi.RemoteException; @@ -31,219 +34,263 @@ import org.jnp.interfaces.java.javaURLContextFactory; /** A main() entry point for running the jnp naming service implementation as -a standalone process. - -@author oberg -@author [EMAIL PROTECTED] -@version $Revision: 1.7 $ -*/ -public class Main - implements Runnable, MainMBean + a standalone process. + + @author oberg + @author [EMAIL PROTECTED] + @version $Revision: 1.7.2.1 $ + */ +public class Main implements Runnable, MainMBean { -// Constants - - -// Attributes -/** The Naming interface server implementation */ -protected NamingServer theServer; -protected MarshalledObject serverStub; -/** The jnp server socket through which the NamingServer stub is vended */ -protected ServerSocket serverSocket; -/** An optional custom client socket factory */ -protected RMIClientSocketFactory clientSocketFactory; -/** An optional custom server socket factory */ -protected RMIServerSocketFactory serverSocketFactory; -/** The class name of the optional custom client socket factory */ -protected String clientSocketFactoryName; -/** The class name of the optional custom server socket factory */ -protected String serverSocketFactoryName; -/** The jnp protocol listening port. The default is 1099, the same as -the RMI registry default port. */ -protected int port = 1099; -/** The RMI port on which the Naming implementation will be exported. The -default is 0 which means use any available port. */ -protected int rmiPort = 0; -protected Category log; + // Constants - + + // Attributes + /** The Naming interface server implementation */ + protected NamingServer theServer; + protected MarshalledObject serverStub; + /** The jnp server socket through which the NamingServer stub is vended */ + protected ServerSocket serverSocket; + /** An optional custom client socket factory */ + protected RMIClientSocketFactory clientSocketFactory; + /** An optional custom server socket factory */ + protected RMIServerSocketFactory serverSocketFactory; + /** The class name of the optional custom client socket factory */ + protected String clientSocketFactoryName; + /** The class name of the optional custom server socket factory */ + protected String serverSocketFactoryName; + /** The interface to bind to. This is useful for multi-homed hosts +that want control over which interfaces accept connections. +*/ + protected InetAddress bindAddress; + /** The serverSocket listen queue depth */ + protected int backlog = 50; + /** The jnp protocol listening port. The default is 1099, the same as +the RMI registry default port. */ + protected int port = 1099; + /** The RMI port on which the Naming implementation will be exported. The +default is 0 which means use any available port. */ + protected int rmiPort = 0; + protected Category log; -// Static -public static void main(String[] args) + // Static + 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); -
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java
User: starksm Date: 01/06/22 12:08:25 Modified:src/main/org/jnp/server Main.java Log: Handle empty provider url names Accept the name to use for the log4j category Revision ChangesPath 1.7 +6 -2 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Main.java 2001/05/30 01:59:10 1.6 +++ Main.java 2001/06/22 19:08:25 1.7 @@ -35,7 +35,7 @@ @author oberg @author [EMAIL PROTECTED] -@version $Revision: 1.6 $ +@version $Revision: 1.7 $ */ public class Main implements Runnable, MainMBean @@ -81,6 +81,10 @@ // Constructors -- public Main() { + this(Naming); +} +public Main(String categoryName) +{ // Load properties from properties file try { @@ -93,7 +97,7 @@ // Set configuration from the system properties setPort(Integer.getInteger(jnp.port,getPort()).intValue()); setRmiPort(Integer.getInteger(jnp.rmiPort,getRmiPort()).intValue()); -log = Category.getInstance(Naming); +log = Category.getInstance(categoryName); } // Public ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java MainMBean.java
User: starksm Date: 01/05/29 18:59:10 Modified:src/main/org/jnp/server Main.java MainMBean.java Log: Add support for setting the RMI client and server socket factories on which the Naming interface implementation is exported. Revision ChangesPath 1.6 +60 -13jnp/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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Main.java 2001/04/26 07:50:52 1.5 +++ Main.java 2001/05/30 01:59:10 1.6 @@ -16,6 +16,8 @@ import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.MarshalledObject; +import java.rmi.server.RMIClientSocketFactory; +import java.rmi.server.RMIServerSocketFactory; import java.rmi.server.UnicastRemoteObject; import java.util.Properties; @@ -33,7 +35,7 @@ @author oberg @author [EMAIL PROTECTED] -@version $Revision: 1.5 $ +@version $Revision: 1.6 $ */ public class Main implements Runnable, MainMBean @@ -41,13 +43,26 @@ // Constants - // Attributes -NamingServer theServer; -MarshalledObject serverStub; -ServerSocket serverSocket; - -int port = 1099; -int rmiPort = 0; // Anonymous -Category log; +/** The Naming interface server implementation */ +protected NamingServer theServer; +protected MarshalledObject serverStub; +/** The jnp server socket through which the NamingServer stub is vended */ +protected ServerSocket serverSocket; +/** An optional custom client socket factory */ +protected RMIClientSocketFactory clientSocketFactory; +/** An optional custom server socket factory */ +protected RMIServerSocketFactory serverSocketFactory; +/** The class name of the optional custom client socket factory */ +protected String clientSocketFactoryName; +/** The class name of the optional custom server socket factory */ +protected String serverSocketFactoryName; +/** The jnp protocol listening port. The default is 1099, the same as +the RMI registry default port. */ +protected int port = 1099; +/** The RMI port on which the Naming implementation will be exported. The +default is 0 which means use any available port. */ +protected int rmiPort = 0; +protected Category log; // Static public static void main(String[] args) @@ -88,6 +103,32 @@ public void setPort(int p) { port = p; } public int getPort() { return port; } +public String getClientSocketFactory() +{ +return serverSocketFactoryName; +} +public void setClientSocketFactory(String factoryClassName) +throws ClassNotFoundException, InstantiationException, IllegalAccessException +{ +this.clientSocketFactoryName = factoryClassName; +ClassLoader loader = Thread.currentThread().getContextClassLoader(); +Class clazz = loader.loadClass(clientSocketFactoryName); +clientSocketFactory = (RMIClientSocketFactory) clazz.newInstance(); +} + +public String getServerSocketFactory() +{ +return serverSocketFactoryName; +} +public void setServerSocketFactory(String factoryClassName) +throws ClassNotFoundException, InstantiationException, IllegalAccessException +{ +this.serverSocketFactoryName = factoryClassName; +ClassLoader loader = Thread.currentThread().getContextClassLoader(); +Class clazz = loader.loadClass(serverSocketFactoryName); +serverSocketFactory = (RMIServerSocketFactory) clazz.newInstance(); +} + public void start() throws Exception { @@ -99,18 +140,24 @@ NamingContext.setLocal(theServer); // Export server -serverStub = new MarshalledObject(UnicastRemoteObject.exportObject(theServer, rmiPort)); +Remote stub = UnicastRemoteObject.exportObject(theServer, rmiPort, clientSocketFactory, serverSocketFactory); +serverStub = new MarshalledObject(stub); // Start listener try { serverSocket = null; -serverSocket = new ServerSocket(getPort()); -log.info(Started jnpPort= + getPort()+, rmiPort=+getRmiPort()); +serverSocket = new ServerSocket(port); +// If an anonymous port was specified get the actual port used +if( port == 0 ) +port = serverSocket.getLocalPort(); +String msg = Started jnpPort= + port +, rmiPort= + rmiPort +
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java
User: starksm Date: 01/05/24 09:24:04 Modified:src/main/org/jnp/server Tag: Branch_2_2 Main.java Log: Don't use log4j in 2.2 as it conflicts with the default legacy logging Revision ChangesPath No revision No revision 1.5.2.1 +17 -12jnp/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.5 retrieving revision 1.5.2.1 diff -u -r1.5 -r1.5.2.1 --- Main.java 2001/04/26 07:50:52 1.5 +++ Main.java 2001/05/24 16:24:04 1.5.2.1 @@ -33,7 +33,7 @@ @author oberg @author [EMAIL PROTECTED] -@version $Revision: 1.5 $ +@version $Revision: 1.5.2.1 $ */ public class Main implements Runnable, MainMBean @@ -78,7 +78,7 @@ // Set configuration from the system properties setPort(Integer.getInteger(jnp.port,getPort()).intValue()); setRmiPort(Integer.getInteger(jnp.rmiPort,getRmiPort()).intValue()); -log = Category.getInstance(Naming); +//log = Category.getInstance(Naming); } // Public @@ -91,7 +91,7 @@ public void start() throws Exception { -log.info(Starting jnp server); +System.out.println(Starting jnp server); // Create remote object theServer = new NamingServer(); @@ -106,11 +106,12 @@ { serverSocket = null; serverSocket = new ServerSocket(getPort()); -log.info(Started jnpPort= + getPort()+, rmiPort=+getRmiPort()); +System.out.println(Started jnpPort= + getPort()+, rmiPort=+getRmiPort()); listen(); } catch (IOException e) { -log.error(Could not start on port + getPort(), e); +System.err.println(Could not start on port + getPort()); +e.printStackTrace(); } } @@ -118,7 +119,7 @@ { try { -log.info(Stopping); +System.out.println(Stopping); // Unexport server UnicastRemoteObject.unexportObject(theServer, false); @@ -127,10 +128,11 @@ ServerSocket s = serverSocket; serverSocket = null; s.close(); -log.info(Stopped); +System.out.println(Stopped); } catch (Exception e) { -log.error(Exception during shutdown, e); +System.err.println(Exception during shutdown); +e.printStackTrace(); } } @@ -146,14 +148,16 @@ } catch (IOException e) { if (serverSocket == null) return; // Stopped by normal means -log.error(Naming stopped, e); -log.info(Restarting naming); +System.err.println(Naming stopped); +e.printStackTrace(); +System.out.println(Restarting naming); try { start(); } catch (Exception ex) { -log.error(Restart failed, ex); +System.err.println(Restart failed); +ex.printStackTrace(); return; } } @@ -169,7 +173,8 @@ } catch (IOException ex) { -log.error(Error writing response, ex); +System.err.println(Error writing response); +ex.printStackTrace(); } finally { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java NamingServer.java
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 ChangesPath 1.5 +21 -24jnp/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 +++
[JBoss-dev] CVS update: jnp/src/main/org/jnp/server Main.java
User: starksm Date: 01/04/23 00:13:10 Modified:src/main/org/jnp/server Main.java Log: Disable the log4j until this has been tested with JBoss as it appears to interact badly with the default logging Revision ChangesPath 1.4 +19 -15jnp/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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Main.java 2001/04/23 06:08:06 1.3 +++ Main.java 2001/04/23 07:13:10 1.4 @@ -33,7 +33,7 @@ @author $Author: starksm $ @author [EMAIL PROTECTED] -@version $Revision: 1.3 $ +@version $Revision: 1.4 $ */ public class Main implements Runnable, MainMBean @@ -70,7 +70,7 @@ // Set configuration setPort(Integer.getInteger(jnp.port,getPort()).intValue()); -log = Category.getInstance(org.jnp.Naming); +// log = Category.getInstance(org.jnp.Naming); } // Public @@ -83,14 +83,14 @@ public void start() throws Exception { -// Make sure the config file can be found +/* 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,19 +105,20 @@ { serverSocket = null; serverSocket = new ServerSocket(getPort()); -log.info(Started on port + getPort()); +// log.info(Started on port + getPort()); listen(); } catch (IOException e) { -log.error(Could not start on port + getPort(), e); +// log.error(Could not start on port + getPort(), e); +e.printStackTrace(); } } - + public void stop() { try { -log.info(Stopping); +// log.info(Stopping); // Unexport server UnicastRemoteObject.unexportObject(theServer, false); @@ -126,10 +127,11 @@ ServerSocket s = serverSocket; serverSocket = null; s.close(); -log.info(Stopped); +// log.info(Stopped); } catch (Exception e) { -log.error(Exception during shutdown, e); +// log.error(Exception during shutdown, e); +e.printStackTrace(); } } @@ -145,14 +147,15 @@ } 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); +// log.error(Restart failed, ex); +ex.printStackTrace(); return; } } @@ -168,7 +171,8 @@ } catch (IOException ex) { - log.error(Error writing response, ex); +// log.error(Error writing response, ex); +ex.printStackTrace(); } finally { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development