[Jboss-cvs] JBossAS SVN: r56525 - in branches/JBoss_4_0_0_Case10829: . case10829 case10829/src case10829/src/case10829 case10829/src/case10829/jmx case10829/src/client case10829/src/jmx case10829/src/org case10829/src/org/jboss case10829/src/org/jboss/proxy case10829/src/org/jboss/proxy/jmx case10829/src/org/jnp case10829/src/org/jnp/interfaces case10829/src/resources case10829/src/util

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Sep 2 16:03:19 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-09-02 16:03:13 -0400 (Sat, 02 Sep 2006)
New Revision: 56525

Added:
   branches/JBoss_4_0_0_Case10829/case10829/
   branches/JBoss_4_0_0_Case10829/case10829/.classpath
   branches/JBoss_4_0_0_Case10829/case10829/.project
   branches/JBoss_4_0_0_Case10829/case10829/build.xml
   branches/JBoss_4_0_0_Case10829/case10829/readme.txt
   branches/JBoss_4_0_0_Case10829/case10829/src/
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/InterruptableInputStream.java
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutClientSocketFactory.java
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocket.java
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocketFactory.java
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutSocket.java
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfo.java
   branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfoMBean.java
   branches/JBoss_4_0_0_Case10829/case10829/src/client/
   branches/JBoss_4_0_0_Case10829/case10829/src/client/HAClient.java
   branches/JBoss_4_0_0_Case10829/case10829/src/client/J2EEFactory.java
   branches/JBoss_4_0_0_Case10829/case10829/src/jmx/
   branches/JBoss_4_0_0_Case10829/case10829/src/jmx/ThreadDump.java
   branches/JBoss_4_0_0_Case10829/case10829/src/org/
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/RequestIdentityInterceptor.java
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/RequestMonitorInterceptor.java
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/TimeoutInterceptor.java
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingContextFactory.java
   branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingParser.java
   branches/JBoss_4_0_0_Case10829/case10829/src/resources/
   branches/JBoss_4_0_0_Case10829/case10829/src/resources/HANamingService-xmbean.xml
   branches/JBoss_4_0_0_Case10829/case10829/src/resources/cluster-service.xml
   branches/JBoss_4_0_0_Case10829/case10829/src/resources/jboss-service.xml
   branches/JBoss_4_0_0_Case10829/case10829/src/resources/log4j.xml
   branches/JBoss_4_0_0_Case10829/case10829/src/util/
   branches/JBoss_4_0_0_Case10829/case10829/src/util/TestFutureTimeout.java
Log:
Include the case specific files in the repository


Property changes on: branches/JBoss_4_0_0_Case10829/case10829
___________________________________________________________________
Name: svn:ignore
   + output


Added: branches/JBoss_4_0_0_Case10829/case10829/.classpath
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/.classpath	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/.classpath	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="C:/cvs/Releases/jboss-4.0.0/client/concurrent.jar"/>
+	<classpathentry kind="lib" path="C:/cvs/Releases/jboss-4.0.0/client/jbossall-client.jar"/>
+	<classpathentry kind="lib" path="C:/cvs/Releases/jboss-4.0.0/client/log4j.jar"/>
+	<classpathentry kind="output" path="output"/>
+</classpath>

Added: branches/JBoss_4_0_0_Case10829/case10829/.project
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/.project	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/.project	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>case10829</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: branches/JBoss_4_0_0_Case10829/case10829/build.xml
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/build.xml	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/build.xml	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,118 @@
+<project name="Case10829" default="jar">
+	<!-- The jboss-4.0.0 dist location -->
+    <property name="jboss.dist" value="/cvs/Releases/jboss-4.0.0" />
+	<!-- The jboss-4.0.0 branch with updated source -->
+    <property name="jboss.build" value="/svn/Branches/JBoss_4_0_0_Case10829/build/output/jboss-4.0.0" />
+	<!-- The server configuration used for testing -->
+    <property name="jboss.server" value="${jboss.dist}/server/case10829" />
+    
+    <path id="jboss.path">
+        <pathelement location="${jboss.dist}/client/jbossall-client.jar"/>
+        <pathelement location="${jboss.dist}/client/log4j.jar"/>
+        <pathelement location="${jboss.dist}/client/concurrent.jar"/>
+    </path>
+
+    <target name="compile">
+        <mkdir dir="output/classes"/>
+        <javac debug="true" destdir="output/classes">
+            <src path="src" />
+            <classpath refid="jboss.path"/>
+        </javac>
+    </target>
+
+	<!-- Create a jar of case10829 server related classes -->
+    <target name="jar" depends="compile">
+        <jar destfile="output/case10829.jar">
+            <fileset dir="output/classes">
+            	<!-- Exclude the naming overrides -->
+            	<exclude name="org/jnp/interfaces/**" />
+            </fileset>
+        	<!-- Include the source -->
+        	<fileset dir="src">
+        		<include name="**/*.java" />
+        	</fileset>
+        </jar>
+    </target>
+
+	<!-- Install the updated jars/config files to the server config -->
+    <target name="install">
+        <copy file="src/resources/jboss-service.xml" todir="${jboss.server}/conf" />
+        <copy file="src/resources/HANamingService-xmbean.xml" todir="${jboss.server}/conf/xmdesc" />
+        <copy file="src/resources/cluster-service.xml" todir="${jboss.server}/deploy" />
+        <copy file="output/case10829.jar" todir="${jboss.server}/lib" />
+    </target>
+
+	<!-- Run a test jndi client -->
+    <target name="client">
+        <java classname="client.HAClient"
+         fork="true">
+            <classpath>
+                <path refid="jboss.path" />
+            	<pathelement location="jbossall-client.jar"/>
+                <pathelement location="output/classes"/>
+                <pathelement location="src/resources"/>
+            </classpath>
+        </java>
+    </target>
+
+	<!-- Build a jbossall-client.jar with overriden jndi factory classes
+	client proxy interceptors.
+	-->
+	<target name="override-jbossall-client">
+		<mkdir dir="output/jbossall-client" />
+		<unzip dest="output/jbossall-client" src="${jboss.build}/client/jbossall-client.jar" />
+		<zip destfile="jbossall-client.jar">
+			<zipfileset dir="output/jbossall-client" />
+			<zipfileset dir="output/classes">
+				<include name="org/jnp/**" />
+				<include name="org/jboss/proxy/*" />
+			</zipfileset>
+		</zip>
+	</target>
+
+	<!-- Create a zip archive of the updated 4.0.0 source in the standard
+	jboss dist structure assuming an all server configuration.
+	-->
+	<target name="build-patch" depends="override-jbossall-client">
+		<zip destfile="../case10829.zip">
+			<zipfileset dir="${jboss.build}/server/all/lib" prefix="server/case10829/lib">
+				<include name="jboss.jar" />
+				<include name="jbossha.jar" />
+				<include name="jnpserver.jar" />
+			</zipfileset>
+			<zipfileset dir="output" prefix="server/case10829/lib">
+				<include name="case10829.jar" />
+			</zipfileset>
+			<zipfileset dir="." prefix="client">
+				<include name="jbossall-client.jar" />
+			</zipfileset>
+			<zipfileset dir="src/resources" prefix="server/case10829/conf/xmdesc">
+				<include name="HANamingService-xmbean.xml" />
+			</zipfileset>
+			<zipfileset dir="src/resources" prefix="server/case10829/deploy">
+				<include name="cluster-service.xml" />
+			</zipfileset>
+		</zip>
+	</target>
+
+	<!-- Apply the patch to the jboss.dist tree to create a case10829 server
+	configuration with the updated jars/config files. This does not replace the
+	client/jbossall-client.jar.
+	-->
+	<target name="install-patch">
+		<copy todir="${jboss.dist}/server/case10829">
+			<fileset dir="${jboss.dist}/server/all">
+				<exclude name="data**" />
+				<exclude name="log/**" />
+				<exclude name="tmp/**" />
+				<exclude name="work/**" />
+			</fileset>
+	 	</copy>
+		<unzip dest="${jboss.dist}" src="../case10829.zip"
+			overwrite="true">
+			<patternset>
+				<include name="server/**" />
+			</patternset>
+		</unzip>
+	</target>
+</project>

Added: branches/JBoss_4_0_0_Case10829/case10829/readme.txt
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/readme.txt	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/readme.txt	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,47 @@
+[sstark at sstark case10829]$ jar -tf ../case10829.zip
+[sstark at sstark case10829]$ jar -tf ../case10829.zip
+server/case10829/lib/jboss.jar
+server/case10829/lib/jbossha.jar
+server/case10829/lib/jnpserver.jar
+server/case10829/lib/case10829.jar
+server/case10829/conf/xmdesc/HANamingService-xmbean.xml
+server/case10829/deploy/cluster-service.xml
+client/jbossall-client.jar
+
+These are replacements/additions for the corresponding server jars. The changes include:
+server/case10829/lib/jboss.jar - an update to include the pooled invoker patch from a latter release.
+server/case10829/lib/jbossha.jar - updated to the hajndi service to include more logging.
+server/case10829/lib/jnpserver.jar - updated to the jndi service to include more logging.
+server/case10829/lib/case10829.jar - a jar with custom interceptors used in the hajndi xmbean service to add the request tracking. This also includes an updated SystemInfo mbean with expanded thread dump and other cpabilties from 4.0.4.
+server/case10829/conf/xmdesc/HANamingService-xmbean.xml - the hanjndi service xmbean descriptor with custom interceptors.
+server/case10829/deploy/cluster-service.xml - an updated to the cluster service to deploy the hajndi server with the pooled invoker transport.
+client/jbossall-client.jar - the updated jbossall-client.jar with the overriden NamingContextFactory. This version may not be what should be used as the pooled invoker already has a timeout notion.
+
+To get full output regarding the diag on the server side, use these log4j settings:
+<category name="case10829">
+<priority value="TRACE" class="org.jboss.logging.XLevel"/>
+</category>
+<category name="org.jboss.ha.framework.interfaces">
+<priority value="TRACE" class="org.jboss.logging.XLevel"/>
+</category>
+<category name="org.jboss.ha.jndi">
+<priority value="TRACE" class="org.jboss.logging.XLevel"/>
+</category>
+<category name="org.jboss.proxy">
+<priority value="TRACE" class="org.jboss.logging.XLevel"/>
+</category>
+<category name="org.jnp">
+<priority value="TRACE" class="org.jboss.logging.XLevel"/>
+</category>
+
+Client side log4j.xml trace level settings:
+
+  <category name="case10829">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  <category name="org.jnp">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+  </category>
+  
+  case10829 category = the custom socket factory/socket classes category
+  org.jnp category = the jndi 
\ No newline at end of file

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/InterruptableInputStream.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/InterruptableInputStream.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/InterruptableInputStream.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,98 @@
+package case10829;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+
+import org.jboss.logging.Logger;
+
+/** An InputStream that uses the SocketTimeoutException thrown during read
+ * timeouts to check if the thread has been interrupted.
+ *  
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1456 $
+ */
+public class InterruptableInputStream extends InputStream
+{
+   private static Logger log = Logger.getLogger(InterruptableInputStream.class);
+   private boolean trace;
+
+   private InputStream is;
+
+   public InterruptableInputStream(InputStream is)
+   {
+      this.is = is;
+      this.trace = log.isTraceEnabled();
+      log.debug("trace="+trace);
+   }
+
+   public int read() throws IOException
+   {
+      byte[] b = {};
+      int count = internalRead(b, 0, 1);
+      return count > 0 ? b[0] : -1;
+   }
+
+   public int read(byte[] b) throws IOException
+   {
+      return internalRead(b, 0, b.length);
+   }
+
+   public int read(byte[] b, int off, int len) throws IOException
+   {
+      return internalRead(b, off, len);
+   }
+
+   public long skip(long n) throws IOException
+   {
+      return is.skip(n);
+   }
+
+   public int available() throws IOException
+   {
+      return is.available();
+   }
+
+   public void close() throws IOException
+   {
+      is.close();
+   }
+
+   public synchronized void mark(int readlimit)
+   {
+      is.mark(readlimit);
+   }
+
+   public synchronized void reset() throws IOException
+   {
+      is.reset();
+   }
+
+   public boolean markSupported()
+   {
+      return is.markSupported();
+   }
+
+   private int internalRead(byte[] b, int off, int len) throws IOException
+   {
+      int n = -1;
+      while( true )
+      {
+         try
+         {
+            n = is.read(b, off, len);
+            if( trace )
+               log.trace("Read bytes: "+n);
+            return n;
+         }
+         catch(SocketTimeoutException e)
+         {
+            if( trace )
+               log.trace("SocketTimeoutException, bytesTransferred: "+e.bytesTransferred);
+            // Test for thread interrupt
+            if( Thread.interrupted() )
+               throw e;
+         }
+      }
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutClientSocketFactory.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutClientSocketFactory.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutClientSocketFactory.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,86 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package case10829;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.rmi.server.RMIClientSocketFactory;
+import java.net.Socket;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A RMIClientSocketFactory that installs a InterruptableInputStream to be
+ * responsive to thead interruption events.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1456 $
+ */
+public class TimeoutClientSocketFactory
+   implements RMIClientSocketFactory, Serializable
+{
+   private static Logger log = Logger.getLogger(TimeoutClientSocketFactory.class);
+   private static final long serialVersionUID = -920483051658660269L;
+
+   public TimeoutClientSocketFactory()
+   {
+   }
+
+   /**
+    * Create a server socket on the specified port (port 0 indicates
+    * an anonymous port).
+    * @param  port the port number
+    * @return the server socket on the specified port
+    * @exception java.io.IOException if an I/O error occurs during server socket
+    * creation
+    * @since 1.2
+    */
+   public Socket createSocket(String host, int port) throws IOException
+   {
+      Socket s = new Socket(host, port);
+      s.setSoTimeout(3000);
+      TimeoutSocket ts = new TimeoutSocket(s);
+      log.debug("createSocket: "+ts);
+      return ts;
+   }
+   
+   public boolean equals(Object obj)
+   {
+      return obj instanceof TimeoutClientSocketFactory;
+   }
+   public int hashCode()
+   {
+      return getClass().getName().hashCode();
+   }
+   private void writeObject(java.io.ObjectOutputStream out)
+    throws IOException
+    {
+      log.debug("writeObject");
+      out.defaultWriteObject();
+    }
+   private void readObject(java.io.ObjectInputStream in)
+    throws IOException, ClassNotFoundException
+    {
+      log.debug("readObject");
+      in.defaultReadObject();
+    }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocket.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocket.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocket.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,64 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package case10829;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.InetAddress;
+import java.io.IOException;
+
+import org.jboss.logging.Logger;
+
+/** A ServerSocket that returns a TimeoutSocket from the overriden accept.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1456 $
+ */
+public class TimeoutServerSocket extends ServerSocket
+{
+   private static Logger log = Logger.getLogger(TimeoutServerSocket.class);
+
+   public TimeoutServerSocket(int port)
+      throws IOException
+   {
+      this(port, 50);
+   }
+   public TimeoutServerSocket(int port, int backlog)
+      throws IOException
+   {
+      this(port, backlog, null);
+   }
+   public TimeoutServerSocket(int port, int backlog, InetAddress bindAddr)
+      throws IOException
+   {
+      super(port, backlog, bindAddr);
+   }
+
+   public Socket accept() throws IOException
+   {
+      Socket s = super.accept();
+      s.setSoTimeout(1000);
+      TimeoutSocket ts = new TimeoutSocket(s);
+      log.debug("accept, ts: "+ts);
+      return ts;
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocketFactory.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocketFactory.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutServerSocketFactory.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,126 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package case10829;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.UnknownHostException;
+import java.rmi.server.RMIServerSocketFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A RMIServerSocketFactory that installs a InterruptableInputStream to be
+ * responsive to thead interruption events.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1456 $
+ */
+public class TimeoutServerSocketFactory
+   implements RMIServerSocketFactory, Serializable
+{
+   private static Logger log = Logger.getLogger(TimeoutServerSocketFactory.class);
+   /** @since 3.2.6 */
+   static final long serialVersionUID = 7006964274840965634L;
+   protected transient InetAddress bindAddress;
+   protected int backlog = 200;
+
+   /**
+    * Create a socket factory that binds on any address with a default
+    * backlog of 200
+    */
+   public TimeoutServerSocketFactory()
+   {
+      this(null, 200);
+   }
+
+   /**
+    * Create a socket factory with the given bind address
+    */
+   public TimeoutServerSocketFactory(InetAddress bindAddress)
+   {
+      this(bindAddress, 200);
+   }
+
+   /**
+    * Create a socket factory with the given backlog
+    */
+   public TimeoutServerSocketFactory(int backlog)
+   {
+      this(null, backlog);
+   }
+
+   /**
+    * Create a socket factory with the given bind address and backlog
+    */
+   public TimeoutServerSocketFactory(InetAddress bindAddress, int backlog)
+   {
+      this.bindAddress = bindAddress;
+      this.backlog = backlog;
+   }
+
+   public String getBindAddress()
+   {
+      String address = null;
+      if (bindAddress != null)
+         address = bindAddress.getHostAddress();
+      return address;
+   }
+
+   public void setBindAddress(String host) throws UnknownHostException
+   {
+      bindAddress = InetAddress.getByName(host);
+   }
+   public void setBindAddress(InetAddress bindAddress)
+   {
+      this.bindAddress = bindAddress;
+   }
+
+   /**
+    * Create a server socket on the specified port (port 0 indicates
+    * an anonymous port).
+    *
+    * @param port the port number
+    * @return the server socket on the specified port
+    * @throws java.io.IOException if an I/O error occurs during server socket
+    *    creation
+    * @since 1.2
+    */
+   public ServerSocket createServerSocket(int port) throws IOException
+   {
+      ServerSocket activeSocket = new TimeoutServerSocket(port, backlog, bindAddress);
+      log.debug("createServerSocket: "+activeSocket);
+      return activeSocket;
+   }
+
+   public boolean equals(Object obj)
+   {
+      return obj instanceof TimeoutServerSocketFactory;
+   }
+
+   public int hashCode()
+   {
+      return getClass().getName().hashCode();
+   }
+}
\ No newline at end of file

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutSocket.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutSocket.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/TimeoutSocket.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,233 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package case10829;
+
+import java.net.Socket;
+import java.net.InetAddress;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.channels.SocketChannel;
+
+/** A Socket that overrides the getInputStream to return a InterruptableInputStream
+ *  
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1456 $
+ */
+public class TimeoutSocket extends Socket
+{
+   private Socket s;
+
+   public TimeoutSocket(Socket s)
+   {
+      this.s = s;
+   }
+
+   public InetAddress getInetAddress()
+   {
+      return s.getInetAddress();
+   }
+
+   public InetAddress getLocalAddress()
+   {
+      return s.getLocalAddress();
+   }
+
+   public int getPort()
+   {
+      return s.getPort();
+   }
+
+   public int getLocalPort()
+   {
+      return s.getLocalPort();
+   }
+
+   public SocketAddress getRemoteSocketAddress()
+   {
+      return s.getRemoteSocketAddress();
+   }
+
+   public SocketAddress getLocalSocketAddress()
+   {
+      return s.getLocalSocketAddress();
+   }
+
+   public SocketChannel getChannel()
+   {
+      return s.getChannel();
+   }
+
+   public InputStream getInputStream() throws IOException
+   {
+      InputStream is = s.getInputStream();
+      InterruptableInputStream iis = new InterruptableInputStream(is);
+      return iis;
+   }
+
+   public OutputStream getOutputStream() throws IOException
+   {
+      return s.getOutputStream();
+   }
+
+   public void setTcpNoDelay(boolean on) throws SocketException
+   {
+      s.setTcpNoDelay(on);
+   }
+
+   public boolean getTcpNoDelay() throws SocketException
+   {
+      return s.getTcpNoDelay();
+   }
+
+   public void setSoLinger(boolean on, int linger) throws SocketException
+   {
+      s.setSoLinger(on, linger);
+   }
+
+   public int getSoLinger() throws SocketException
+   {
+      return s.getSoLinger();
+   }
+
+   public void sendUrgentData(int data) throws IOException
+   {
+      s.sendUrgentData(data);
+   }
+
+   public void setOOBInline(boolean on) throws SocketException
+   {
+      s.setOOBInline(on);
+   }
+
+   public boolean getOOBInline() throws SocketException
+   {
+      return s.getOOBInline();
+   }
+
+   public synchronized void setSoTimeout(int timeout) throws SocketException
+   {
+      s.setSoTimeout(1000);
+   }
+
+   public synchronized int getSoTimeout() throws SocketException
+   {
+      return s.getSoTimeout();
+   }
+
+   public synchronized void setSendBufferSize(int size) throws SocketException
+   {
+      s.setSendBufferSize(size);
+   }
+
+   public synchronized int getSendBufferSize() throws SocketException
+   {
+      return s.getSendBufferSize();
+   }
+
+   public synchronized void setReceiveBufferSize(int size) throws SocketException
+   {
+      s.setReceiveBufferSize(size);
+   }
+
+   public synchronized int getReceiveBufferSize() throws SocketException
+   {
+      return s.getReceiveBufferSize();
+   }
+
+   public void setKeepAlive(boolean on) throws SocketException
+   {
+      s.setKeepAlive(on);
+   }
+
+   public boolean getKeepAlive() throws SocketException
+   {
+      return s.getKeepAlive();
+   }
+
+   public void setTrafficClass(int tc) throws SocketException
+   {
+      s.setTrafficClass(tc);
+   }
+
+   public int getTrafficClass() throws SocketException
+   {
+      return s.getTrafficClass();
+   }
+
+   public void setReuseAddress(boolean on) throws SocketException
+   {
+      s.setReuseAddress(on);
+   }
+
+   public boolean getReuseAddress() throws SocketException
+   {
+      return s.getReuseAddress();
+   }
+
+   public synchronized void close() throws IOException
+   {
+      s.close();
+   }
+
+   public void shutdownInput() throws IOException
+   {
+      s.shutdownInput();
+   }
+
+   public void shutdownOutput() throws IOException
+   {
+      s.shutdownOutput();
+   }
+
+   public String toString()
+   {
+      return s.toString();
+   }
+
+   public boolean isConnected()
+   {
+      return s.isConnected();
+   }
+
+   public boolean isBound()
+   {
+      return s.isBound();
+   }
+
+   public boolean isClosed()
+   {
+      return s.isClosed();
+   }
+
+   public boolean isInputShutdown()
+   {
+      return s.isInputShutdown();
+   }
+
+   public boolean isOutputShutdown()
+   {
+      return s.isOutputShutdown();
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfo.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfo.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfo.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,869 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package case10829.jmx;
+
+import java.lang.reflect.Method;
+import java.text.DecimalFormat;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.platform.Java;
+
+/**
+ * An MBean that provides a rich view of system information for the JBoss
+ * server in which it is deployed.
+ *
+ * @author <a href="mailto:rickard.oberg at telkel.com">Rickard Oberg</a>
+ * @author <a href="mailto:Scott.Stark at jboss.org">Scott Stark</a>
+ * @author <a href="mailto:hiram.chirino at jboss.org">Hiram Chirino</a>
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:marc.fleury at jboss.org">Marc Fleury</a>
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
+ * @version $Revision: 56514 $
+ */
+public class ServerInfo
+   implements ServerInfoMBean, MBeanRegistration
+{
+   /** Class logger. */
+   private static final Logger log = Logger.getLogger(ServerInfo.class);
+
+   /** Zero */
+   private static final Integer ZERO = new Integer(0);
+
+   /** The MBeanServer we are registered to */
+   private MBeanServer server;
+   
+   /** The cached host name for the server. */
+   private String hostName;
+   
+   /** The cached host address for the server. */
+   private String hostAddress;
+
+   /** The cached jdk5+ ThreadMXBean instance */
+   private Object threadMXBean;
+   
+   /** The cached jdk5+ ManagementFactory.getMemoryPoolMXBeans() method */
+   private Method getMemoryPoolMXBeans;
+   
+   /** The cached jdk5+ MemoryPoolMXBean methods */
+   private Method getName;
+   private Method getType;
+   private Method getUsage;
+   private Method getPeakUsage;
+   
+   /** The cached jdk5+ MemoryUsage methods */
+   private Method getInit;
+   private Method getUsed;
+   private Method getCommitted;
+   private Method getMax;
+   
+   /** The cached jdk5+ ThreadMXBean.getThreadInfo() method */
+   private Method getThreadInfo;
+   private Method getAllThreadIds;
+   private Method getThreadCpuTime;
+
+   /** The cached jdk5+ ThreadInfo methods */
+   private Method getThreadName;
+   private Method getThreadState;
+   private Method getLockName;
+   private Method getStackTrace;
+   
+   /** The cached jdk5+ Thread.getId() method */
+   private Method getThreadId;
+   
+   ///////////////////////////////////////////////////////////////////////////
+   //                               JMX Hooks                               //
+   ///////////////////////////////////////////////////////////////////////////
+   
+   public ObjectName preRegister(MBeanServer server, ObjectName name)
+      throws Exception
+   {
+      this.server = server;
+      // Dump out basic JVM & OS info as INFO priority msgs
+      log.info("Java version: " +
+      System.getProperty("java.version") + "," +
+      System.getProperty("java.vendor"));
+      
+      log.info("Java VM: " +
+      System.getProperty("java.vm.name") + " " +
+      System.getProperty("java.vm.version") + "," +
+      System.getProperty("java.vm.vendor"));
+      
+      log.info("OS-System: " +
+      System.getProperty("os.name") + " " +
+      System.getProperty("os.version") + "," +
+      System.getProperty("os.arch"));
+      
+      // Dump out the entire system properties
+      log.debug("Full System Properties Dump");
+      Enumeration names = System.getProperties().propertyNames();
+      while (names.hasMoreElements())
+      {
+         String pname = (String)names.nextElement();
+            log.debug("    " + pname + ": " + System.getProperty(pname));
+      }
+      
+      // cache a reference to the platform ThreadMXBean
+      // and related Thread/ThreadInfo methods, if available
+      try
+      {
+         ClassLoader cl = Thread.currentThread().getContextClassLoader();            
+         Class clazz = cl.loadClass("java.lang.management.ManagementFactory");
+
+         // cache ThreadMXBean instance
+         Method method = clazz.getMethod("getThreadMXBean", null);
+         this.threadMXBean = method.invoke(null, null);
+         
+         // cache ManagementFactory.getMemoryPoolMXBeans() method
+         this.getMemoryPoolMXBeans = clazz.getMethod("getMemoryPoolMXBeans", null);
+         
+         // cache MemoryPoolMXBean methods
+         clazz = cl.loadClass("java.lang.management.MemoryPoolMXBean");
+         this.getName = clazz.getMethod("getName", null);
+         this.getType = clazz.getMethod("getType", null);
+         this.getUsage = clazz.getMethod("getUsage", null);
+         this.getPeakUsage = clazz.getMethod("getPeakUsage", null);
+         
+         // cache MemoryUsage methods
+         clazz = cl.loadClass("java.lang.management.MemoryUsage");
+         this.getInit = clazz.getMethod("getInit", null);
+         this.getUsed = clazz.getMethod("getUsed", null);
+         this.getCommitted = clazz.getMethod("getCommitted", null);
+         this.getMax = clazz.getMethod("getMax", null);
+         
+         // cache ThreadMXBean.getThreadInfo() method
+         clazz = cl.loadClass("java.lang.management.ThreadMXBean");
+         this.getThreadInfo = clazz.getMethod("getThreadInfo", new Class[] { Long.TYPE, Integer.TYPE } );
+         this.getAllThreadIds = clazz.getMethod("getAllThreadIds", null );
+         this.getThreadCpuTime = clazz.getMethod("getThreadCpuTime", new Class[] { Long.TYPE } );
+
+         // cache ThreadInfo methods
+         clazz = cl.loadClass("java.lang.management.ThreadInfo");
+         this.getThreadName = clazz.getMethod("getThreadName", null);
+         this.getThreadState = clazz.getMethod("getThreadState", null);
+         this.getLockName = clazz.getMethod("getLockName", null);
+         this.getStackTrace = clazz.getMethod("getStackTrace", null);
+         
+         // cache Thread.getId() method
+         clazz = Thread.class;
+         this.getThreadId = clazz.getMethod("getId", null);
+      }
+      catch (Exception e)
+      {
+         log.debug("Cannot access platform ThreadMXBean", e);
+      }
+
+      return name == null ? OBJECT_NAME : name;
+   }
+   
+   public void postRegister(Boolean registrationDone)
+   {
+      // empty
+   }
+   
+   public void preDeregister() throws Exception
+   {
+      // empty
+   }
+   
+   public void postDeregister()
+   {
+      // empty
+   }
+   
+   
+   ///////////////////////////////////////////////////////////////////////////
+   //                            Server Information                         //
+   ///////////////////////////////////////////////////////////////////////////
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getJavaVersion()
+   {
+      return System.getProperty("java.version");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getJavaVendor()
+   {
+      return System.getProperty("java.vendor");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getJavaVMName()
+   {
+      return System.getProperty("java.vm.name");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getJavaVMVersion()
+   {
+      return System.getProperty("java.vm.version");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getJavaVMVendor()
+   {
+      return System.getProperty("java.vm.vendor");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getOSName()
+   {
+      return System.getProperty("os.name");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getOSVersion()
+   {
+      return System.getProperty("os.version");
+   }
+
+   /**
+    * @jmx:managed-attribute
+    */
+   public String getOSArch()
+   {
+      return System.getProperty("os.arch");
+   }
+   
+   /**
+    * @jmx:managed-attribute
+    */
+   public Long getTotalMemory()
+   {
+      return new Long(Runtime.getRuntime().totalMemory());
+   }
+   
+   /**
+    * @jmx:managed-attribute
+    */
+   public Long getFreeMemory()
+   {
+      return new Long(Runtime.getRuntime().freeMemory());
+   }
+   
+   /**
+    * Returns <tt>Runtime.getRuntime().maxMemory()<tt> on 
+    * JDK 1.4 vms or -1 on previous versions.
+    * 
+    * @jmx:managed-attribute
+    */
+   public Long getMaxMemory()
+   {
+      if (Java.isCompatible(Java.VERSION_1_4)) {
+         // Uncomment when JDK 1.4 is the base JVM
+         // return new Long(Runtime.getRuntime().maxMemory());
+
+         // until then use reflection to do the job
+         try {
+            Runtime rt = Runtime.getRuntime();
+            Method m = rt.getClass().getMethod("maxMemory", new Class[0]);
+            return (Long)m.invoke(rt, new Object[0]);
+         }
+         catch (Exception e) {
+            log.error("Operation failed", e);
+         }
+      }
+
+      return new Long(-1);
+   }
+
+   /**
+    * Returns <tt>Runtime.getRuntime().availableProcessors()</tt> on 
+    * JDK 1.4 vms or -1 on previous versions.
+    * 
+    * @jmx:managed-attribute
+    */
+   public Integer getAvailableProcessors()
+   {
+      if (Java.isCompatible(Java.VERSION_1_4)) {
+         // Uncomment when JDK 1.4 is the base JVM
+         // return new Integer(Runtime.getRuntime().availableProcessors());
+
+         // until then use reflection to do the job
+         try {
+            Runtime rt = Runtime.getRuntime();
+            Method m = rt.getClass().getMethod("availableProcessors", new Class[0]);
+            return (Integer)m.invoke(rt, new Object[0]);
+         }
+         catch (Exception e) {
+            log.error("Operation failed", e);
+         }
+      }
+
+      return new Integer(-1);
+   }
+
+   /**
+    * Returns InetAddress.getLocalHost().getHostName();
+    *
+    * @jmx:managed-attribute
+    */
+   public String getHostName()
+   {
+      if (hostName == null)
+      {
+         try
+         {
+            hostName = java.net.InetAddress.getLocalHost().getHostName();
+         }
+         catch (java.net.UnknownHostException e)
+         {
+            log.error("Error looking up local hostname", e);
+            hostName = "<unknown>";
+         }
+      }
+      
+      return hostName;
+   }
+   
+   /**
+    * Returns InetAddress.getLocalHost().getHostAddress();
+    *
+    * @jmx:managed-attribute
+    */
+   public String getHostAddress()
+   {
+      if (hostAddress == null)
+      {
+         try
+         {
+            hostAddress = java.net.InetAddress.getLocalHost().getHostAddress();
+         }
+         catch (java.net.UnknownHostException e)
+         {
+            log.error("Error looking up local address", e);
+            hostAddress = "<unknown>";
+         }
+      }
+      
+      return hostAddress;
+   }
+
+   /**
+    * Return a listing of the thread pools on jdk5+.
+    * 
+    * @jmx:managed-operation
+    * 
+    * @param fancy produce a text-based graph when true
+    */
+   public String listMemoryPools(boolean fancy)
+   {
+      if (getMemoryPoolMXBeans != null)
+      {
+         // running under jdk5+
+         StringBuffer sbuf = new StringBuffer(4196);
+         try
+         {
+            // get the pools
+            List poolList = (List)getMemoryPoolMXBeans.invoke(null, null);
+            sbuf.append("<b>Total Memory Pools:</b> ").append(poolList.size());
+            sbuf.append("<blockquote>");
+            for (Iterator i = poolList.iterator(); i.hasNext(); )
+            {
+               // MemoryPoolMXBean instance
+               Object pool = i.next();
+               String name = (String)getName.invoke(pool, null);
+               // enum MemoryType
+               Object type = getType.invoke(pool, null);
+               sbuf.append("<b>Pool: ").append(name);
+               sbuf.append("</b> (").append(type).append(")");
+               
+               // PeakUsage/CurrentUsage
+               Object peakUsage = getPeakUsage.invoke(pool, null);
+               Object usage = getUsage.invoke(pool, null);
+               
+               sbuf.append("<blockquote>");
+               if (usage != null && peakUsage != null)
+               {
+                  Long init = (Long)getInit.invoke(peakUsage, null);
+                  Long used = (Long)getUsed.invoke(peakUsage, null);
+                  Long committed = (Long)getCommitted.invoke(peakUsage, null);
+                  Long max = (Long)getMax.invoke(peakUsage, null);
+
+                  sbuf.append("Peak Usage    : ");
+                  sbuf.append("init:").append(init);
+                  sbuf.append(", used:").append(used);
+                  sbuf.append(", committed:").append(committed);
+                  sbuf.append(", max:").append(max);
+                  sbuf.append("<br>");
+                  
+                  init = (Long)getInit.invoke(usage, null);
+                  used = (Long)getUsed.invoke(usage, null);
+                  committed = (Long)getCommitted.invoke(usage, null);
+                  max = (Long)getMax.invoke(usage, null);
+
+                  sbuf.append("Current Usage : ");
+                  sbuf.append("init:").append(init);
+                  sbuf.append(", used:").append(used);
+                  sbuf.append(", committed:").append(committed);
+                  sbuf.append(", max:").append(max);
+                  
+                  if (fancy)
+                  {
+                     TextGraphHelper.poolUsage(sbuf, used.longValue(), committed.longValue(), max.longValue());
+                  }
+               }
+               else
+               {
+                  sbuf.append("Memory pool NOT valid!");
+               }
+               sbuf.append("</blockquote><br>");
+            }
+            sbuf.append("</blockquote>");
+         }
+         catch (Exception e)
+         {
+            // ignore
+         }
+         return sbuf.toString();
+      }
+      else
+      {
+         return "<b>Memory pool information available only under a JDK5+ compatible JVM!</b>";
+      }
+   }
+   
+   /**
+    * @jmx:managed-operation
+    */
+   public Integer getActiveThreadCount()
+   {
+      return new Integer(getRootThreadGroup().activeCount());
+   }
+
+   /**
+    * @jmx:managed-operation
+    */
+   public Integer getActiveThreadGroupCount()
+   {
+      return new Integer(getRootThreadGroup().activeGroupCount());
+   }
+   
+   /**
+    * Return a listing of the active threads and thread groups.
+    *
+    * @jmx:managed-operation
+    */
+   public String listThreadDump()
+   {
+      ThreadGroup root = getRootThreadGroup();
+      
+      // Count the threads/groups during our traversal
+      // rather than use the often inaccurate ThreadGroup
+      // activeCount() and activeGroupCount()
+      ThreadGroupCount count = new ThreadGroupCount();
+
+      // traverse
+      String threadGroupInfo = getThreadGroupInfo(root, count);
+      // attach counters
+      String threadDump =
+         "<b>Total Threads:</b> " + count.threads + "<br>" +
+         "<b>Total Thread Groups:</b> " + count.groups + "<br>" +
+         threadGroupInfo;
+      
+      return threadDump;
+   }
+   
+   /**
+    * Return a listing of the active threads and thread groups.
+    *
+    * @jmx:managed-operation
+    */
+   public String listThreadCpuUtilization()
+   {
+      Set threads = getThreadCpuUtilization(); 
+
+      if (threads == null)
+      {
+         return("Thread cpu utilization requires J2SE5+");
+      }
+      else
+      {
+         long totalCPU = 0;
+         StringBuffer buffer = new StringBuffer();
+         buffer.append("<table><tr><th>Thread Name</th><th>CPU (milliseconds)</th></tr>");
+         for (Iterator i = threads.iterator(); i.hasNext();)
+         {
+            ThreadCPU thread = (ThreadCPU) i.next();
+            buffer.append("<tr><td>").append(thread.name).append("</td><td>");
+            buffer.append(thread.cpuTime).append("</td></tr>");
+            totalCPU += thread.cpuTime;
+         }
+         buffer.append("<tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>Total</td><td>");
+         buffer.append(totalCPU).append("</td></tr></table>");
+         return buffer.toString();
+      }
+   }
+   
+   ///////////////////////////////////////////////////////////////////////////
+   //                               Private                                 //
+   ///////////////////////////////////////////////////////////////////////////
+   
+   /**
+    * Get the Thread cpu utilization
+    * 
+    * @return an ordered 
+    */
+   private Set getThreadCpuUtilization()
+   {
+      if (threadMXBean == null)
+         return null;
+      
+      try
+      {
+         TreeSet result = new TreeSet();
+         long[] threads = (long[]) getAllThreadIds.invoke(threadMXBean, null);
+         for (int i = 0; i < threads.length; ++i)
+         {
+            Long id = new Long(threads[i]);
+            Long cpuTime = (Long) getThreadCpuTime.invoke(threadMXBean, new Object[] { id });
+            Object threadInfo = getThreadInfo.invoke(threadMXBean, new Object[] { id, ZERO });
+            String name = (String) getThreadName.invoke(threadInfo, null);
+            result.add(new ThreadCPU(name, cpuTime.longValue()));
+         }
+         return result;
+      }
+      catch (Exception e)
+      {
+         log.warn("Error retrieving thread cpu utiliation", e);
+         return null;
+      }
+   }
+   
+   /*
+    * Traverse to the root thread group
+    */
+   private ThreadGroup getRootThreadGroup()
+   {
+      ThreadGroup group = Thread.currentThread().getThreadGroup();
+      while (group.getParent() != null)
+      {
+         group = group.getParent();
+      }
+
+      return group;
+   }
+   
+   /*
+    * Recurse inside ThreadGroups to create the thread dump
+    */
+   private String getThreadGroupInfo(ThreadGroup group, ThreadGroupCount count)
+   {
+      StringBuffer rc = new StringBuffer();
+      
+      // Visit one more group
+      count.groups++;
+      
+      rc.append("<br><b>");
+      rc.append("Thread Group: " + group.getName());
+      rc.append("</b> : ");
+      rc.append("max priority:" + group.getMaxPriority() +
+                ", demon:" + group.isDaemon());
+      
+      rc.append("<blockquote>");
+      Thread threads[]= new Thread[group.activeCount()];
+      group.enumerate(threads, false);
+      for (int i= 0; i < threads.length && threads[i] != null; i++)
+      {
+         // Visit one more thread
+         count.threads++;
+         
+         rc.append("<b>");
+         rc.append("Thread: " + threads[i].getName());
+         rc.append("</b> : ");
+         rc.append("priority:" + threads[i].getPriority() +
+         ", demon:" + threads[i].isDaemon());
+         // Output extra info with jdk5+, or just <br>
+         outputJdk5ThreadMXBeanInfo(rc, threads[i]);
+      }
+      
+      ThreadGroup groups[]= new ThreadGroup[group.activeGroupCount()];
+      group.enumerate(groups, false);
+      for (int i= 0; i < groups.length && groups[i] != null; i++)
+      {
+         rc.append(getThreadGroupInfo(groups[i], count));
+      }
+      rc.append("</blockquote>");
+      
+      return rc.toString();
+   }
+
+   /*
+    * Complete the output of thread info, with optional stuff
+    * when running under jdk5+, or just change line.
+    */
+   private void outputJdk5ThreadMXBeanInfo(StringBuffer sbuf, Thread thread)
+   {
+      // if ThreadMXBean has been found, we run under jdk5+
+      if (threadMXBean != null)
+      {
+         // use reflection all the way, until we base on jdk5
+         try
+         {
+            // get the threadId
+            Long threadId = (Long)getThreadId.invoke(thread, null);
+            // get the ThreadInfo object for that threadId, max StackTraceElement depth
+            Object threadInfo = getThreadInfo.invoke(threadMXBean,
+                  new Object[] { threadId, new Integer(Integer.MAX_VALUE) });
+            // get misc info from ThreadInfo
+            Object threadState = getThreadState.invoke(threadInfo, null); // enum
+            String threadLockName = (String)getLockName.invoke(threadInfo, null);
+            Object[] stackTrace = (Object[])getStackTrace.invoke(threadInfo, null);
+            
+            sbuf.append(", threadId:").append(threadId);
+            sbuf.append(", threadState:").append(threadState);
+            sbuf.append(", threadLockName:").append(threadLockName);
+            sbuf.append("<br>");
+            if (stackTrace.length > 0)
+            {
+               sbuf.append("<blockquote>");
+               for (int i = 0; i < stackTrace.length; i++)
+               {
+                  sbuf.append(stackTrace[i]).append("<br>");
+               }
+               sbuf.append("</blockquote>");
+            }
+         }
+         catch (Exception ignore)
+         {
+            // empty
+         }
+      }
+      else
+      {
+         // no jdk5+ info to add, just change line
+         sbuf.append("<br>");
+      }
+   }
+   
+   /**
+    * Display the java.lang.Package info for the pkgName
+    *
+    * @jmx:managed-operation
+    */
+   public String displayPackageInfo(String pkgName)
+   {
+      Package pkg = Package.getPackage(pkgName);
+      if( pkg == null )
+         return "<h2>Package:"+pkgName+" Not Found!</h2>";
+
+      StringBuffer info = new StringBuffer("<h2>Package: "+pkgName+"</h2>");
+      displayPackageInfo(pkg, info);
+      return info.toString();
+   }
+
+   private void displayPackageInfo(Package pkg, StringBuffer info)
+   {
+      info.append("<pre>\n");
+      info.append("SpecificationTitle: "+pkg.getSpecificationTitle());
+      info.append("\nSpecificationVersion: "+pkg.getSpecificationVersion());
+      info.append("\nSpecificationVendor: "+pkg.getSpecificationVendor());
+      info.append("\nImplementationTitle: "+pkg.getImplementationTitle());
+      info.append("\nImplementationVersion: "+pkg.getImplementationVersion());
+      info.append("\nImplementationVendor: "+pkg.getImplementationVendor());
+      info.append("\nisSealed: "+pkg.isSealed());
+      info.append("</pre>\n");
+   }
+   
+   ///////////////////////////////////////////////////////////////////////////
+   //                               Inner                                   //
+   ///////////////////////////////////////////////////////////////////////////
+   
+   /*
+    * Inner Helper class for fancy text graphs
+    * 
+    * @author dimitris at jboss.org
+    */
+   private static class TextGraphHelper
+   {
+      // number conversions
+      static final DecimalFormat formatter = new DecimalFormat("#.##");      
+      static final long KILO = 1024;
+      static final long MEGA = 1024 * 1024;
+      static final long GIGA = 1024 * 1024 * 1024;
+      
+      // how many dashes+pipe is 100%
+      static final int factor = 70;
+      static char[] fixedline;
+      static char[] baseline;
+      static char[] barline;
+      static char[] spaces;
+      static
+      {
+         // cache a couple of Strings
+         StringBuffer sbuf0 = new StringBuffer();
+         StringBuffer sbuf1 = new StringBuffer();
+         StringBuffer sbuf2 = new StringBuffer();
+         StringBuffer sbuf3 = new StringBuffer();
+         sbuf0.append('+');
+         sbuf1.append('|');
+         sbuf2.append('|');
+         for (int i = 1; i < factor; i++)
+         {
+            sbuf0.append('-');
+            sbuf1.append('-');
+            sbuf2.append('/');
+            sbuf3.append(' ');
+         }
+         sbuf0.append('+');
+         fixedline = sbuf0.toString().toCharArray();
+         baseline = sbuf1.toString().toCharArray();
+         barline = sbuf2.toString().toCharArray();
+         spaces = sbuf3.toString().toCharArray();
+      }
+      
+      private TextGraphHelper()
+      {
+         // do not instantiate
+      }
+      
+      /*
+       * Make a text graph of a memory pool usage:
+       * 
+       * +---------------------------| committed:10Mb
+       * +-------------------------------------------------+
+       * |////////////////           |                     | max:20Mb
+       * +-------------------------------------------------+
+       * +---------------| used:3Mb
+       *
+       * When max is unknown assume max == committed
+       * 
+       * |-------------------------------------------------| committed:10Mb
+       * +-------------------------------------------------+
+       * |////////////////                                 | max:-1
+       * +-------------------------------------------------+
+       * |---------------| used:3Mb
+       */      
+      public static void poolUsage(StringBuffer sbuf, long used, long committed, long max)
+      {
+         // there is a chance that max is not provided (-1)
+         long assumedMax = (max == -1) ? committed : max;
+         // find out bar lengths
+         int localUsed = (int)(factor * used / assumedMax);
+         int localCommitted = (int)(factor * committed / assumedMax);
+         int localMax = factor;
+
+         sbuf.append("<blockquote><br>");
+         sbuf.append(baseline, 0, localCommitted).append("| committed:").append(outputNumber(committed)).append("<br>");
+         sbuf.append(fixedline).append("<br>");
+         
+         // the difficult part
+         sbuf.append(barline, 0, localUsed);
+         if (localUsed < localCommitted)
+         {
+            sbuf.append(localUsed > 0 ? '/' : '|');
+            sbuf.append(spaces, 0, localCommitted - localUsed - 1);            
+         }
+         sbuf.append('|');
+         if (localCommitted < localMax)
+         {
+            sbuf.append(spaces, 0, localMax - localCommitted - 1);            
+            sbuf.append('|');
+         }
+         sbuf.append(" max:").append(outputNumber(max)).append("<br>");
+         
+         sbuf.append(fixedline).append("<br>");
+         sbuf.append(baseline, 0, localUsed).append("| used:").append(outputNumber(used));
+         sbuf.append("</blockquote>");
+      }
+      
+      private static String outputNumber(long value)
+      {     
+         if (value >= GIGA)
+         {
+            return formatter.format((double)value / GIGA) + "Gb";
+         }
+         else if (value >= MEGA)
+         {
+            return formatter.format((double)value / MEGA) + "Mb";
+         }
+         else if (value >= KILO)
+         {
+            return formatter.format((double)value / KILO) + "Kb";
+         }
+         else if (value >= 0)
+         {
+            return value + "b";
+         }
+         else
+         {
+            return Long.toString(value);
+         }
+      }
+   }
+   
+   private static class ThreadCPU implements Comparable
+   {
+      public String name;
+      public long cpuTime;
+
+      public ThreadCPU(String name, long cpuTime)
+      {
+         this.name = name;
+         this.cpuTime = cpuTime / 1000000; // convert to millis
+      }
+      
+      public int compareTo(Object o)
+      {
+         ThreadCPU other = (ThreadCPU) o;
+         long value = cpuTime - other.cpuTime;
+         if (value > 0)
+            return -1;
+         else if (value < 0)
+            return +1;
+         else
+            return name.compareTo(other.name);
+      }
+   }
+   
+   /*
+    * Simple data holder
+    */
+   private static class ThreadGroupCount
+   {
+      public int threads;
+      public int groups;
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfoMBean.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfoMBean.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/case10829/jmx/ServerInfoMBean.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package case10829.jmx;
+
+import javax.management.ObjectName;
+
+import org.jboss.mx.util.ObjectNameFactory;
+
+public interface ServerInfoMBean
+{
+   /** The default ObjectName */
+   ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.system:type=ServerInfo");
+
+   // Attributes ----------------------------------------------------
+   
+   String getJavaVersion();
+   String getJavaVendor();
+
+   String getJavaVMName();
+   String getJavaVMVersion();
+   String getJavaVMVendor();
+
+   String getOSName();
+   String getOSVersion();
+   String getOSArch();
+
+   Integer getActiveThreadCount();
+   Integer getActiveThreadGroupCount();
+   
+   /** Returns <tt>Runtime.getRuntime().maxMemory()<tt> on JDK 1.4 vms or -1 on previous versions. */
+   Long getMaxMemory();   
+   Long getTotalMemory();
+   Long getFreeMemory();
+
+   /** Returns <tt>Runtime.getRuntime().availableProcessors()</tt> on JDK 1.4 vms or -1 on previous versions. */
+   Integer getAvailableProcessors();
+
+   /** Returns InetAddress.getLocalHost().getHostName(); */
+   String getHostName();
+
+   /** Returns InetAddress.getLocalHost().getHostAddress(); */
+   String getHostAddress();
+
+   // Operations ----------------------------------------------------
+   
+   /**
+    * Return a listing of the thread pools on jdk5+.
+    * @param fancy produce a text-based graph when true
+    */
+   String listMemoryPools(boolean fancy);
+
+   /**
+    * Return a listing of the active threads and thread groups,
+    * and a full stack trace for every thread, on jdk5+.
+    */
+   String listThreadDump();
+
+   /**
+    * Return a sort list of thread cpu utilization.
+    */
+   String listThreadCpuUtilization();
+
+   /**
+    * Display the java.lang.Package info for the pkgName
+    */
+   String displayPackageInfo(String pkgName);
+
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/client/HAClient.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/client/HAClient.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/client/HAClient.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,64 @@
+package client;
+
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.Socket;
+
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+
+
+public class HAClient
+{
+   // Change this to something interesting to lookup
+   //private static String LOOKUP_KEY = "timeout";
+   private static String LOOKUP_KEY = "jmx/invoker/RMIAdaptor";
+
+   public static void main(String[] args) throws Exception
+   {
+      if( args.length > 0 )
+      {
+         
+      }
+
+      /*
+      Socket s = new Socket("192.168.3.120", 1100);
+      InputStream is = s.getInputStream();
+      FileOutputStream out = new FileOutputStream("1100.ser");
+      byte[] tmp = new byte[1024];
+      int n = 0;
+      while( (n = is.read(tmp)) > 0 )
+      {
+         out.write(tmp, 0, n);
+      }
+      out.close();
+      is.close();
+      s.close();
+      */
+
+      Logger log = Logger.getLogger("case10829.HAClient");
+      log.info("isTrace: "+log.isTraceEnabled());
+      log.info("isTrace: "+Logger.getLogger("org.jboss").isTraceEnabled());
+      log.info("isTrace: "+Logger.getLogger("org.jnp.interfaces").isTraceEnabled());
+      log.trace("Logger: "+log);
+      try
+      {
+         while( true )
+         {
+            InitialContext ctx = J2EEFactory.getInitialContext("192.168.3.120:1100,192.168.3.130:1100", true);
+            log.info("Created IC: "+ctx);
+            Object obj = ctx.lookup(LOOKUP_KEY);
+            log.info("Lookup "+LOOKUP_KEY+": "+obj);
+            ctx.close();
+            log.info("Closed IC");
+            Thread.sleep(1000);
+         }
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+         System.exit(1);
+      }
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/client/J2EEFactory.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/client/J2EEFactory.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/client/J2EEFactory.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,226 @@
+package client;
+
+/*
+*
+* Filename: J2EEFactory.java
+* Package:  com.navtech.dataserver.j2ee
+*
+* Copyright (c) 2004 NAVTEQ
+*/
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import javax.ejb.EJBHome;
+
+import java.util.Hashtable;
+
+import org.jnp.interfaces.TimedSocketFactory;
+import org.jboss.logging.Logger;
+
+
+/**
+* J2EEFactory A place to encapsulate J2EE creation logic
+* <p>
+*
+* Issues, refactorings, etc.
+* <p>
+* <ul>
+* <li> 2004.06.22 dwaz: Comments
+* </ul>
+*
+* History
+* <p>
+* <ul>
+* <li> 2006.08.15 ig:  Added jnp.timeout and jnp.sotimeout defaults in the InitialContext
+* <li> 2006.06.20 waz: Add support for requestID in IDManager
+* <li> 2005.07.20 dpg: change the logging level of the appserver message in the
+* log window of Atlas
+* <li> 2005.05.12 waz: Add getPooledConnection
+* <li> 2004.25.04 yis: CR 5488 Added user friendly message to the exception in
+* J2EEReaderProxy
+* <li> 2004.09.20 dwaz: Enable "cutover" to support creation with a seperate
+* url and EJB name
+* <li> 2004.09.13 dwaz: Add changes to home interfaces, host info from 2 tokens
+* <li> 2004.09.17 vz: Added friendly messages to thrwon exceptions in
+* getReaderProxy()
+* <li> 2004.06.22 dwaz: Created
+* </ul>
+*/
+public class J2EEFactory
+{
+   private static final Logger s_logger =
+       Logger.getLogger("J2EEFactory");
+   private static InitialContext iCtx = null;
+
+   /** JBOSS_CTX_FACTORY FIXME_FIELD <p> */
+   public static final String JBOSS_CTX_FACTORY =
+       "org.jnp.interfaces.NamingContextFactory";
+
+   /** JBOSS_PROVIDER_URL FIXME_FIELD <p> */
+   public static final String JBOSS_PROVIDER_URL = "jnp://";
+
+   /**
+    * @param hosts
+    *            Appserver urls
+    *
+    * @return new InitialContext
+    *
+    * @throws NamingException
+    *
+    */
+   protected static InitialContext getInitialContext(String url,
+           boolean disableAutoDiscovery)
+           throws NamingException
+   {
+       InitialContext result = null;
+       Hashtable      props  = new Hashtable();
+
+       /** @todo added for JNDI debugging */
+       s_logger.info("Getting properties for InitialContext");
+       props.put(InitialContext.INITIAL_CONTEXT_FACTORY, JBOSS_CTX_FACTORY);
+       props.put(InitialContext.PROVIDER_URL, JBOSS_PROVIDER_URL + url);
+       props.put(TimedSocketFactory.JNP_TIMEOUT, "30000");
+       props.put(TimedSocketFactory.JNP_SO_TIMEOUT, "30000");
+
+       if (disableAutoDiscovery)
+       {
+           props.put("jnp.disableDiscovery", "true");
+       }
+       else
+       {
+           props.put("jnp.disableDiscovery", "false");
+       }
+
+       // This establishes the security for authorization/authentication
+       // props.put(InitialContext.SECURITY_PRINCIPAL,"username");
+       // props.put(InitialContext.SECURITY_CREDENTIALS,"password");
+
+       /** @todo added for JNDI debugging */
+       s_logger.info("Create InitialContext");
+
+       result = new InitialContext(props);
+
+       /** @todo added for JNDI debugging */
+       s_logger.info("Done Creating InitialContext");
+
+       return result;
+   }
+
+   /**
+    * getHomeInterface An internal method used to get and InitialContext
+    * <p>
+    *
+    *
+    * @param InitialContext
+    *            ctx The context of the JNDI (app) server
+    * @param String
+    *            ejbName The name of the EJB
+    *
+    * @return EJBHome the home interface
+    *
+    * @throws NamingException
+    *             NamingException
+    *
+    */
+   protected static EJBHome getHomeInterface(InitialContext ctx,
+           String ejbName)
+           throws NamingException
+   {
+       boolean done      = false;
+       int     failCtr   = 0;
+       int     failLimit = 5;
+       EJBHome result    = null;
+
+       do
+       {
+           try
+           {
+
+               /** @todo added for JNDI debugging */
+               s_logger.info("looking up " + ejbName + "'s Home Interface");
+
+               result = (EJBHome) ctx.lookup(ejbName);
+
+               /** @todo added for JNDI debugging */
+               s_logger.info("DONE looking up " + ejbName);
+
+               done = true;
+           }
+           catch (Exception re)
+           {
+               s_logger.info("Lookup for EJB " + ejbName
+                            + " failed.  Trying " + (failLimit - failCtr)
+                            + " times.");
+
+               if (failCtr++ == failLimit)
+               {
+                   throw new NamingException(re.getMessage());
+               }
+
+               result = null;
+           }
+       }
+       while (!done);
+
+       return result;
+   }
+
+   /**
+    *     getHomeInterface FIXME_DESCRIBE
+    *     <p>
+    *
+    *
+    *     @param url
+    *                FIXME_PARAM
+    *     @param ejbName
+    *                FIXME_PARAM
+    *
+    *     @return FIXME_RETURN
+    *
+    *     @throws NamingException
+    *                 FIXME_THROWS
+    *
+    */
+   public static EJBHome getHomeInterface(String url, String ejbName)
+           throws NamingException
+   {
+       return getHomeInterface(url, ejbName, true);
+   }
+
+   /**
+    * getHomeInterface A method used by this class and the proxies to get a
+    * home interface. The proxies can use this if there cached Home interface
+    * fails.
+    * <p>
+    *
+    *
+    * @param String
+    *            url One or more hosts and ports that describe appservers
+    * @param String
+    *            ejbName The EJB to lookup
+    *
+    * @return EJBHome The home interface that was looked up
+    *
+    * @throws NamingException
+    *             NamingException
+    *
+    */
+   public static EJBHome getHomeInterface(String url, String ejbName,
+                                          boolean disableAutoDiscovery)
+           throws NamingException
+   {
+
+       /** @todo added for JNDI debugging */
+       s_logger.info("Calling getInitialContext");
+
+       InitialContext ctx = getInitialContext(url, disableAutoDiscovery);
+
+       /** @todo added for JNDI debugging */
+       s_logger.info("get Home Interface");
+
+       return getHomeInterface(ctx, ejbName);
+   }
+
+}
+

Added: branches/JBoss_4_0_0_Case10829/case10829/src/jmx/ThreadDump.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/jmx/ThreadDump.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/jmx/ThreadDump.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,141 @@
+package jmx;
+
+import java.lang.Thread.State;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+/**
+ * Example of getting a programatic thread dump under java5.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ThreadDump
+{
+   static ThreadMXBean threadMXBean;
+
+   /*
+    * Simple data holder
+    */
+   private static class ThreadGroupCount
+   {
+      public int threads;
+      public int groups;
+   }
+   /*
+    * Recurse inside ThreadGroups to create the thread dump
+    */
+   static String getThreadGroupInfo(ThreadGroup group, ThreadGroupCount count, StringBuffer rc)
+   {     
+      // Visit one more group
+      count.groups++;
+      
+      rc.append("<br><b>");
+      rc.append("Thread Group: " + group.getName());
+      rc.append("</b> : ");
+      rc.append("max priority:" + group.getMaxPriority() +
+                ", demon:" + group.isDaemon());
+      
+      rc.append("<blockquote>");
+      Thread threads[]= new Thread[group.activeCount()];
+      group.enumerate(threads, false);
+      for (int i= 0; i < threads.length && threads[i] != null; i++)
+      {
+         // Visit one more thread
+         count.threads++;
+         
+         rc.append("<b>");
+         rc.append("Thread: " + threads[i].getName());
+         rc.append("</b> : ");
+         rc.append("priority:" + threads[i].getPriority() +
+         ", demon:" + threads[i].isDaemon());
+         // Output extra info with jdk5+, or just <br>
+         outputJdk5ThreadMXBeanInfo(rc, threads[i]);
+      }
+      
+      ThreadGroup groups[]= new ThreadGroup[group.activeGroupCount()];
+      group.enumerate(groups, false);
+      for (int i= 0; i < groups.length && groups[i] != null; i++)
+      {
+         rc.append(getThreadGroupInfo(groups[i], count, rc));
+      }
+      rc.append("</blockquote>");
+      
+      return rc.toString();
+   }
+
+   /*
+    * Complete the output of thread info, with optional stuff
+    * when running under jdk5+, or just change line.
+    */
+   static void outputJdk5ThreadMXBeanInfo(StringBuffer sbuf, Thread thread)
+   {
+      // if ThreadMXBean has been found, we run under jdk5+
+      if (threadMXBean != null)
+      {
+         try
+         {
+            // get the threadId
+            Long threadId = thread.getId();
+            // get the ThreadInfo object for that threadId, max StackTraceElement depth
+            ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadId, 100);
+            // get misc info from ThreadInfo
+            State threadState = threadInfo.getThreadState();
+            String threadLockName = threadInfo.getLockName();
+            StackTraceElement[] stackTrace = threadInfo.getStackTrace();
+            System.out.println("StackTrace.lines: "+stackTrace.length);
+            
+            sbuf.append(", threadId:").append(threadId);
+            sbuf.append(", threadState:").append(threadState);
+            sbuf.append(", threadLockName:").append(threadLockName);
+            sbuf.append("<br>");
+            if (stackTrace.length > 0)
+            {
+               sbuf.append("<blockquote>");
+               for (int i = 0; i < stackTrace.length; i++)
+               {
+                  sbuf.append(stackTrace[i]).append("<br>");
+               }
+               sbuf.append("</blockquote>");
+            }
+         }
+         catch (Exception ignore)
+         {
+            // empty
+         }
+      }
+      else
+      {
+         // no jdk5+ info to add, just change line
+         sbuf.append("<br>");
+      }
+   }
+
+   static ThreadGroup getRootThreadGroup()
+   {
+      ThreadGroup group = Thread.currentThread().getThreadGroup();
+      while (group.getParent() != null)
+      {
+         group = group.getParent();
+      }
+
+      return group;
+   }
+
+   public static void main(String[] args)
+   {
+      threadMXBean = ManagementFactory.getThreadMXBean();
+      ThreadGroup root = getRootThreadGroup();
+      
+      // Count the threads/groups during our traversal
+      // rather than use the often inaccurate ThreadGroup
+      // activeCount() and activeGroupCount()
+      ThreadGroupCount count = new ThreadGroupCount();
+
+      // traverse
+      StringBuffer td = new StringBuffer();
+      String threadGroupInfo = getThreadGroupInfo(root, count, td);
+      System.out.println(td);
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/RequestIdentityInterceptor.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/RequestIdentityInterceptor.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/RequestIdentityInterceptor.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,54 @@
+/*
+* JBoss, the OpenSource J2EE WebOS
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+package org.jboss.proxy;
+
+import java.io.Externalizable;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.Invoker;
+import org.jboss.logging.Logger;
+import org.jboss.proxy.Interceptor;
+
+/**
+ * 
+ * 
+ * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.com
+ * @version $Revision: 20303 $
+ */
+public class RequestIdentityInterceptor extends Interceptor
+   implements Externalizable
+{
+   /** The serialVersionUID. */
+   private static final long serialVersionUID = 1L;
+   private static final Logger log = Logger.getLogger(RequestIdentityInterceptor.class);
+   private static int requestID;
+
+   private synchronized int nextRequestID()
+   {
+      return requestID ++;
+   }
+
+   /** Handle methods locally on the client
+    *
+    * @param mi the invocation
+    * @return the result of the invocation
+    * @throws Throwable for any error
+    */
+   public Object invoke(Invocation mi) throws Throwable
+   {
+      InetAddress addr = InetAddress.getLocalHost();
+      String id = addr.toString() + ":" + nextRequestID();
+      mi.setValue(getClass().getName(), id);
+      if( log.isTraceEnabled() )
+         log.trace("Request id: "+id);
+      return getNext().invoke(mi);
+   }
+
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/RequestMonitorInterceptor.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/RequestMonitorInterceptor.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/RequestMonitorInterceptor.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,199 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.proxy.jmx;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.naming.TimeLimitExceededException;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.mx.server.Invocation;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * A jmx interceptor that looks for a unified invocation with a request key
+ * marking an invocation that should be monitored for excess execution time.
+ * If such a request is seen, 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class RequestMonitorInterceptor extends AbstractInterceptor
+{
+   private static Logger log = Logger.getLogger(RequestMonitorInterceptor.class);
+   /** Ideally should be injected, at least needs to have a bound */
+   private static ExecutorService invokePool = Executors.newCachedThreadPool();
+   /** The key used to identify request to monitor */
+   private String requestKey = "org.jboss.proxy.RequestIdentityInterceptor";
+   /** The mbean to invoke when a request exceeds maxTime */
+   private String actionMBeanName = "jboss.system:type=ServerInfo";
+   /** The mbean action to invoke */
+   private String actionOp = "listThreadDump";
+   private boolean trace = log.isTraceEnabled();
+
+   /** The time in milliseconds a request can take before triggering an error */
+   private long maxTime = 30000;
+
+   public String getActionMBeanName()
+   {
+      return actionMBeanName;
+   }
+
+   public void setActionMBeanName(String actionMBeanName)
+   {
+      this.actionMBeanName = actionMBeanName;
+   }
+
+   public String getActionOp()
+   {
+      return actionOp;
+   }
+
+   public void setActionOp(String actionOp)
+   {
+      this.actionOp = actionOp;
+   }
+
+   public long getMaxTime()
+   {
+      return maxTime;
+   }
+
+   public void setMaxTime(long maxTime)
+   {
+      this.maxTime = maxTime;
+   }
+
+   public String getRequestKey()
+   {
+      return requestKey;
+   }
+
+   public void setRequestKey(String requestKey)
+   {
+      this.requestKey = requestKey;
+   }
+
+   // Interceptor overrides -----------------------------------------
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      Object value = null;
+      String requestID = null;
+      Object[] args = invocation.getArgs();
+      if( args != null && args.length > 0 && args[0] instanceof org.jboss.invocation.Invocation )
+      {
+         org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
+         requestID = (String) inv.getValue(requestKey);
+      }
+
+      if( requestID != null )
+      {
+         long start = System.currentTimeMillis();
+         if( trace )
+            log.trace("Start monitored request: "+requestID);
+         try
+         {
+            JmxOp op = new JmxOp(invocation);
+            Future<Object> result = invokePool.submit(op);
+            value = result.get(maxTime, TimeUnit.MILLISECONDS);
+         }
+         catch(TimeoutException t)
+         {
+            try
+            {
+               MBeanServer server = MBeanServerLocator.locateJBoss();
+               Object[] params = {};
+               String[] signature = {};
+               ObjectName actionMBean = new ObjectName(actionMBeanName);
+               String threadDump = (String) server.invoke(actionMBean, actionOp, params, signature);
+               log.warn(threadDump);
+            }
+            catch(Throwable e)
+            {
+               log.warn("Failed to invoke: "+actionOp, e);
+            }
+            throw new TimeLimitExceededException("Operation exceeded the configured time: "+maxTime);
+         }
+         catch(InterruptedException e)
+         {
+            throw e;
+         }
+         catch(ExecutionException e)
+         {
+            Throwable t = e.getCause();
+            throw t;
+         }
+         finally
+         {
+            if( trace )
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               log.trace("End monitored request: "+requestID+", elapsed: "+elapsed);
+            }
+         }
+      }
+      else
+      {
+         value = invocation.nextInterceptor().invoke(invocation);         
+      }
+      return value;
+   }
+
+   class JmxOp implements Callable<Object>
+   {
+      private Invocation invocation;
+      JmxOp(Invocation invocation)
+      {
+         this.invocation = invocation;
+      }
+
+      public Object call() throws Exception
+      {
+         try
+         {
+            Object value = invocation.nextInterceptor().invoke(invocation);
+            return value;
+         }
+         catch(Exception e)
+         {
+            throw e;
+         }
+         catch(Error e)
+         {
+            throw new ExecutionException(e);            
+         }
+         catch(Throwable e)
+         {
+            throw new ExecutionException(e);
+         }
+      }
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/TimeoutInterceptor.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/TimeoutInterceptor.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/org/jboss/proxy/jmx/TimeoutInterceptor.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.proxy.jmx;
+
+import java.util.Arrays;
+
+import org.jboss.logging.Logger;
+import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.mx.server.Invocation;
+
+/**
+ * A jmx interceptor that looks for a unified invocation with a request key
+ * marking an invocation that should be monitored for excess execution time.
+ * If such a request is seen, 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class TimeoutInterceptor extends AbstractInterceptor
+{
+   private static Logger log = Logger.getLogger(TimeoutInterceptor.class);
+   private long maxTime = 60000;
+
+   public long getMaxTime()
+   {
+      return maxTime;
+   }
+   public void setMaxTime(long maxTime)
+   {
+      this.maxTime = maxTime;
+   }
+
+   // Interceptor overrides -----------------------------------------
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      Object value = null;
+      Object[] args = invocation.getArgs();
+      if( args != null && args.length > 0 && args[0] instanceof org.jboss.invocation.Invocation )
+      {
+         org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
+         Object[] invArgs = inv.getArguments();
+         boolean doTimeout = invArgs.length > 0 && invArgs[0].toString().indexOf("timeout") >= 0;
+         log.info("invArgs: "+Arrays.asList(invArgs)+", doTimeout: "+doTimeout);
+         if( doTimeout  )
+         {
+            log.info("Sleeping "+(maxTime/1000)+" seconds");
+            Thread.sleep(maxTime);
+            log.info("Continuing");
+         }
+      }
+
+      value = invocation.nextInterceptor().invoke(invocation);         
+      return value;
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingContextFactory.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingContextFactory.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingContextFactory.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,159 @@
+package org.jnp.interfaces;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.naming.CommunicationException;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+import org.jboss.logging.Logger;
+import org.jnp.interfaces.NamingContext;
+
+/**
+ * An initial context factory that overrides the default NamingContext with a
+ * TimedLookupContext.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class NamingContextFactory implements InitialContextFactory
+{
+   static Logger log = Logger.getLogger(NamingContextFactory.class);
+   static final String TIMEOUT_NAME = "jnp.timeout";
+   static ExecutorService lookupPool = Executors.newCachedThreadPool();
+
+   /**
+    * Create a TimedLookupContext that overrides the lookup to execute it in
+    * a thread, retrying if a response it not in in jnp.timeout milliseconds.
+    */
+   public Context getInitialContext(Hashtable env)
+      throws NamingException
+   {
+      String providerURL = (String) env.get(Context.PROVIDER_URL);
+      String[] serverInfo = {};
+      if( providerURL != null )
+      {
+          serverInfo = providerURL.split(",");
+      }
+      return new TimedLookupContext(env, null, serverInfo);
+   }
+
+   /**
+    * Override the NamingContext.lookup method
+    * 
+    * @author Scott.Stark at jboss.org
+    * @version $Revision:$
+    */
+   static class TimedLookupContext extends NamingContext
+   {
+      private static final long serialVersionUID = 1L;
+
+      // Timeout to wait for a connection, 10 seconds is default
+      private int timeout = 10*1000;
+      private ArrayList<String> serverInfo;
+      private boolean trace = log.isTraceEnabled();
+
+      public TimedLookupContext(Hashtable env, Name prefix, String[] servers)
+         throws NamingException
+      {
+         super(env, prefix, null);
+         String to = (String) env.get(TIMEOUT_NAME);
+         this.serverInfo = new ArrayList<String>();
+         this.serverInfo.addAll(Arrays.asList(servers));
+         Collections.shuffle(this.serverInfo);
+         if( to != null )
+         {
+            timeout = Integer.parseInt(to);
+         }
+         if( trace )
+            log.trace("Created TimedLookupContext, timeout: "+timeout+", servers: "+serverInfo);
+      }
+
+      @Override
+      public Object lookup(final Name name) throws NamingException
+      {
+         Object lookup = null;
+         if( trace )
+            log.trace("Begin lookup, name="+name);
+         for(String server : serverInfo)
+         {
+            CallLookup call = new CallLookup(server, name);
+            Future<Object> result = lookupPool.submit(call);
+            try
+            {
+               lookup = result.get(timeout, TimeUnit.MILLISECONDS);
+               return lookup;
+            }
+            catch(TimeoutException t)
+            {
+               if( trace )
+                  log.trace("Lookup timed out for server: "+server);
+            }
+            catch(InterruptedException e)
+            {
+               // Treat as retryable
+               if( trace )
+                  log.trace("Continuing after interrupt", e);
+               continue;
+            }
+            catch(ExecutionException e)
+            {
+               Throwable t = e.getCause();
+               if( trace )
+                  log.trace("Saw exception during lookup, e="+t.getMessage());
+               if( t instanceof CommunicationException )
+               {
+                  if( trace )
+                     log.trace("Continuing after CommunicationException", e);
+                  continue;
+               }
+               else if( t instanceof NamingException )
+                  throw (NamingException) t;
+               else
+               {
+                  NamingException ne = new NamingException("Unexpected failure on lookup of: "+name);
+                  ne.setRootCause(t);
+                  throw ne;
+               }
+            }
+         }
+         if( trace )
+            log.trace("End lookup, name="+name);
+         CommunicationException ce = new CommunicationException("Failed to resolve lookup for servers: "+Arrays.asList(serverInfo));
+         ce.setRemainingName(name);
+         throw ce;
+      }
+
+      class CallLookup implements Callable<Object>
+      {
+         private String serverInfo;
+         private Name name;
+         CallLookup(String serverInfo, Name name)
+         {
+            this.serverInfo = serverInfo;
+            this.name = name;
+         }
+         public Object call() throws Exception
+         {
+            Hashtable callEnv = (Hashtable) env.clone();
+            callEnv.put(Context.PROVIDER_URL, serverInfo);
+            if( trace )
+               log.trace("Performing lookup against: "+serverInfo);
+            NamingContext ctx = new NamingContext(callEnv, null, null);
+            return ctx.lookup(name);
+         }
+      }
+   }
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingParser.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingParser.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/org/jnp/interfaces/NamingParser.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,58 @@
+/*
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ *
+ * Copyright 1999 by dreamBean Software,
+ * All rights reserved.
+ */
+package org.jnp.interfaces;
+
+import javax.naming.NameParser;
+import javax.naming.Name;
+import javax.naming.CompoundName;
+import javax.naming.NamingException;
+import java.util.Properties;
+
+/** The NamingParser for the jnp naming implementation
+ *      
+ *   @author Scott.Stark at jboss.org
+ *   @version $Revision: 16662 $
+ */
+public class NamingParser
+   implements NameParser, java.io.Serializable
+{
+   // Constants -----------------------------------------------------
+    
+   // Attributes ----------------------------------------------------
+    
+   // Static --------------------------------------------------------
+   /** The unsynchronized syntax properties
+    */
+   static Properties syntax = new FastNamingProperties();
+
+   public static Properties getSyntax()
+   {
+      return syntax;
+   }
+
+   // Constructors --------------------------------------------------
+   
+   // Public --------------------------------------------------------
+
+   // NameParser implementation -------------------------------------
+   public Name parse(String name) 
+   	throws NamingException 
+   {
+   	return new CompoundName(name, syntax);
+   }
+
+   // Y overrides ---------------------------------------------------
+
+   // Package protected ---------------------------------------------
+    
+   // Protected -----------------------------------------------------
+    
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+}

Added: branches/JBoss_4_0_0_Case10829/case10829/src/resources/HANamingService-xmbean.xml
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/resources/HANamingService-xmbean.xml	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/resources/HANamingService-xmbean.xml	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC
+   "-//JBoss//DTD JBOSS XMBEAN 1.1//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd"
+[
+   <!ATTLIST interceptor actionMBeanName CDATA #IMPLIED>
+   <!ATTLIST interceptor actionOp CDATA #IMPLIED>
+   <!ATTLIST interceptor requestKey CDATA #IMPLIED>
+   <!ATTLIST interceptor maxTime CDATA #IMPLIED>
+]>
+
+<!-- The JNDI Naming service XMBean
+$Id: NamingService-xmbean.xml,v 1.1.2.2 2004/10/10 04:30:19 starksm Exp $
+-->
+<mbean>
+   <description>The standard JBoss JNDI naming server with a custom
+      ProxyFactoryInterceptor interceptor that does replacement of NamingContext
+      objects with the detached invoker proxy.
+   </description>
+
+   <descriptors>
+      <interceptors>
+         <!-- An interceptor that monitors requests for excessive time and
+         triggers an action on the indicated mbean if a request times out. The
+         attributes are:
+         actionMBeanName - the object name of the mbean to invoke
+         actionOp - the name of the no arg operation to invoke on the mbean
+         requestKey - the key in an Invocation that identifies an invocation to monitor. This
+            is set by the on the client.
+         maxTime - the maximum time in milliseconds it can take to complete
+            a request.
+         -->
+         <interceptor code="org.jboss.proxy.jmx.RequestMonitorInterceptor"
+            actionMBeanName="jboss.system:type=ServerInfo,version=case10829"
+            actionOp = "listThreadDump"
+            requestKey = "org.jboss.proxy.RequestIdentityInterceptor"
+            maxTime="60000"
+            />
+         <interceptor code="org.jboss.mx.interceptor.PersistenceInterceptor2" />
+         <interceptor code="org.jboss.mx.interceptor.ModelMBeanInterceptor" />
+         <interceptor code="org.jboss.mx.interceptor.ObjectReferenceInterceptor" />
+      </interceptors>
+   </descriptors>
+
+   <class>org.jboss.ha.jndi.DetachedHANamingService</class>
+
+   &defaultAttributes;
+
+   <attribute access="read-only" getMethod="getMethodMap">
+      <name>MethodMap</name>
+      <type>java.util.Map</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getBindAddress" setMethod="setBindAddress">
+      <description>The bind address of the bootstrap lookup socket.</description>
+      <name>BindAddress</name>
+      <type>java.lang.String</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getPort" setMethod="setPort">
+      <description>The listening port for the bootstrap JNP service. Set this to -1
+        to run the NamingService without the JNP invoker listening port.</description>
+      <name>Port</name>
+      <type>int</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getBacklog" setMethod="setBacklog">
+      <description>The bootstrap socket backlog count.</description>
+      <name>Backlog</name>
+      <type>int</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getAutoDiscoveryGroup" setMethod="setAutoDiscoveryGroup">
+      <description>The AutoDiscoveryGroup</description>
+      <name>AutoDiscoveryGroup</name>
+      <type>int</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getAutoDiscoveryAddress" setMethod="setAutoDiscoveryAddress">
+      <description>AutoDiscoveryAddress</description>
+      <name>AutoDiscoveryAddress</name>
+      <type>java.lang.String</type>
+   </attribute>
+   
+
+   <!--
+   <attribute access="read-write" getMethod="getClientSocketFactory" setMethod="setClientSocketFactory">
+      <description>The RMI service java.rmi.server.RMIClientSocketFactory</description>
+      <name>ClientSocketFactory</name>
+      <type>java.lang.String</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getServerSocketFactory" setMethod="setServerSocketFactory">
+      <description>The RMI service java.rmi.server.RMIServerSocketFactory</description>
+      <name>ServerSocketFactory</name>
+      <type>java.lang.String</type>
+   </attribute>
+   -->
+
+   <attribute access="read-write" getMethod="getPartitionName"
+         setMethod="setPartitionName">
+      <name>PartitionName</name>
+      <type>java.lang.String</type>
+   </attribute>
+   <attribute access="write-only" setMethod="setLookupPool">
+      <description>The thread pool service used to control the bootstrap lookups</description>
+      <name>LookupPool</name>
+      <type>org.jboss.util.threadpool.BasicThreadPoolMBean</type>
+   </attribute>
+   <attribute access="read-write" getMethod="getProxyFactoryObjectName" setMethod="setProxyFactoryObjectName">
+      <description>The detached invoker proxy factory to use for the naming
+      service transport.</description>
+      <name>ProxyFactoryObjectName</name>
+      <type>javax.management.ObjectName</type>
+   </attribute>
+
+   <!-- Operations -->
+   <operation>
+      <description>The generic invocation operation used by detached invokers
+         to route requests to the service
+      </description>
+      <name>invoke</name>
+      <parameter>
+         <description>The Naming interface method invocation encapsulation
+         </description>
+         <name>invocation</name>
+         <type>org.jboss.invocation.Invocation</type>
+      </parameter>
+      <return-type>java.lang.Object</return-type>
+   </operation>
+
+   &defaultOperations;   			
+
+</mbean>

Added: branches/JBoss_4_0_0_Case10829/case10829/src/resources/cluster-service.xml
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/resources/cluster-service.xml	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/resources/cluster-service.xml	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Sample Clustering Service Configuration                              -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<server>
+
+  <classpath codebase="lib" archives="jbossha.jar"/>
+
+  <!-- ==================================================================== -->
+  <!-- Cluster Partition: defines cluster                                   -->
+  <!-- ==================================================================== -->
+
+  <mbean code="org.jboss.ha.framework.server.ClusterPartition"
+         name="jboss:service=DefaultPartition">
+         
+    <!-- Name of the partition being built -->
+    <attribute name="PartitionName">DefaultPartition</attribute>
+
+    <!-- The address used to determine the node name -->
+    <attribute name="NodeAddress">${jboss.bind.address}</attribute>
+
+    <!-- Determine if deadlock detection is enabled -->
+    <attribute name="DeadlockDetection">False</attribute>
+     
+    <!-- Max time (in ms) to wait for state transfer to complete. Increase for large states -->
+    <attribute name="StateTransferTimeout">30000</attribute>
+
+    <!-- The JGroups protocol configuration -->
+    <attribute name="PartitionConfig">
+      <Config>
+        <!-- UDP: if you have a multihomed machine,
+             set the bind_addr attribute to the appropriate NIC IP address -->
+        <!-- UDP: On Windows machines, because of the media sense feature
+             being broken with multicast (even after disabling media sense)
+             set the loopback attribute to true -->
+        <UDP mcast_addr="228.1.2.3" mcast_port="45566"
+             ip_ttl="32" ip_mcast="true"
+             mcast_send_buf_size="800000" mcast_recv_buf_size="150000"
+             ucast_send_buf_size="800000" ucast_recv_buf_size="150000"
+             loopback="false" />
+        <PING timeout="2000" num_initial_members="3"
+              up_thread="true" down_thread="true" />
+        <MERGE2 min_interval="10000" max_interval="20000" />
+        <FD shun="true" up_thread="true" down_thread="true"
+            timeout="2500" max_tries="5" />
+        <VERIFY_SUSPECT timeout="3000" num_msgs="3"
+                        up_thread="true" down_thread="true" />
+        <pbcast.NAKACK gc_lag="50" retransmit_timeout="300,600,1200,2400,4800"
+                       max_xmit_size="8192"
+                       up_thread="true" down_thread="true" />
+        <UNICAST timeout="300,600,1200,2400,4800" window_size="100" min_threshold="10"
+                 down_thread="true" />
+        <pbcast.STABLE desired_avg_gossip="20000"
+                       up_thread="true" down_thread="true" />
+        <FRAG frag_size="8192"
+              down_thread="true" up_thread="true" />
+        <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+                    shun="true" print_local_addr="true" />
+        <pbcast.STATE_TRANSFER up_thread="true" down_thread="true" />
+      </Config>
+    </attribute>
+
+  </mbean>
+
+  <!-- ==================================================================== -->
+  <!-- HA Session State Service for SFSB                                    -->
+  <!-- ==================================================================== -->
+
+  <mbean code="org.jboss.ha.hasessionstate.server.HASessionStateService"
+         name="jboss:service=HASessionState">
+     <depends>jboss:service=DefaultPartition</depends>
+    <!-- Name of the partition to which the service is linked -->
+    <attribute name="PartitionName">DefaultPartition</attribute>
+    <!-- JNDI name under which the service is bound -->
+    <attribute name="JndiName">/HASessionState/Default</attribute>
+    <!-- Max delay before cleaning unreclaimed state.
+         Defaults to 30*60*1000 => 30 minutes -->
+    <attribute name="BeanCleaningDelay">0</attribute>    
+  </mbean>
+
+  <!-- ==================================================================== -->
+  <!-- HA JNDI                                                              -->
+  <!-- ==================================================================== -->
+
+  <mbean code="org.jboss.ha.jndi.DetachedHANamingService" 
+         name="jboss:service=HAJNDI"
+      xmbean-dd="resource:xmdesc/HANamingService-xmbean.xml">
+    <!-- Name of the partition to which the service is linked -->
+    <attribute name="PartitionName">DefaultPartition</attribute>
+    <!-- bind address of HA JNDI RMI endpoint -->
+    <attribute name="BindAddress">${jboss.bind.address}</attribute>
+    <!-- Port on which the HA-JNDI stub is made available -->
+    <attribute name="Port">1100</attribute>
+    <!-- Backlog to be used for client-server RMI 
+         invocations during JNDI queries -->
+    <attribute name="Backlog">50</attribute>
+    <!-- Multicast Address and Group used for auto-discovery -->
+    <attribute name="AutoDiscoveryAddress">230.0.0.4</attribute>
+    <attribute name="AutoDiscoveryGroup">1102</attribute>
+    <depends optional-attribute-name="ProxyFactoryObjectName">jboss:service=proxyFactory,type=pooledha,target=HAJNDI</depends>
+    <depends>jboss:service=DefaultPartition</depends>
+  </mbean>
+
+   <!-- the JRMPInvokerHA creates a thread per request.  This implementation uses a pool of threads -->
+   <mbean code="org.jboss.invocation.pooled.server.PooledInvokerHA"
+      name="jboss:service=invoker,type=pooledha">
+      <attribute name="NumAcceptThreads">1</attribute>
+      <attribute name="MaxPoolSize">300</attribute>
+      <attribute name="ClientMaxPoolSize">300</attribute>
+      <attribute name="SocketTimeout">60000</attribute>
+      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
+      <attribute name="ServerBindPort">4446</attribute>
+      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
+      <attribute name="ClientConnectPort">0</attribute>
+      <attribute name="EnableTcpNoDelay">false</attribute>
+      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+      <depends>jboss:service=Naming</depends>
+   </mbean>
+   <mbean code="org.jboss.proxy.generic.ProxyFactoryHA"
+      name="jboss:service=proxyFactory,type=pooledha,target=HAJNDI">
+      <!-- Use the default partition -->
+      <depends optional-attribute-name="PartitionObjectName">jboss:service=DefaultPartition</depends>
+      <!-- Use the PooledInvokerHA -->
+      <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=pooledha</depends>
+      <!-- The load balancing policy -->
+      <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute>
+      <!-- The target MBean -->
+      <attribute name="TargetName">jboss:service=HAJNDI</attribute>
+      <!-- Where to bind the proxy -->
+      <attribute name="JndiName" />
+      <!-- The interface exposed to the client -->
+      <attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute>
+      <!-- Client side behaviour -->
+      <attribute name="ClientInterceptors">
+          <interceptors>
+             <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+             <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+             <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor>
+             <interceptor>org.jboss.proxy.RequestIdentityInterceptor</interceptor>
+             <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+          </interceptors>
+      </attribute>
+   </mbean>
+
+  <mbean code="org.jboss.invocation.jrmp.server.JRMPInvokerHA"
+         name="jboss:service=invoker,type=jrmpha">
+     <attribute name="ServerAddress">${jboss.bind.address}</attribute>
+      <attribute name="RMIClientSocketFactory">case10829.TimeoutClientSocketFactory</attribute>
+      <attribute name="RMIServerSocketFactory">case10829.TimeoutServerSocketFactory</attribute>
+    <!--
+    <attribute name="RMIObjectPort">0</attribute>
+    <attribute name="RMIClientSocketFactory">custom</attribute>
+    <attribute name="RMIServerSocketFactory">custom</attribute>
+    -->
+  </mbean>
+
+
+  <!-- ==================================================================== -->
+  <!-- Distributed cache invalidation                                       -->
+  <!-- ==================================================================== -->
+
+  <mbean code="org.jboss.cache.invalidation.bridges.JGCacheInvalidationBridge" 
+         name="jboss.cache:service=InvalidationBridge,type=JavaGroups">
+     <depends>jboss:service=DefaultPartition</depends>
+     <depends>jboss.cache:service=InvalidationManager</depends>
+     <attribute name="InvalidationManager">jboss.cache:service=InvalidationManager</attribute>
+     <attribute name="PartitionName">DefaultPartition</attribute>
+     <attribute name="BridgeName">DefaultJGBridge</attribute>
+  </mbean>
+
+  <!-- An alternate ServerInfo that implements latter jboss version thread dump
+  behavior and does not require jboss-system.jar to be updated.
+  -->
+  <mbean code="case10829.jmx.ServerInfo" 
+         name="jboss.system:type=ServerInfo,version=case10829"
+         />
+
+</server>

Added: branches/JBoss_4_0_0_Case10829/case10829/src/resources/jboss-service.xml
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/resources/jboss-service.xml	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/resources/jboss-service.xml	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,438 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id: jboss-service.xml,v 1.117 2004/09/09 22:03:00 tdiesler Exp $ -->
+
+<!-- ===================================================================== -->
+<!--  JBoss Server Configuration                                           -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <!-- Load all jars from the JBOSS_DIST/server/<config>/lib directory. This
+     can be restricted to specific jars by specifying them in the archives
+     attribute.
+    -->
+   <classpath codebase="lib" archives="*"/>
+
+
+   <!-- ==================================================================== -->
+   <!-- JSR-77 Single JBoss Server Management Domain                         -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.management.j2ee.LocalJBossServerDomain"
+      name="jboss.management.local:j2eeType=J2EEDomain,name=Manager">
+      <attribute name="MainDeployer">jboss.system:service=MainDeployer</attribute>
+      <attribute name="SARDeployer">jboss.system:service=ServiceDeployer</attribute>
+      <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
+      <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
+      <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
+      <attribute name="CMDeployer">jboss.jca:service=ConnectionFactoryDeployer</attribute>
+      <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
+      <attribute name="MailService">jboss:service=Mail</attribute>
+      <attribute name="JMSService">jboss.mq:service=DestinationManager</attribute>
+      <attribute name="JNDIService">jboss:service=Naming</attribute>
+      <attribute name="JTAService">jboss:service=TransactionManager</attribute>
+      <attribute name="UserTransactionService">jboss:service=ClientUserTransaction</attribute>
+      <attribute name="RMI_IIOPService">jboss:service=CorbaORB</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- XMBean Persistence                                                   -->
+   <!-- ==================================================================== -->   
+   <mbean code="org.jboss.system.pm.AttributePersistenceService"
+      name="jboss:service=AttributePersistenceService"
+      xmbean-dd="resource:xmdesc/AttributePersistenceService-xmbean.xml">
+      <!-- the AttributePersistenceService is persistent, itself -->
+           
+      <!--
+      <attribute name="AttributePersistenceManagerClass">org.jboss.system.pm.XMLAttributePersistenceManager</attribute>
+      <attribute name="AttributePersistenceManagerConfig">
+         <data-directory>data/xmbean-attrs</data-directory>
+      </attribute>      
+      <attribute name="ApmDestroyOnServiceStop">false</attribute>
+      <attribute name="VersionTag"></attribute>
+      -->
+   </mbean>
+
+   <!-- A Thread pool service -->
+   <mbean code="org.jboss.util.threadpool.BasicThreadPool"
+      name="jboss.system:service=ThreadPool">
+      <attribute name="Name">JBoss System Threads</attribute>
+      <attribute name="ThreadGroupName">System Threads</attribute>
+      <!-- How long a thread will live without any tasks in MS -->
+      <attribute name="KeepAliveTime">60000</attribute>
+      <!-- The max number of threads in the pool -->
+      <attribute name="MaximumPoolSize">10</attribute>
+      <!-- The max number of tasks before the queue is full -->
+      <attribute name="MaximumQueueSize">1000</attribute>
+      <!-- The behavior of the pool when a task is added and the queue is full.
+      abort - a RuntimeException is thrown
+      run - the calling thread executes the task
+      wait - the calling thread blocks until the queue has room
+      discard - the task is silently discarded without being run
+      discardOldest - check to see if a task is about to complete and enque
+         the new task if possible, else run the task in the calling thread
+      -->
+      <attribute name="BlockingMode">run</attribute>
+   </mbean>
+
+   <!-- Preload all custom editors for VMs that don't use the thread
+        context class loader when searching for PropertyEditors. Uncomment
+        if your JDK 1.3.0 VM fails to find JBoss PropertyEditors.
+   <mbean code="org.jboss.varia.property.PropertyEditorManagerService"
+     name="jboss:type=Service,name=BootstrapEditors">
+     <attribute name="BootstrapEditors">
+       java.math.BigDecimal=org.jboss.util.propertyeditor.BigDecimalEditor
+       java.lang.Boolean=org.jboss.util.propertyeditor.BooleanEditor
+       java.lang.Class=org.jboss.util.propertyeditor.ClassEditor
+       java.util.Date=org.jboss.util.propertyeditor.DateEditor
+       java.io.File=org.jboss.util.propertyeditor.FileEditor
+       java.net.InetAddress=org.jboss.util.propertyeditor.InetAddressEditor
+       java.lang.Integer=org.jboss.util.propertyeditor.IntegerEditor
+       javax.management.ObjectName=org.jboss.mx.util.propertyeditor.ObjectNameEditor
+       java.util.Properties=org.jboss.util.propertyeditor.PropertiesEditor
+       [Ljava.lang.String;=org.jboss.util.propertyeditor.StringArrayEditor
+       java.net.URL=org.jboss.util.propertyeditor.URLEditor
+     </attribute>
+   </mbean>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- Log4j Initialization                                                 -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.logging.Log4jService"
+      name="jboss.system:type=Log4jService,service=Logging">
+      <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
+      <!-- Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8
+      this needs to be set to avoid a possible deadlock on exception at the
+      appender level. See bug#696819.
+      -->
+      <attribute name="Log4jQuietMode">true</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- JBoss RMI Classloader - only install when available                  -->
+   <!-- ==================================================================== -->
+   <mbean code="org.jboss.util.property.jmx.SystemPropertyClassValue"
+      name="jboss.rmi:type=RMIClassLoader">
+      <attribute name="Property">java.rmi.server.RMIClassLoaderSpi</attribute>
+      <attribute name="ClassName">org.jboss.system.JBossRMIClassLoader</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Service Binding                                                      -->
+   <!-- ==================================================================== -->
+
+   <!-- Automatically activated when generatting the clustering environment -->
+   <!-- @TESTSUITE_CLUSTER_CONFIG@ -->
+
+   <!--
+      | Binding service manager for port/host mapping. This is a sample
+      | config that demonstrates a JBoss instances with a server name 'jboss1'
+      | loading its bindings from an XML file using the ServicesStoreFactory
+      | implementation returned by the XMLServicesStoreFactory.
+      |
+      | ServerName: The unique name assigned to a JBoss server instance for
+      | lookup purposes. This allows a single ServicesStore to handle mulitiple
+      | JBoss servers.
+      |
+      | StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
+      | during initialization that specifies how to connect to the bindings store.
+      | StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
+      | implementation to create to obtain the ServicesStore instance.
+
+   <mbean code="org.jboss.services.binding.ServiceBindingManager"
+     name="jboss.system:service=ServiceBindingManager">
+     <attribute name="ServerName">ports-01</attribute>
+     <attribute name="StoreURL">../docs/examples/binding-manager/sample-bindings.xml</attribute>
+     <attribute name="StoreFactoryClassName">
+       org.jboss.services.binding.XMLServicesStoreFactory
+     </attribute>
+   </mbean>
+
+   -->
+
+
+   <!-- ==================================================================== -->
+   <!-- Class Loading                                                        -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.web.WebService"
+      name="jboss:service=WebService">
+      <attribute name="Port">8083</attribute>
+      <!-- Should resources and non-EJB classes be downloadable -->
+      <attribute name="DownloadServerClasses">true</attribute>
+      <attribute name="Host">${jboss.bind.address}</attribute>
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- JNDI                                                                 -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.naming.NamingService"
+      name="jboss:service=Naming">
+      <!-- The call by value mode. true if all lookups are unmarshalled using
+      the caller's TCL, false if in VM lookups return the value by reference.
+      -->
+      <attribute name="CallByValue">false</attribute>
+      <!-- The listening port for the bootstrap JNP service. Set this to -1
+        to run the NamingService without the JNP invoker listening port.
+      -->
+      <attribute name="Port">1099</attribute>
+      <!-- The bootstrap JNP server bind address. This also sets the default
+      RMI service bind address. Empty == all addresses
+       -->
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+      <!-- The port of the RMI naming service, 0 == anonymous -->
+      <attribute name="RmiPort">1098</attribute>
+      <!-- The RMI service bind address. Empty == all addresses
+       -->
+      <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
+      <!-- The thread pool service used to control the bootstrap lookups -->
+      <depends optional-attribute-name="LookupPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+   </mbean>
+
+   <mbean code="org.jboss.naming.JNDIView"
+   		name="jboss:service=JNDIView"
+   		xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Security                                                             -->
+   <!-- ==================================================================== -->
+
+   <mbean code="org.jboss.security.plugins.SecurityConfig"
+      name="jboss.security:service=SecurityConfig">
+      <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>
+   </mbean>
+   <mbean code="org.jboss.security.auth.login.XMLLoginConfig"
+      name="jboss.security:service=XMLLoginConfig">
+      <attribute name="ConfigResource">login-config.xml</attribute>
+   </mbean>
+
+   <!-- JAAS security manager and realm mapping -->
+   <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
+      name="jboss.security:service=JaasSecurityManager">
+      <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
+      <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
+      <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
+      in seconds.
+      If you want to disable caching of security credentials, set this to 0 to
+      force authentication to occur every time. This has no affect if the
+      AuthenticationCacheJndiName has been changed from the default value.
+      -->
+      <attribute name="DefaultCacheTimeout">1800</attribute>
+      <!-- DefaultCacheResolution: Specifies the default timed cache policy
+      resolution in seconds. This controls the interval at which the cache
+      current timestamp is updated and should be less than the DefaultCacheTimeout
+      in order for the timeout to be meaningful. This has no affect if the
+      AuthenticationCacheJndiName has been changed from the default value.
+      -->
+      <attribute name="DefaultCacheResolution">60</attribute>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Transactions                                                         -->
+   <!-- ==================================================================== -->
+   <!-- The configurable Xid factory.  For use with Oracle, set pad to true -->
+   <mbean code="org.jboss.tm.XidFactory"
+      name="jboss:service=XidFactory">
+      <!--attribute name="Pad">true</attribute-->
+   </mbean>
+
+   <!--
+      | The fast in-memory transaction manager.
+    -->
+   <mbean code="org.jboss.tm.TransactionManagerService"
+      name="jboss:service=TransactionManager"
+      xmbean-dd="resource:xmdesc/TransactionManagerService-xmbean.xml">
+      <attribute name="TransactionTimeout">300</attribute>
+      <!-- set to false to disable transaction demarcation over IIOP -->
+      <attribute name="GlobalIdsEnabled">true</attribute>
+      <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
+   </mbean>
+   <!--
+      | UserTransaction support.
+    -->
+   <mbean code="org.jboss.tm.usertx.server.ClientUserTransactionService"
+      name="jboss:service=ClientUserTransaction"
+      xmbean-dd="resource:xmdesc/ClientUserTransaction-xmbean.xml">
+      <depends>
+         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+            name="jboss:service=proxyFactory,target=ClientUserTransactionFactory">
+            <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName">UserTransactionSessionFactory</attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory</attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <depends>jboss:service=invoker,type=jrmp</depends>
+         </mbean>
+      </depends>
+      <depends optional-attribute-name="TxProxyName">
+         <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
+            name="jboss:service=proxyFactory,target=ClientUserTransaction">
+            <attribute name="InvokerName">jboss:service=invoker,type=jrmp</attribute>
+            <attribute name="TargetName">jboss:service=ClientUserTransaction</attribute>
+            <attribute name="JndiName"></attribute>
+            <attribute name="ExportedInterface">org.jboss.tm.usertx.interfaces.UserTransactionSession</attribute>
+            <attribute name="ClientInterceptors">
+               <interceptors>
+                  <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
+                  <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+               </interceptors>
+            </attribute>
+            <depends>jboss:service=invoker,type=jrmp</depends>
+         </mbean>
+      </depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Invokers to the JMX node                                             -->
+   <!-- ==================================================================== -->
+
+   <!-- RMI/JRMP invoker -->
+   <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
+      name="jboss:service=invoker,type=jrmp">
+      <attribute name="RMIObjectPort">4444</attribute>
+      <attribute name="ServerAddress">${jboss.bind.address}</attribute>
+      <attribute name="RMIClientSocketFactory">case10829.TimeoutClientSocketFactory</attribute>
+      <attribute name="RMIServerSocketFactory">case10829.TimeoutServerSocketFactory</attribute>
+      <!--
+      <attribute name="RMIServerSocketAddr">custom</attribute>
+      <attribute name="SecurityDomain">ssl-domain-name</attribute>
+      -->
+      <depends>jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.invocation.local.LocalInvoker"
+      name="jboss:service=invoker,type=local">
+
+      <depends>jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
+      name="jboss:service=invoker,type=pooled">
+      <attribute name="NumAcceptThreads">1</attribute>
+      <attribute name="MaxPoolSize">300</attribute>
+      <attribute name="ClientMaxPoolSize">300</attribute>
+      <attribute name="SocketTimeout">60000</attribute>
+      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
+      <attribute name="ServerBindPort">4445</attribute>
+      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
+      <attribute name="ClientConnectPort">0</attribute>
+      <attribute name="EnableTcpNoDelay">false</attribute>
+
+      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+   </mbean>
+
+   <!-- ==================================================================== -->
+   <!-- Monitoring and Management                                            -->
+   <!-- ==================================================================== -->
+
+   <!-- Uncomment to enable JMX monitoring of the bean cache
+   <mbean code="org.jboss.monitor.BeanCacheMonitor"
+          name="jboss.monitor:name=BeanCacheMonitor"/>
+   -->
+
+   <!-- Uncomment to enable JMX monitoring of the entity bean locking
+   <mbean code="org.jboss.monitor.EntityLockMonitor"
+          name="jboss.monitor:name=EntityLockMonitor"/>
+   -->
+
+   <!-- ==================================================================== -->
+   <!-- Deployment Scanning                                                  -->
+   <!-- ==================================================================== -->
+
+   <!-- An mbean for hot deployment/undeployment of archives.
+   -->
+   <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner"
+      name="jboss.deployment:type=DeploymentScanner,flavor=URL">
+
+      <!-- Uncomment (and comment/remove version below) to enable usage of the
+        DeploymentCache
+      <depends optional-attribute-name="Deployer">jboss.deployment:type=DeploymentCache</depends>
+      -->
+      <depends optional-attribute-name="Deployer">jboss.system:service=MainDeployer</depends>
+
+      <!-- The URLComparator can be used to specify a deployment ordering
+           for deployments found in a scanned directory.  The class specified
+           must be an implementation of java.util.Comparator, it must be able
+           to compare two URL objects, and it must have a no-arg constructor.
+           Two deployment comparators are shipped with JBoss:
+             - org.jboss.deployment.DeploymentSorter
+               Sorts by file extension, as follows:
+                 "sar", "service.xml", "rar", "jar", "war", "wsr", "ear", "zip",
+                 "*"
+             - org.jboss.deployment.scanner.PrefixDeploymentSorter
+               If the name portion of the url begins with 1 or more digits, those
+               digits are converted to an int (ignoring leading zeroes), and
+               files are deployed in that order.  Files that do not start with
+               any digits will be deployed first, and they will be sorted by
+               extension as above with DeploymentSorter.
+      -->
+      <attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute>
+      <!--
+      <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>
+      -->
+
+      <!-- The Filter specifies a java.io.FileFilter for scanned
+           directories.  Any file not accepted by this filter will not be
+           deployed.  The org.jboss.deployment.scanner.DeploymentFilter
+           rejects the following patterns:
+               "#*", "%*", ",*", ".*", "_$*", "*#", "*$", "*%", "*.BAK",
+               "*.old", "*.orig", "*.rej", "*.bak", "*,v", "*~", ".make.state",
+               ".nse_depinfo", "CVS", "CVS.admin", "RCS", "RCSLOG", "SCCS",
+               "TAGS", "core", "tags"
+      -->
+      <attribute name="Filter">org.jboss.deployment.scanner.DeploymentFilter</attribute>
+
+      <attribute name="ScanPeriod">5000</attribute>
+
+      <!-- URLs are comma separated and resolve relative to the server home URL
+         unless the given path is absolute. If the URL ends in "/" it is
+         considered a collection and scanned, otherwise it is simply deployed;
+         this follows RFC2518 convention and allows discrimination between
+         collections and directories that are simply unpacked archives.
+
+         URLs may be local (file:) or remote (http:). Scanning is supported
+         for remote URLs but unpacked deployment units are not.
+
+         Example URLs:
+            deploy/
+                 scans ${jboss.server.url}/deploy/, which is local or remote
+                 depending on the URL used to boot the server
+            ${jboss.server.home}/deploy/
+                 scans ${jboss.server.home)/deploy, which is always local
+            file:/var/opt/myapp.ear
+                 deploy myapp.ear from a local location
+            file:/var/opt/apps/
+                 scans the specified directory
+            http://www.test.com/netboot/myapp.ear
+                 deploys myapp.ear from a remote location
+            http://www.test.com/netboot/apps/
+                 scans the specified WebDAV location
+       -->
+      <attribute name="URLs">
+         deploy/
+      </attribute>
+
+      <!-- Indicates if the scanner should recursively scan directories that
+      contain no "." in their names. This can be used to group applications
+      and services that must be deployed and that have the same
+      logical function in the same directory i.e.
+        deploy/JMX/
+        deploy/JMS/
+        ...
+      -->
+
+      <attribute name="RecursiveSearch">True</attribute>
+
+   </mbean>
+
+</server>

Added: branches/JBoss_4_0_0_Case10829/case10829/src/resources/log4j.xml
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/resources/log4j.xml	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/resources/log4j.xml	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A time/date based rolling appender -->
+   <appender name="FILE" class="org.apache.log4j.FileAppender">
+      <param name="File" value="client.log"/>
+      <param name="Append" value="false"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- A time/date based rolling appender -->
+   <appender name="TRACE_FILE" class="org.apache.log4j.RollingFileAppender">
+      <param name="File" value="trace.log"/>
+      <param name="Append" value="false"/>
+      <param name="MaxFileSize" value="10Mb" />
+      <param name="MaxBackupIndex" value="3" /> 
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+
+   <!--
+      | An example of enabling the custom TRACE level priority that is used
+      | by the JBoss internals to diagnose low level details. This example
+      | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+      | subpackages. This will produce A LOT of logging output.
+   -->
+  <category name="case10829" additivity="false">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+    <appender-ref ref="TRACE_FILE" />
+  </category>
+  <category name="org.jboss.ha.framework" additivity="false">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+    <appender-ref ref="TRACE_FILE" />
+  </category>
+  <category name="org.jboss.proxy" additivity="false">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+    <appender-ref ref="TRACE_FILE" />
+  </category>
+  <category name="org.jboss.invocation" additivity="false">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+    <appender-ref ref="TRACE_FILE" />
+  </category>
+  <category name="org.jnp" additivity="false">
+    <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+    <appender-ref ref="TRACE_FILE" />
+  </category>
+  
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: branches/JBoss_4_0_0_Case10829/case10829/src/util/TestFutureTimeout.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/case10829/src/util/TestFutureTimeout.java	2006-09-02 04:20:54 UTC (rev 56524)
+++ branches/JBoss_4_0_0_Case10829/case10829/src/util/TestFutureTimeout.java	2006-09-02 20:03:13 UTC (rev 56525)
@@ -0,0 +1,72 @@
+package util;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class TestFutureTimeout
+{
+   private static ExecutorService invokePool = Executors.newCachedThreadPool();
+   static class JmxOp implements Callable<Object>
+   {
+      private long delay;
+      JmxOp(long delay)
+      {
+         this.delay = delay;
+      }
+
+      public Object call() throws Exception
+      {
+         try
+         {
+            long start = System.currentTimeMillis();
+            Thread.sleep(delay);
+            long end = System.currentTimeMillis();
+            long elapsed = end - start;
+            return elapsed;
+         }
+         catch(Exception e)
+         {
+            throw e;
+         }
+      }
+   }
+
+   /**
+    * @param args
+    */
+   public static void main(String[] args)
+      throws Throwable
+   {
+      long delay = 0;
+      while( true )
+      {
+         try
+         {
+            JmxOp op = new JmxOp(delay);
+            Future<Object> result = invokePool.submit(op);
+            Object value = result.get(10*1000, TimeUnit.MILLISECONDS);
+            System.out.println("Call done in: "+value);
+            delay += 1000;
+         }
+         catch(TimeoutException t)
+         {
+            throw t;
+         }
+         catch(InterruptedException e)
+         {
+            throw e;
+         }
+         catch(ExecutionException e)
+         {
+            Throwable t = e.getCause();
+            throw t;
+         }
+      }
+   }
+
+}




More information about the jboss-cvs-commits mailing list