Comments are in between the files.

These are obviously against the 2.4.3 branch, but I have checked against cvs
HEAD, and there is nothing there like these changes.

I have a few more patches, but am still working on the debification, so am not
ready to send those off yet.

--- jboss-2.4.3.orig/jnp/src/main/org/jnp/server/Main.java
+++ jboss-2.4.3/jnp/src/main/org/jnp/server/Main.java
@@ -99,6 +99,7 @@
          ClassLoader loader = getClass().getClassLoader();
          InputStream is = loader.getResourceAsStream("jnp.properties");
          System.getProperties().load(is);
+         setBindAddress(System.getProperty("jnp.bindaddress",getBindAddress()));
       }
       catch (Exception e)
       {
@@ -108,6 +109,7 @@
       // Set configuration from the system properties
       setPort(Integer.getInteger("jnp.port",getPort()).intValue());
       setRmiPort(Integer.getInteger("jnp.rmiPort",getRmiPort()).intValue());
+      setBacklog(Integer.getInteger("jnp.backlog",getBacklog()).intValue());
       log = Category.getInstance(categoryName);
    }

@@ -206,6 +208,20 @@
          + ", Client SocketFactory="+clientSocketFactory+", Server 
SocketFactory="+serverSocketFactory;
          log.info(msg);
          listen();
+         Runtime.getRuntime().addShutdownHook(new Thread()
+         {
+            public void run()
+            {
+               System.out.println("Shutting down");
+
+               // Make sure all services are down properly
+               Main.this.stop();
+
+               System.out.println("Shutdown complete");
+            }
+         });
+         log.info("Shutdown hook added");
+
       } catch (IOException e)
       {
          log.error("Could not start on port " + port, e);


I've added a few more semi-usefull options.  Also, I safefully shutdown upon
CTRL-C.  I needed this, so when the init script for the standalone jnp-server
package quits, my log tailer can search for "Shutdown complete" and know the
daemon has stopped running.

--- jboss-2.4.3.orig/jbossmq/src/main/org/jboss/mq/cluster/transport/udp/UDPNodeId.java
+++ jboss-2.4.3/jbossmq/src/main/org/jboss/mq/cluster/transport/udp/UDPNodeId.java
@@ -71,13 +71,8 @@
     * @param  pos   Description of Parameter
     */
    public void readFromByteArray( byte data[], int pos ) {
-      try {
-
-         port = SerializerUtil.readUShortFrom( data, pos );
-         adminPort = SerializerUtil.readUShortFrom( data, pos + 2 );
-
-      } catch ( Exception ignore ) {
-      }
+      port = SerializerUtil.readUShortFrom( data, pos );
+      adminPort = SerializerUtil.readUShortFrom( data, pos + 2 );
    }

    /**

Those 2 code lines do not throw any exception.  jikes reported this to me.

--- 
jboss-2.4.3.orig/contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatServiceSX.java
+++ jboss-2.4.3/contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatServiceSX.java
@@ -19,6 +19,7 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Vector;

 import javax.management.*;
 import javax.servlet.ServletContext;
@@ -54,6 +55,7 @@

     private TomcatEntry tomcat = null;
     private String configFile = null;
+    private String tomcatHome = null;

     public String getName()
     {
@@ -67,6 +69,14 @@
     {
         this.configFile = configFile;
     }
+    public String getTomcatHome()
+    {
+        return tomcatHome;
+    }
+    public void setTomcatHome(String tomcatHome)
+    {
+        this.tomcatHome = tomcatHome;
+    }

     public void startService() throws Exception
     {
@@ -75,11 +85,19 @@
         PrintWriter writer = new PrintWriter(new CategoryStream(category, 
Priority.DEBUG, System.out));
         Logger.setDefaultSink(writer);

-        String[] args = {};
+       Vector vArgs = new Vector();
         if( configFile != null )
         {
-            args = new String[]{"-config", configFile};
+            vArgs.addElement("-config");
+            vArgs.addElement(configFile);
+        }
+        if( tomcatHome != null )
+        {
+            vArgs.addElement("-home");
+            vArgs.addElement(tomcatHome);
         }
+        String[] args = new String[ vArgs.size() ];
+       vArgs.copyInto(args);

         // Start create the embeded tomcat container but don't let it overwrite the 
thread class loader
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
--- 
jboss-2.4.3.orig/contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatServiceSXMBean.java
+++ 
+jboss-2.4.3/contrib/tomcat/src/main/org/jboss/tomcat/EmbeddedTomcatServiceSXMBean.java
@@ -23,4 +23,8 @@
     public String getConfigFile();
     /** Set the tomcat xml configuration file path */
     public void setConfigFile(String configFile);
+    /** Get the tomcat.home path */
+    public String getTomcatHome();
+    /** Set the tomcat.home path */
+    public void setTomcatHome(String tomcatHome);
 }

Setting -Dtomcat.home when starting java doesn't work.  Also, because of the
way the jars are placed(there are symlinks involved), it was auto-detecting
tomcat.home as /usr/share/(from /usr/share/java), which is obviously not
correct.

The above change allows for a new attribute on the mbean, for setting tomcat
home.

----BEGIN GEEK CODE BLOCK----
Version: 3.12
GCS d- s: a-- c+++ UL++++ P+ L++++ !E W+ M o+ K- W--- !O M- !V PS--
PE++ Y+ PGP++ t* 5++ X+ tv b+ D++ G e h*! !r z?
-----END GEEK CODE BLOCK-----
----BEGIN PGP INFO----
Adam Heath <[EMAIL PROTECTED]>        Finger Print | KeyID
67 01 42 93 CA 37 FB 1E    63 C9 80 1D 08 CF 84 0A | DE656B05 PGP
AD46 C888 F587 F8A3 A6DA  3261 8A2C 7DC2 8BD4 A489 | 8BD4A489 GPG
-----END PGP INFO-----


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to