JBoss hornetq SVN: r12176 - trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:39:51 -0500 (Thu, 23 Feb 2012)
New Revision: 12176
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java
Log:
Use %n for newline with String.format(.)
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java 2012-02-23 09:39:34 UTC (rev 12175)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ServerInfo.java 2012-02-23 09:39:51 UTC (rev 12176)
@@ -62,14 +62,14 @@
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
StringBuilder info = new StringBuilder("\n**** Server Dump ****\n");
- info.append(String.format("date: %s\n", new Date()));
- info.append(String.format("free memory: %s\n", SizeFormatterUtil.sizeof(freeMemory)));
- info.append(String.format("max memory: %s\n", SizeFormatterUtil.sizeof(maxMemory)));
- info.append(String.format("total memory: %s\n", SizeFormatterUtil.sizeof(totalMemory)));
- info.append(String.format("available memory: %.2f%%\n", availableMemoryPercent));
+ info.append(String.format("date: %s%n", new Date()));
+ info.append(String.format("free memory: %s%n", SizeFormatterUtil.sizeof(freeMemory)));
+ info.append(String.format("max memory: %s%n", SizeFormatterUtil.sizeof(maxMemory)));
+ info.append(String.format("total memory: %s%n", SizeFormatterUtil.sizeof(totalMemory)));
+ info.append(String.format("available memory: %.2f%%%n", availableMemoryPercent));
info.append(appendPagingInfos());
- info.append(String.format("# of thread: %d\n", threadMXBean.getThreadCount()));
- info.append(String.format("# of conns: %d\n", server.getConnectionCount()));
+ info.append(String.format("# of thread: %d%n", threadMXBean.getThreadCount()));
+ info.append(String.format("# of conns: %d%n", server.getConnectionCount()));
info.append("********************\n");
return info.toString();
}
@@ -84,14 +84,14 @@
try
{
pageStore = pagingManager.getPageStore(storeName);
- info.append(String.format("\t%s: %s\n",
+ info.append(String.format("\t%s: %s%n",
storeName,
SizeFormatterUtil.sizeof(pageStore.getPageSizeBytes() *
pageStore.getNumberOfPages())));
}
catch (Exception e)
{
- info.append(String.format("\t%s: %s\n", storeName, e.getMessage()));
+ info.append(String.format("\t%s: %s%n", storeName, e.getMessage()));
}
}
return info.toString();
12 years, 10 months
JBoss hornetq SVN: r12175 - trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:39:34 -0500 (Thu, 23 Feb 2012)
New Revision: 12175
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java
Log:
Check returned value.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2012-02-23 09:39:18 UTC (rev 12174)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2012-02-23 09:39:34 UTC (rev 12175)
@@ -36,7 +36,7 @@
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*/
-public class ChannelImpl implements Channel
+public final class ChannelImpl implements Channel
{
public enum CHANNEL_ID {
@@ -293,7 +293,10 @@
}
else
{
- failoverCondition.await(connection.getBlockingCallFailoverTimeout(), TimeUnit.MILLISECONDS);
+ if (!failoverCondition.await(connection.getBlockingCallFailoverTimeout(), TimeUnit.MILLISECONDS))
+ {
+ log.debug("timed-out waiting for failover condition");
+ }
}
}
catch (InterruptedException e)
12 years, 10 months
JBoss hornetq SVN: r12174 - trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:39:18 -0500 (Thu, 23 Feb 2012)
New Revision: 12174
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageImpl.java
Log:
finalize is protected, not public
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageImpl.java 2012-02-23 09:39:00 UTC (rev 12173)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/paging/impl/PageImpl.java 2012-02-23 09:39:18 UTC (rev 12174)
@@ -32,7 +32,7 @@
import org.hornetq.utils.DataConstants;
/**
- *
+ *
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
*
*/
@@ -41,7 +41,7 @@
// Constants -----------------------------------------------------
private static final Logger log = Logger.getLogger(PageImpl.class);
-
+
private static final boolean isTrace = log.isTraceEnabled();
private static final boolean isDebug = log.isDebugEnabled();
@@ -62,7 +62,7 @@
private final SequentialFile file;
private final SequentialFileFactory fileFactory;
-
+
/**
* The page cache that will be filled with data as we write more data
*/
@@ -99,7 +99,7 @@
{
return pageId;
}
-
+
public void setLiveCache(LivePageCache pageCache)
{
this.pageCache = pageCache;
@@ -202,7 +202,7 @@
buffer.rewind();
file.writeDirect(buffer, false);
-
+
if (pageCache != null)
{
pageCache.addLiveMessage(message);
@@ -250,7 +250,7 @@
{
storageManager.pageDeleted(storeName, pageId);
}
-
+
if (isDebug)
{
log.debug("Deleting pageId=" + pageId + " on store " + storeName);
@@ -263,7 +263,7 @@
if (msg.getMessage().isLargeMessage())
{
LargeServerMessage lmsg = (LargeServerMessage)msg.getMessage();
-
+
// Remember, cannot call delete directly here
// Because the large-message may be linked to another message
// or it may still being delivered even though it has been acked already
@@ -286,7 +286,7 @@
{
file.delete();
}
-
+
return true;
}
catch (Exception e)
@@ -305,20 +305,21 @@
{
return size.intValue();
}
-
+
@Override
public String toString()
{
return "PageImpl::pageID=" + this.pageId + ", file=" + this.file;
}
-
+
public int compareTo(Page otherPage)
{
return otherPage.getPageId() - this.pageId;
}
-
- public void finalize()
+
+ @Override
+ protected void finalize()
{
try
{
@@ -333,10 +334,6 @@
}
}
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
@Override
public int hashCode()
{
@@ -346,16 +343,6 @@
return result;
}
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj)
{
12 years, 10 months
JBoss hornetq SVN: r12173 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:39:00 -0500 (Thu, 23 Feb 2012)
New Revision: 12173
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
Log:
Make executor transient
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-02-23 09:38:47 UTC (rev 12172)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-02-23 09:39:00 UTC (rev 12173)
@@ -41,7 +41,7 @@
private static final Logger log = Logger.getLogger(Topology.class);
- private Executor executor = null;
+ private transient Executor executor = null;
/**
* Used to debug operations.
12 years, 10 months
JBoss hornetq SVN: r12172 - trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:38:47 -0500 (Thu, 23 Feb 2012)
New Revision: 12172
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
Log:
Use StringBuilder, fixing findbugs warning
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-02-23 09:38:28 UTC (rev 12171)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/Topology.java 2012-02-23 09:38:47 UTC (rev 12172)
@@ -485,18 +485,17 @@
public synchronized String describe(final String text)
{
-
- String desc = text + "topology on " + this + ":\n";
+ StringBuilder desc = new StringBuilder(text + "topology on " + this + ":\n");
for (Entry<String, TopologyMember> entry : new HashMap<String, TopologyMember>(topology).entrySet())
{
- desc += "\t" + entry.getKey() + " => " + entry.getValue() + "\n";
+ desc.append("\t" + entry.getKey() + " => " + entry.getValue() + "\n");
}
- desc += "\t" + "nodes=" + nodes() + "\t" + "members=" + members();
+ desc.append("\t" + "nodes=" + nodes() + "\t" + "members=" + members());
if (topology.isEmpty())
{
- desc += "\tEmpty";
+ desc.append("\tEmpty");
}
- return desc;
+ return desc.toString();
}
public int members()
12 years, 10 months
JBoss hornetq SVN: r12171 - in trunk: hornetq-core/src/main/java/org/hornetq/core/filter/impl and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:38:28 -0500 (Thu, 23 Feb 2012)
New Revision: 12171
Modified:
trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java
trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java
Log:
Add default case to switch statement.
Modified: trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java
===================================================================
--- trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java 2012-02-23 09:38:04 UTC (rev 12170)
+++ trunk/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java 2012-02-23 09:38:28 UTC (rev 12171)
@@ -19,19 +19,24 @@
import org.hornetq.core.logging.Logger;
/**
- *
+ *
* A UTF8Util
- *
+ *
* This class will write UTFs directly to the ByteOutput (through the MessageBuffer interface)
*
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
- *
+ *
* Created Feb 20, 2009 1:37:18 PM
*
*
*/
-public class UTF8Util
+public final class UTF8Util
{
+ private UTF8Util()
+ {
+ // utility class
+ }
+
static boolean optimizeStrings = true;
private static final Logger log = Logger.getLogger(UTF8Util.class);
@@ -100,7 +105,6 @@
{
buffer.byteBuffer[charCount++] = (byte)(0xC0 | charAtPos >> 6 & 0x1F);
buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
-
}
}
out.writeBytes(buffer.byteBuffer, 0, len);
@@ -158,6 +162,8 @@
byte3 = buffer.byteBuffer[count++];
buffer.charBuffer[charCount++] = (char)((c & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F) << 0);
break;
+ default:
+ throw new InternalError("unhandled utf8 byte " + c);
}
}
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java 2012-02-23 09:38:04 UTC (rev 12170)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/filter/impl/Operator.java 2012-02-23 09:38:28 UTC (rev 12171)
@@ -36,7 +36,7 @@
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @version $Revision: 2681 $
*/
-public class Operator
+public final class Operator
{
int operation;
@@ -1293,9 +1293,9 @@
return in();
case NOT_IN:
return not_in();
+ default:
+ throw new IllegalArgumentException("No operation mapped to int " + operation);
}
-
- throw new Exception("Unknown operation: " + toString());
}
public void throwBadObjectException(final Class class1) throws Exception
12 years, 10 months
JBoss hornetq SVN: r12170 - trunk/etc.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:38:04 -0500 (Thu, 23 Feb 2012)
New Revision: 12170
Modified:
trunk/etc/findbugs-exclude.xml
Log:
Update findbugs excludes
Modified: trunk/etc/findbugs-exclude.xml
===================================================================
--- trunk/etc/findbugs-exclude.xml 2012-02-23 09:37:54 UTC (rev 12169)
+++ trunk/etc/findbugs-exclude.xml 2012-02-23 09:38:04 UTC (rev 12170)
@@ -14,6 +14,7 @@
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
+ <!-- Comparison is correct within its context -->
<Match>
<Class name="org.hornetq.ra.Util"/>
<Or>
@@ -41,6 +42,9 @@
<Or>
<Method name="getFloatProperty"/>
<Method name="getDoubleProperty"/>
+ <Method name="getByteProperty"/>
+ <Method name="getIntProperty"/>
+ <Method name="getShortProperty"/>
</Or>
<Bug pattern="NP_NULL_PARAM_DEREF_NONVIRTUAL"/>
</Match>
12 years, 10 months
JBoss hornetq SVN: r12169 - trunk/hornetq-commons/src/main/java/org/hornetq/utils.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:37:54 -0500 (Thu, 23 Feb 2012)
New Revision: 12169
Modified:
trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java
Log:
Avoid unboxing followed by boxing.
Modified: trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java
===================================================================
--- trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java 2012-02-23 09:37:40 UTC (rev 12168)
+++ trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java 2012-02-23 09:37:54 UTC (rev 12169)
@@ -180,7 +180,7 @@
}
else if (value instanceof SimpleString)
{
- return Boolean.valueOf(((SimpleString)value).toString()).booleanValue();
+ return Boolean.valueOf(((SimpleString)value).toString());
}
else
{
@@ -219,7 +219,7 @@
if (value instanceof Character)
{
- return ((Character)value).charValue();
+ return ((Character)value);
}
else
{
@@ -363,7 +363,7 @@
return Float.valueOf(null);
if (value instanceof Float)
{
- return ((Float)value).floatValue();
+ return ((Float)value);
}
if (value instanceof SimpleString)
{
12 years, 10 months
JBoss hornetq SVN: r12168 - trunk/hornetq-commons/src/main/java/org/hornetq/utils.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:37:40 -0500 (Thu, 23 Feb 2012)
New Revision: 12168
Modified:
trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java
Log:
Remove javadoc warning. Reference is already present in Javadoc text.
Modified: trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java
===================================================================
--- trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java 2012-02-23 09:37:21 UTC (rev 12167)
+++ trunk/hornetq-commons/src/main/java/org/hornetq/utils/TypedProperties.java 2012-02-23 09:37:40 UTC (rev 12168)
@@ -28,16 +28,15 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.PropertyConversionException;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.logging.Logger;
/**
- *
+ *
* Property Value Conversion.
* <p>
* This implementation follows section 3.5.4 of the <i>Java Message Service<i> specification
@@ -46,11 +45,9 @@
* TODO - should have typed property getters and do conversions herein
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert Suconic</a>
- * @see <i>Java Message Service<i> specification (Version 1.1 April 12, 2002), section 3.5.4.
*/
-public class TypedProperties
+public final class TypedProperties
{
- private static final Logger log = Logger.getLogger(TypedProperties.class);
private static final SimpleString HQ_PROPNAME = new SimpleString("_HQ_");
@@ -137,7 +134,7 @@
checkCreateProperties();
doPutValue(key, value == null ? new NullValue() : new StringValue(value));
}
-
+
public void putNullValue(final SimpleString key)
{
checkCreateProperties();
12 years, 10 months
JBoss hornetq SVN: r12167 - in trunk: hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2012-02-23 04:37:21 -0500 (Thu, 23 Feb 2012)
New Revision: 12167
Modified:
trunk/etc/findbugs-exclude.xml
trunk/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java
Log:
Filter warnings from Util comparisons. Make Util 'final'.
Modified: trunk/etc/findbugs-exclude.xml
===================================================================
--- trunk/etc/findbugs-exclude.xml 2012-02-23 04:40:27 UTC (rev 12166)
+++ trunk/etc/findbugs-exclude.xml 2012-02-23 09:37:21 UTC (rev 12167)
@@ -15,6 +15,18 @@
</Match>
<Match>
+ <Class name="org.hornetq.ra.Util"/>
+ <Or>
+ <Method name="compare" params="java.lang.Integer,java.lang.Integer" returns="boolean"/>
+ <Method name="compare" params="java.lang.Long,java.lang.Long" returns="boolean"/>
+ <Method name="compare" params="java.lang.String,java.lang.String" returns="boolean"/>
+ <Method name="compare" params="java.lang.Boolean,java.lang.Boolean" returns="boolean"/>
+ <Method name="compare" params="java.lang.Double,java.lang.Double" returns="boolean"/>
+ </Or>
+ <Bug pattern="RC_REF_COMPARISON"/>
+ </Match>
+
+ <Match>
<!-- As per Java Messaging Specification 3.5.4:
"
Modified: trunk/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java
===================================================================
--- trunk/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java 2012-02-23 04:40:27 UTC (rev 12166)
+++ trunk/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java 2012-02-23 09:37:21 UTC (rev 12167)
@@ -13,7 +13,11 @@
package org.hornetq.ra;
import java.lang.reflect.Method;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
import javax.naming.Context;
import javax.transaction.TransactionManager;
@@ -28,9 +32,9 @@
* @author <a href="mailto:jesper.pedersen@jboss.org">Jesper Pedersen</a>
* @version $Revision: $
*/
-public class Util
+public final class Util
{
-
+
private static final Logger log = Logger.getLogger(Util.class);
@@ -45,7 +49,7 @@
* Compare two strings.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final String me, final String you)
{
@@ -69,7 +73,7 @@
* Compare two integers.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Integer me, final Integer you)
{
@@ -93,7 +97,7 @@
* Compare two longs.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Long me, final Long you)
{
@@ -117,7 +121,7 @@
* Compare two doubles.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Double me, final Double you)
{
@@ -141,7 +145,7 @@
* Compare two booleans.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Boolean me, final Boolean you)
{
@@ -174,10 +178,10 @@
return context.lookup(name);
}
- /**
+ /**
* Used on parsing JNDI Configuration
* @param config
- * @return
+ * @return hash-table with configuration option pairs
*/
public static Hashtable<?,?> parseHashtableConfig(final String config)
{
@@ -243,13 +247,13 @@
return res;
}
-
+
/** The Resource adapter can't depend on any provider's specific library. Because of that we use reflection to locate the
- * transaction manager during startup.
- *
- *
- * TODO: https://jira.jboss.org/browse/HORNETQ-417
+ * transaction manager during startup.
+ *
+ *
+ * TODO: https://jira.jboss.org/browse/HORNETQ-417
* We should use a proper SPI instead of reflection
* We would need to define a proper SPI package for this.
* */
12 years, 10 months