[jboss-cvs] JBossAS SVN: r94600 - in projects/jboss-jca/trunk/standalone: src/main/java/org/jboss/jca/standalone and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 9 09:45:13 EDT 2009
Author: jesper.pedersen
Date: 2009-10-09 09:45:12 -0400 (Fri, 09 Oct 2009)
New Revision: 94600
Modified:
projects/jboss-jca/trunk/standalone/build.xml
projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java
projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml
projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/transaction.xml
projects/jboss-jca/trunk/standalone/src/main/resources/logging.properties
Log:
Make the standalone module boot and log memory usage
Modified: projects/jboss-jca/trunk/standalone/build.xml
===================================================================
--- projects/jboss-jca/trunk/standalone/build.xml 2009-10-09 13:43:41 UTC (rev 94599)
+++ projects/jboss-jca/trunk/standalone/build.xml 2009-10-09 13:45:12 UTC (rev 94600)
@@ -87,6 +87,8 @@
<mkdir dir="${target.dir}/standalone/server/jca/conf"/>
<mkdir dir="${target.dir}/standalone/server/jca/conf/bootstrap"/>
<mkdir dir="${target.dir}/standalone/server/jca/deploy"/>
+ <mkdir dir="${target.dir}/standalone/server/jca/log"/>
+ <mkdir dir="${target.dir}/standalone/server/jca/tmp"/>
<copy todir="${target.dir}/standalone/bin">
<fileset dir="src/main/resources/">
Modified: projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java 2009-10-09 13:43:41 UTC (rev 94599)
+++ projects/jboss-jca/trunk/standalone/src/main/java/org/jboss/jca/standalone/Main.java 2009-10-09 13:45:12 UTC (rev 94600)
@@ -36,6 +36,9 @@
import java.util.Map;
import java.util.Properties;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+
/**
* The main class for JBoss JCA standalone
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
@@ -45,6 +48,10 @@
/** The server */
private Object server;
+
+ /** Logging */
+ private static Object logging;
+
/**
* Default constructor
*/
@@ -72,6 +79,7 @@
{
home = new File(".").toURI().toURL().toString();
root = new File(new URI(home.substring(0, home.lastIndexOf("bin"))));
+ SecurityActions.setSystemProperty("jboss.jca.home", root.getAbsolutePath());
}
if (args != null && args.length > 0)
@@ -128,6 +136,8 @@
if (loggingManager == null)
props.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
+ initLogging(SecurityActions.getThreadContextClassLoader());
+
Constructor serverLoaderConstructor = serverLoaderClass.getDeclaredConstructor(Properties.class);
Object serverLoader = serverLoaderConstructor.newInstance(props);
@@ -135,6 +145,14 @@
serverMethodInit.invoke(server, props, null);
serverMethodStart.invoke(server);
+
+ if (isDebugEnabled())
+ {
+ MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+ debug("Heap memory: " + memoryBean.getHeapMemoryUsage().toString());
+ debug("NonHeap memory: " + memoryBean.getNonHeapMemoryUsage().toString());
+ }
+
}
catch (Throwable t)
{
@@ -210,6 +228,171 @@
}
/**
+ * Init logging
+ * @param cl The classloader to load from
+ */
+ @SuppressWarnings("unchecked")
+ private static void initLogging(ClassLoader cl)
+ {
+ try
+ {
+ Class clz = Class.forName("org.jboss.logmanager.log4j.BridgeRepositorySelector", true, cl);
+ Method mStart = clz.getMethod("start", (Class[])null);
+
+ Object brs = clz.newInstance();
+
+ logging = mStart.invoke(brs, (Object[])null);
+ }
+ catch (Throwable t)
+ {
+ // Nothing we can do
+ }
+
+
+ try
+ {
+ Class clz = Class.forName("org.jboss.logging.Logger", true, cl);
+
+ Method mGetLogger = clz.getMethod("getLogger", String.class);
+
+ logging = mGetLogger.invoke((Object)null, new Object[] {"org.jboss.jca.standalone.Main"});
+ }
+ catch (Throwable t)
+ {
+ // Nothing we can do
+ }
+ }
+
+ /**
+ * Logging: ERROR
+ * @param s The string
+ * @param t The throwable
+ */
+ @SuppressWarnings("unchecked")
+ private static void error(String s, Throwable t)
+ {
+ if (logging != null)
+ {
+ try
+ {
+ Class clz = logging.getClass();
+ Method mError = clz.getMethod("error", Object.class, Throwable.class);
+ mError.invoke(logging, new Object[] {s, t});
+ }
+ catch (Throwable th)
+ {
+ // Nothing we can do
+ }
+ }
+ else
+ {
+ System.out.println(s);
+ t.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * Logging: WARN
+ * @param s The string
+ */
+ @SuppressWarnings("unchecked")
+ private static void warn(String s)
+ {
+ if (logging != null)
+ {
+ try
+ {
+ Class clz = logging.getClass();
+ Method mWarn = clz.getMethod("warn", Object.class);
+ mWarn.invoke(logging, new Object[] {s});
+ }
+ catch (Throwable t)
+ {
+ // Nothing we can do
+ }
+ }
+ else
+ {
+ System.out.println(s);
+ }
+ }
+
+ /**
+ * Logging: INFO
+ * @param s The string
+ */
+ @SuppressWarnings("unchecked")
+ private static void info(String s)
+ {
+ if (logging != null)
+ {
+ try
+ {
+ Class clz = logging.getClass();
+ Method mInfo = clz.getMethod("info", Object.class);
+ mInfo.invoke(logging, new Object[] {s});
+ }
+ catch (Throwable t)
+ {
+ // Nothing we can do
+ }
+ }
+ else
+ {
+ System.out.println(s);
+ }
+ }
+
+ /**
+ * Logging: Is DEBUG enabled
+ * @return True if debug is enabled; otherwise false
+ */
+ @SuppressWarnings("unchecked")
+ private static boolean isDebugEnabled()
+ {
+ if (logging != null)
+ {
+ try
+ {
+ Class clz = logging.getClass();
+ Method mIsDebugEnabled = clz.getMethod("isDebugEnabled", (Class[])null);
+ return ((Boolean)mIsDebugEnabled.invoke(logging, (Object[])null)).booleanValue();
+ }
+ catch (Throwable t)
+ {
+ // Nothing we can do
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Logging: DEBUG
+ * @param s The string
+ */
+ @SuppressWarnings("unchecked")
+ private static void debug(String s)
+ {
+ if (logging != null)
+ {
+ try
+ {
+ Class clz = logging.getClass();
+ Method mDebug = clz.getMethod("debug", Object.class);
+ mDebug.invoke(logging, new Object[] {s});
+ }
+ catch (Throwable t)
+ {
+ // Nothing we can do
+ }
+ }
+ else
+ {
+ System.out.println(s);
+ }
+ }
+
+ /**
* Main
* @param args The arguments
*/
Modified: projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml 2009-10-09 13:43:41 UTC (rev 94599)
+++ projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/hdscanner.xml 2009-10-09 13:45:12 UTC (rev 94600)
@@ -5,7 +5,7 @@
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="HDScanner" class="org.jboss.jca.deployers.hack.MainScanner">
+ <bean name="HDScanner" class="org.jboss.jca.deployers.mc.hack.MainScanner">
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
<property name="deployDirectory">${jboss.deploy.url}</property>
</bean>
Modified: projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/transaction.xml
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/transaction.xml 2009-10-09 13:43:41 UTC (rev 94599)
+++ projects/jboss-jca/trunk/standalone/src/main/resources/bootstrap/transaction.xml 2009-10-09 13:45:12 UTC (rev 94600)
@@ -12,7 +12,7 @@
<bean name="TransactionManager" class="com.arjuna.ats.jbossatx.jta.TransactionManagerService">
<!-- <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=TransactionManager", exposedInterface=com.arjuna.ats.jbossatx.jta.TransactionManagerServiceMBean.class, registerDirectly=true)</annotation> -->
<property name="transactionTimeout">300</property>
- <property name="objectStoreDir">tx-object-store</property>
+ <property name="objectStoreDir">${jboss.jca.home}/server/jca/tmp/tx-object-store</property>
<property name="mbeanServer"><inject bean="JMX" property="mbeanServer"/></property>
<property name="transactionStatusManagerInetAddress">localhost</property>
<property name="transactionStatusManagerPort">4713</property>
Modified: projects/jboss-jca/trunk/standalone/src/main/resources/logging.properties
===================================================================
--- projects/jboss-jca/trunk/standalone/src/main/resources/logging.properties 2009-10-09 13:43:41 UTC (rev 94599)
+++ projects/jboss-jca/trunk/standalone/src/main/resources/logging.properties 2009-10-09 13:45:12 UTC (rev 94600)
@@ -53,7 +53,7 @@
handler.FILE.level=${jboss.jca.log.file.level:DEBUG}
handler.FILE.properties=autoFlush,fileName
handler.FILE.autoFlush=true
-handler.FILE.fileName=${jboss.jca.home}/log/server.log
+handler.FILE.fileName=${jboss.jca.home}/server/jca/log/server.log
handler.FILE.formatter=PATTERN
# Formatter pattern configuration
More information about the jboss-cvs-commits
mailing list