[jboss-cvs] JBoss Messaging SVN: r6051 - in trunk: src/main/org/jboss/messaging/core/client/impl and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 9 14:21:33 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-03-09 14:21:33 -0400 (Mon, 09 Mar 2009)
New Revision: 6051
Removed:
trunk/tests/src/org/jboss/messaging/tests/util/InVMContext.java
trunk/tests/src/org/jboss/messaging/tests/util/InVMNameParser.java
trunk/tests/src/org/jboss/messaging/tests/util/InVMSingleInitialContextFactory.java
Modified:
trunk/build-messaging.xml
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
Removing Unused InVMContext, changing timeout for hudson tests and adding threadDump method
Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/build-messaging.xml 2009-03-09 18:21:33 UTC (rev 6051)
@@ -1154,6 +1154,7 @@
timeout="${junit.timeout}">
<sysproperty key="user.home" value="${user.home}"/>
<sysproperty key="java.io.tmpdir" value="${java.io.tmpdir}"/>
+ <sysproperty key="org.jboss.messaging.default-call-timeout" value="60000"/>
<jvmarg value="-Djava.library.path=native/bin"/>
<jvmarg value="-Dmodule.output=./"/>
<jvmarg value="-Djava.util.logging.config.file=src/config/logging.properties"/>
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -75,8 +75,26 @@
public static final boolean DEFAULT_AUTO_GROUP = false;
- public static final long DEFAULT_CALL_TIMEOUT = 30000;
+ public static final long DEFAULT_CALL_TIMEOUT;
+
+ static
+ {
+ long value;
+ try
+ {
+ // This system-variable is used on tests.
+ value = Long.parseLong(System.getProperty("org.jboss.messaging.default-call-timeout", "30000"));
+ }
+ catch (Exception e)
+ {
+
+ // Security Managemen is probably in use on the VM
+ value = 30000;
+ }
+ DEFAULT_CALL_TIMEOUT = value;
+ }
+
public static final int DEFAULT_MAX_CONNECTIONS = 8;
public static final int DEFAULT_ACK_BATCH_SIZE = 1024 * 1024;
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/ClusterTestBase.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -213,32 +213,43 @@
protected void addConsumer(int consumerID, int node, String queueName, String filterVal) throws Exception
{
- if (consumers[consumerID] != null)
+ try
{
- throw new IllegalArgumentException("Already a consumer at " + node);
+ if (consumers[consumerID] != null)
+ {
+ throw new IllegalArgumentException("Already a consumer at " + node);
+ }
+
+ ClientSessionFactory sf = this.sfs[node];
+
+ if (sf == null)
+ {
+ throw new IllegalArgumentException("No sf at " + node);
+ }
+
+ ClientSession session = sf.createSession(false, true, true);
+
+ String filterString = null;
+
+ if (filterVal != null)
+ {
+ filterString = FILTER_PROP.toString() + "='" + filterVal + "'";
+ }
+
+ ClientConsumer consumer = session.createConsumer(queueName, filterString);
+
+ session.start();
+
+ consumers[consumerID] = new ConsumerHolder(consumer, session);
}
-
- ClientSessionFactory sf = this.sfs[node];
-
- if (sf == null)
+ catch (Exception e)
{
- throw new IllegalArgumentException("No sf at " + node);
+ // Proxy the faliure and print a dump into System.out, so it is captured by Hudson reports
+ e.printStackTrace();
+ System.out.println(threadDump());
+
+ throw e;
}
-
- ClientSession session = sf.createSession(false, true, true);
-
- String filterString = null;
-
- if (filterVal != null)
- {
- filterString = FILTER_PROP.toString() + "='" + filterVal + "'";
- }
-
- ClientConsumer consumer = session.createConsumer(queueName, filterString);
-
- session.start();
-
- consumers[consumerID] = new ConsumerHolder(consumer, session);
}
protected void removeConsumer(int consumerID) throws Exception
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -1384,6 +1384,9 @@
catch (Throwable t)
{
throwable = t;
+ // Case a failure happened here, it should print the Thread dump
+ // Sending it to System.out, as it would show on the Tests report
+ System.out.println(threadDump());
log.error("Failed to run test", t);
}
Deleted: trunk/tests/src/org/jboss/messaging/tests/util/InVMContext.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/InVMContext.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/tests/src/org/jboss/messaging/tests/util/InVMContext.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -1,388 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.tests.util;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameAlreadyBoundException;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-
-import org.jboss.messaging.core.logging.Logger;
-
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision: 2868 $</tt>
- *
- * $Id: InVMContext.java 2868 2007-07-10 20:22:16Z timfox $
- */
-public class InVMContext implements Context, Serializable
-{
- // Constants -----------------------------------------------------
-
- private static final long serialVersionUID = 385743957345L;
-
- private static final Logger log = Logger.getLogger(InVMContext.class);
-
-
- // Static --------------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- protected Map map;
- protected NameParser parser = new InVMNameParser();
- private String nameInNamespace = "";
-
- // Constructors --------------------------------------------------
-
- public InVMContext()
- {
- map = Collections.synchronizedMap(new HashMap());
- }
-
- public InVMContext(String nameInNamespace)
- {
- this();
- this.nameInNamespace = nameInNamespace;
- }
- // Context implementation ----------------------------------------
-
- public Object lookup(Name name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public Object lookup(String name) throws NamingException
- {
- name = trimSlashes(name);
- int i = name.indexOf("/");
- String tok = i == -1 ? name : name.substring(0, i);
- Object value = map.get(tok);
- if (value == null)
- {
- throw new NameNotFoundException("Name not found: " + tok);
- }
- if (value instanceof InVMContext && i != -1)
- {
- return ((InVMContext)value).lookup(name.substring(i));
- }
- if (value instanceof Reference)
- {
- Reference ref = (Reference)value;
- RefAddr refAddr = ref.get("nns");
-
- // we only deal with references create by NonSerializableFactory
- String key = (String)refAddr.getContent();
- return NonSerializableFactory.lookup(key);
- }
- else
- {
- return value;
- }
- }
-
- public void bind(Name name, Object obj) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public void bind(String name, Object obj) throws NamingException
- {
- internalBind(name, obj, false);
- }
-
- public void rebind(Name name, Object obj) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public void rebind(String name, Object obj) throws NamingException
- {
- internalBind(name, obj, true);
- }
-
- public void unbind(Name name) throws NamingException
- {
- unbind(name.toString());
- }
-
- public void unbind(String name) throws NamingException
- {
- name = trimSlashes(name);
- int i = name.indexOf("/");
- boolean terminal = i == -1;
- if (terminal)
- {
- map.remove(name);
- }
- else
- {
- String tok = name.substring(0, i);
- InVMContext c = (InVMContext)map.get(tok);
- if (c == null)
- {
- throw new NameNotFoundException("Context not found: " + tok);
- }
- c.unbind(name.substring(i));
- }
- }
-
- public void rename(Name oldName, Name newName) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public void rename(String oldName, String newName) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public NamingEnumeration list(Name name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public NamingEnumeration list(String name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public NamingEnumeration listBindings(Name name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public NamingEnumeration listBindings(String contextName) throws NamingException
- {
- contextName = trimSlashes(contextName);
- if (!"".equals(contextName) && !".".equals(contextName))
- {
- try
- {
- return ((InVMContext)lookup(contextName)).listBindings("");
- }
- catch(Throwable t)
- {
- throw new NamingException(t.getMessage());
- }
- }
-
- List l = new ArrayList();
- for(Iterator i = map.keySet().iterator(); i.hasNext(); )
- {
- String name = (String)i.next();
- Object object = map.get(name);
- l.add(new Binding(name, object));
- }
- return new NamingEnumerationImpl(l.iterator());
- }
-
- public void destroySubcontext(Name name) throws NamingException
- {
- destroySubcontext(name.toString());
- }
-
- public void destroySubcontext(String name) throws NamingException
- {
- map.remove(trimSlashes(name));
- }
-
- public Context createSubcontext(Name name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public Context createSubcontext(String name) throws NamingException
- {
- name = trimSlashes(name);
- if (map.get(name) != null)
- {
- throw new NameAlreadyBoundException(name);
- }
- InVMContext c = new InVMContext(getNameInNamespace());
- map.put(name, c);
- return c;
- }
-
- public Object lookupLink(Name name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public Object lookupLink(String name) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public NameParser getNameParser(Name name) throws NamingException
- {
- return getNameParser(name.toString());
- }
-
- public NameParser getNameParser(String name) throws NamingException
- {
- return parser;
- }
-
- public Name composeName(Name name, Name prefix) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public String composeName(String name, String prefix) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public Object addToEnvironment(String propName, Object propVal) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public Object removeFromEnvironment(String propName) throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public Hashtable getEnvironment() throws NamingException
- {
- Hashtable env = new Hashtable();
- env.put("java.naming.factory.initial",
- "org.jboss.test.messaging.tools.container.InVMInitialContextFactory");
- env.put("java.naming.provider.url", "org.jboss.naming:org.jnp.interface");
- return env;
- }
-
- public void close() throws NamingException
- {
- }
-
- public String getNameInNamespace() throws NamingException
- {
- return nameInNamespace;
- }
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private String trimSlashes(String s)
- {
- int i = 0;
- while(true)
- {
- if (i == s.length() || s.charAt(i) != '/')
- {
- break;
- }
- i++;
- }
- s = s.substring(i);
- i = s.length() - 1;
- while(true)
- {
- if (i == -1 || s.charAt(i) != '/')
- {
- break;
- }
- i--;
- }
- return s.substring(0, i + 1);
- }
-
- private void internalBind(String name, Object obj, boolean rebind) throws NamingException
- {
- log.debug("Binding " + name + " obj " + obj + " rebind " + rebind);
- name = trimSlashes(name);
- int i = name.lastIndexOf("/");
- InVMContext c = this;
- if (i != -1)
- {
- String path = name.substring(0, i);
- c = (InVMContext)lookup(path);
- }
- name = name.substring(i + 1);
- if (!rebind && c.map.get(name) != null)
- {
- throw new NameAlreadyBoundException(name);
- }
- c.map.put(name, obj);
- }
-
- // Inner classes -------------------------------------------------
-
- private class NamingEnumerationImpl implements NamingEnumeration
- {
- private Iterator iterator;
-
- NamingEnumerationImpl(Iterator bindingIterator)
- {
- this.iterator = bindingIterator;
- }
-
- public void close() throws NamingException
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasMore() throws NamingException
- {
- return iterator.hasNext();
- }
-
- public Object next() throws NamingException
- {
- return iterator.next();
- }
-
- public boolean hasMoreElements()
- {
- return iterator.hasNext();
- }
-
- public Object nextElement()
- {
- return iterator.next();
- }
- }
-}
-
Deleted: trunk/tests/src/org/jboss/messaging/tests/util/InVMNameParser.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/InVMNameParser.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/tests/src/org/jboss/messaging/tests/util/InVMNameParser.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.tests.util;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-import javax.naming.CompoundName;
-import javax.naming.Name;
-import javax.naming.NameParser;
-import javax.naming.NamingException;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision: 2868 $</tt>
- *
- * $Id: InVMNameParser.java 2868 2007-07-10 20:22:16Z timfox $
- */
-public class InVMNameParser implements NameParser, Serializable
-{
- // Constants -----------------------------------------------------
-
- private static final long serialVersionUID = 2925203703371001031L;
-
- // Static --------------------------------------------------------
-
- static Properties syntax;
-
- static
- {
- syntax = new Properties();
- syntax.put("jndi.syntax.direction", "left_to_right");
- syntax.put("jndi.syntax.ignorecase", "false");
- syntax.put("jndi.syntax.separator", "/");
- }
-
- // Attributes ----------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public static Properties getSyntax()
- {
- return syntax;
- }
-
- public Name parse(String name) throws NamingException
- {
- return new CompoundName(name, syntax);
- }
-
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted: trunk/tests/src/org/jboss/messaging/tests/util/InVMSingleInitialContextFactory.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/InVMSingleInitialContextFactory.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/tests/src/org/jboss/messaging/tests/util/InVMSingleInitialContextFactory.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.tests.util;
-
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-
-/**
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class InVMSingleInitialContextFactory implements InitialContextFactory
-{
- public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException
- {
- return new InVMContext();
- }
-}
Modified: trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-03-09 17:33:16 UTC (rev 6050)
+++ trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java 2009-03-09 18:21:33 UTC (rev 6051)
@@ -29,9 +29,12 @@
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import javax.transaction.xa.Xid;
@@ -83,7 +86,35 @@
private String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/jbm-unit-test";
// Static --------------------------------------------------------
+
+ public static String threadDump()
+ {
+ StringWriter str = new StringWriter();
+ PrintWriter out = new PrintWriter(str);
+
+
+ Map<Thread, StackTraceElement[]> stackTrace = Thread.getAllStackTraces();
+ out.println("*******************************************************************************");
+ out.println("Complete Thread dump");
+
+ for (Map.Entry<Thread, StackTraceElement[]> el : stackTrace.entrySet())
+ {
+ out.println("===============================================================================");
+ out.println("Thread " + el.getKey() + " name = " + el.getKey().getName() + " group = " + el.getKey().getThreadGroup());
+ out.println();
+ for (StackTraceElement traceEl : el.getValue())
+ {
+ out.println(traceEl);
+ }
+ }
+ out.println("*******************************************************************************");
+
+
+ return str.toString();
+ }
+
+
public static String dumpBytes(byte[] bytes)
{
StringBuffer buff = new StringBuffer();
More information about the jboss-cvs-commits
mailing list