[hornetq-commits] JBoss hornetq SVN: r10727 - in branches/HORNETQ-698_SplitJournal: hornetq-commons and 34 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed May 25 13:30:37 EDT 2011
Author: borges
Date: 2011-05-25 13:30:36 -0400 (Wed, 25 May 2011)
New Revision: 10727
Added:
branches/HORNETQ-698_SplitJournal/hornetq-commons/
branches/HORNETQ-698_SplitJournal/hornetq-commons/.project
branches/HORNETQ-698_SplitJournal/hornetq-commons/hornetq-logging.iml
branches/HORNETQ-698_SplitJournal/hornetq-commons/pom.xml
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffer.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffers.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/Pair.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/buffers/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/buffers/impl/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/Logger.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/package-info.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/DataConstants.java
branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java
branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/message/BodyEncoder.java
Removed:
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffer.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffers.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/Pair.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/SimpleString.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/Logger.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/message/BodyEncoder.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/package-info.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/DataConstants.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/UTF8Util.java
branches/HORNETQ-698_SplitJournal/hornetq-logging/hornetq-logging.iml
branches/HORNETQ-698_SplitJournal/hornetq-logging/pom.xml
branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java
branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java
branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
Modified:
branches/HORNETQ-698_SplitJournal/hornetq-core/pom.xml
branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java
branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/pom.xml
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/ImportJournal.java
branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java
branches/HORNETQ-698_SplitJournal/pom.xml
Log:
Rename logging project into commons, move loads of files into it.
Added: branches/HORNETQ-698_SplitJournal/hornetq-commons/.project
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/.project (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/.project 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>hornetq-commons</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/hornetq-logging.iml (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-logging/hornetq-logging.iml)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/hornetq-logging.iml (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/hornetq-logging.iml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module" module-name="hornetq-core" />
+ <orderEntry type="library" name="Maven: org.jboss.netty:netty:3.2.3.Final" level="project" />
+ <orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
+ </component>
+</module>
+
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/pom.xml (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-logging/pom.xml)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/pom.xml (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/pom.xml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,27 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-pom</artifactId>
+ <version>2.2.3-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>hornetq-commons</artifactId>
+ <packaging>jar</packaging>
+ <name>HornetQ Utilities</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project>
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffer.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffer.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffer.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffer.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,1086 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.api.core;
+
+import java.nio.ByteBuffer;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+/**
+ *
+ * A HornetQBuffer wraps a Netty's ChannelBuffer and is used throughout HornetQ code base.
+ *
+ * Much of it derived from Netty ChannelBuffer by Trustin Lee
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ * @see HornetQBuffers
+ *
+ */
+public interface HornetQBuffer
+{
+ /**
+ * Returns the underlying Netty's ChannelBuffer
+ *
+ * @return the underlying Netty's ChannelBuffer
+ */
+ ChannelBuffer channelBuffer();
+
+ /**
+ * Returns the number of bytes this buffer can contain.
+ */
+ int capacity();
+
+ /**
+ * Returns the {@code readerIndex} of this buffer.
+ */
+ int readerIndex();
+
+ /**
+ * Sets the {@code readerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code readerIndex} is
+ * less than {@code 0} or
+ * greater than {@code this.writerIndex}
+ */
+ void readerIndex(int readerIndex);
+
+ /**
+ * Returns the {@code writerIndex} of this buffer.
+ */
+ int writerIndex();
+
+ /**
+ * Sets the {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code writerIndex} is
+ * less than {@code this.readerIndex} or
+ * greater than {@code this.capacity}
+ */
+ void writerIndex(int writerIndex);
+
+ /**
+ * Sets the {@code readerIndex} and {@code writerIndex} of this buffer
+ * in one shot. This method is useful when you have to worry about the
+ * invocation order of {@link #readerIndex(int)} and {@link #writerIndex(int)}
+ * methods. For example, the following code will fail:
+ *
+ * <pre>
+ * // Create a buffer whose readerIndex, writerIndex and capacity are
+ * // 0, 0 and 8 respectively.
+ * ChannelBuffer buf = ChannelBuffers.buffer(8);
+ *
+ * // IndexOutOfBoundsException is thrown because the specified
+ * // readerIndex (2) cannot be greater than the current writerIndex (0).
+ * buf.readerIndex(2);
+ * buf.writerIndex(4);
+ * </pre>
+ *
+ * The following code will also fail:
+ *
+ * <pre>
+ * // Create a buffer whose readerIndex, writerIndex and capacity are
+ * // 0, 8 and 8 respectively.
+ * ChannelBuffer buf = ChannelBuffers.wrappedBuffer(new byte[8]);
+ *
+ * // readerIndex becomes 8.
+ * buf.readLong();
+ *
+ * // IndexOutOfBoundsException is thrown because the specified
+ * // writerIndex (4) cannot be less than the current readerIndex (8).
+ * buf.writerIndex(4);
+ * buf.readerIndex(2);
+ * </pre>
+ *
+ * By contrast, {@link #setIndex(int, int)} guarantees that it never
+ * throws an {@link IndexOutOfBoundsException} as long as the specified
+ * indexes meet basic constraints, regardless what the current index
+ * values of the buffer are:
+ *
+ * <pre>
+ * // No matter what the current state of the buffer is, the following
+ * // call always succeeds as long as the capacity of the buffer is not
+ * // less than 4.
+ * buf.setIndex(2, 4);
+ * </pre>
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code readerIndex} is less than 0,
+ * if the specified {@code writerIndex} is less than the specified
+ * {@code readerIndex} or if the specified {@code writerIndex} is
+ * greater than {@code this.capacity}
+ */
+ void setIndex(int readerIndex, int writerIndex);
+
+ /**
+ * Returns the number of readable bytes which is equal to
+ * {@code (this.writerIndex - this.readerIndex)}.
+ */
+ int readableBytes();
+
+ /**
+ * Returns the number of writable bytes which is equal to
+ * {@code (this.capacity - this.writerIndex)}.
+ */
+ int writableBytes();
+
+ /**
+ * Returns {@code true}
+ * if and only if {@code (this.writerIndex - this.readerIndex)} is greater
+ * than {@code 0}.
+ */
+ boolean readable();
+
+ /**
+ * Returns {@code true}
+ * if and only if {@code (this.capacity - this.writerIndex)} is greater
+ * than {@code 0}.
+ */
+ boolean writable();
+
+ /**
+ * Sets the {@code readerIndex} and {@code writerIndex} of this buffer to
+ * {@code 0}.
+ * This method is identical to {@link #setIndex(int, int) setIndex(0, 0)}.
+ * <p>
+ * Please note that the behavior of this method is different
+ * from that of NIO buffer, which sets the {@code limit} to
+ * the {@code capacity} of the buffer.
+ */
+ void clear();
+
+ /**
+ * Marks the current {@code readerIndex} in this buffer. You can
+ * reposition the current {@code readerIndex} to the marked
+ * {@code readerIndex} by calling {@link #resetReaderIndex()}.
+ * The initial value of the marked {@code readerIndex} is {@code 0}.
+ */
+ void markReaderIndex();
+
+ /**
+ * Repositions the current {@code readerIndex} to the marked
+ * {@code readerIndex} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the current {@code writerIndex} is less than the marked
+ * {@code readerIndex}
+ */
+ void resetReaderIndex();
+
+ /**
+ * Marks the current {@code writerIndex} in this buffer. You can
+ * reposition the current {@code writerIndex} to the marked
+ * {@code writerIndex} by calling {@link #resetWriterIndex()}.
+ * The initial value of the marked {@code writerIndex} is {@code 0}.
+ */
+ void markWriterIndex();
+
+ /**
+ * Repositions the current {@code writerIndex} to the marked
+ * {@code writerIndex} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the current {@code readerIndex} is greater than the marked
+ * {@code writerIndex}
+ */
+ void resetWriterIndex();
+
+ /**
+ * Discards the bytes between the 0th index and {@code readerIndex}.
+ * It moves the bytes between {@code readerIndex} and {@code writerIndex}
+ * to the 0th index, and sets {@code readerIndex} and {@code writerIndex}
+ * to {@code 0} and {@code oldWriterIndex - oldReaderIndex} respectively.
+ * <p>
+ * Please refer to the class documentation for more detailed explanation.
+ */
+ void discardReadBytes();
+
+ /**
+ * Gets a byte at the specified absolute {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 1} is greater than {@code this.capacity}
+ */
+ byte getByte(int index);
+
+ /**
+ * Gets an unsigned byte at the specified absolute {@code index} in this
+ * buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 1} is greater than {@code this.capacity}
+ */
+ short getUnsignedByte(int index);
+
+ /**
+ * Gets a 16-bit short integer at the specified absolute {@code index} in
+ * this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ short getShort(int index);
+
+ /**
+ * Gets an unsigned 16-bit short integer at the specified absolute
+ * {@code index} in this buffer. This method does not modify
+ * {@code readerIndex} or {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ int getUnsignedShort(int index);
+
+ /**
+ * Gets a 32-bit integer at the specified absolute {@code index} in
+ * this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ int getInt(int index);
+
+ /**
+ * Gets an unsigned 32-bit integer at the specified absolute {@code index}
+ * in this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ long getUnsignedInt(int index);
+
+ /**
+ * Gets a 64-bit long integer at the specified absolute {@code index} in
+ * this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 8} is greater than {@code this.capacity}
+ */
+ long getLong(int index);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index} until the destination becomes
+ * non-writable. This method is basically same with
+ * {@link #getBytes(int, HornetQBuffer, int, int)}, except that this
+ * method increases the {@code writerIndex} of the destination by the
+ * number of the transferred bytes while
+ * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * the source buffer (i.e. {@code this}).
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + dst.writableBytes} is greater than
+ * {@code this.capacity}
+ */
+ void getBytes(int index, HornetQBuffer dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}. This method is basically same
+ * with {@link #getBytes(int, HornetQBuffer, int, int)}, except that this
+ * method increases the {@code writerIndex} of the destination by the
+ * number of the transferred bytes while
+ * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * the source buffer (i.e. {@code this}).
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code length} is greater than {@code dst.writableBytes}
+ */
+ void getBytes(int index, HornetQBuffer dst, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex}
+ * of both the source (i.e. {@code this}) and the destination.
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code dstIndex + length} is greater than
+ * {@code dst.capacity}
+ */
+ void getBytes(int index, HornetQBuffer dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + dst.length} is greater than
+ * {@code this.capacity}
+ */
+ void getBytes(int index, byte[] dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex}
+ * of this buffer.
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code dstIndex + length} is greater than
+ * {@code dst.length}
+ */
+ void getBytes(int index, byte[] dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the specified absolute {@code index} until the destination's position
+ * reaches its limit.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer while the destination's {@code position} will be increased.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + dst.remaining()} is greater than
+ * {@code this.capacity}
+ */
+ void getBytes(int index, ByteBuffer dst);
+
+ /**
+ * Gets a char at the specified absolute {@code index} in
+ * this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ char getChar(int index);
+
+ /**
+ * Gets a float at the specified absolute {@code index} in
+ * this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ float getFloat(int index);
+
+ /**
+ * Gets a double at the specified absolute {@code index} in
+ * this buffer. This method does not modify {@code readerIndex} or
+ * {@code writerIndex} of this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 8} is greater than {@code this.capacity}
+ */
+ double getDouble(int index);
+
+ /**
+ * Sets the specified byte at the specified absolute {@code index} in this
+ * buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 1} is greater than {@code this.capacity}
+ */
+ void setByte(int index, byte value);
+
+ /**
+ * Sets the specified 16-bit short integer at the specified absolute
+ * {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ void setShort(int index, short value);
+
+ /**
+ * Sets the specified 32-bit integer at the specified absolute
+ * {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ void setInt(int index, int value);
+
+ /**
+ * Sets the specified 64-bit long integer at the specified absolute
+ * {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 8} is greater than {@code this.capacity}
+ */
+ void setLong(int index, long value);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index} until the destination becomes
+ * unreadable. This method is basically same with
+ * {@link #setBytes(int, HornetQBuffer, int, int)}, except that this
+ * method increases the {@code readerIndex} of the source buffer by
+ * the number of the transferred bytes while
+ * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * the source buffer (i.e. {@code this}).
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + src.readableBytes} is greater than
+ * {@code this.capacity}
+ */
+ void setBytes(int index, HornetQBuffer src);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index}. This method is basically same
+ * with {@link #setBytes(int, HornetQBuffer, int, int)}, except that this
+ * method increases the {@code readerIndex} of the source buffer by
+ * the number of the transferred bytes while
+ * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * the source buffer (i.e. {@code this}).
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code length} is greater than {@code src.readableBytes}
+ */
+ void setBytes(int index, HornetQBuffer src, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex}
+ * of both the source (i.e. {@code this}) and the destination.
+ *
+ * @param srcIndex the first index of the source
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code srcIndex + length} is greater than
+ * {@code src.capacity}
+ */
+ void setBytes(int index, HornetQBuffer src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the specified absolute {@code index}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + src.length} is greater than
+ * {@code this.capacity}
+ */
+ void setBytes(int index, byte[] src);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the specified absolute {@code index}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0},
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code index + length} is greater than
+ * {@code this.capacity}, or
+ * if {@code srcIndex + length} is greater than {@code src.length}
+ */
+ void setBytes(int index, byte[] src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the specified absolute {@code index} until the source buffer's position
+ * reaches its limit.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * if {@code index + src.remaining()} is greater than
+ * {@code this.capacity}
+ */
+ void setBytes(int index, ByteBuffer src);
+
+ /**
+ * Sets the specified char at the specified absolute
+ * {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 2} is greater than {@code this.capacity}
+ */
+ void setChar(int index, char value);
+
+ /**
+ * Sets the specified float at the specified absolute
+ * {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 4} is greater than {@code this.capacity}
+ */
+ void setFloat(int index, float value);
+
+ /**
+ * Sets the specified double at the specified absolute
+ * {@code index} in this buffer.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code index} is less than {@code 0} or
+ * {@code index + 8} is greater than {@code this.capacity}
+ */
+ void setDouble(int index, double value);
+
+ /**
+ * Gets a byte at the current {@code readerIndex} and increases
+ * the {@code readerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 1}
+ */
+ byte readByte();
+
+ /**
+ * Gets an unsigned byte at the current {@code readerIndex} and increases
+ * the {@code readerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 1}
+ */
+ short readUnsignedByte();
+
+ /**
+ * Gets a 16-bit short integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 2} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 2}
+ */
+ short readShort();
+
+ /**
+ * Gets an unsigned 16-bit short integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 2} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 2}
+ */
+ int readUnsignedShort();
+
+ /**
+ * Gets a 32-bit integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 4}
+ */
+ int readInt();
+
+ /**
+ * Gets an unsigned 32-bit integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 4}
+ */
+ long readUnsignedInt();
+
+ /**
+ * Gets a 64-bit integer at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 8} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 8}
+ */
+ long readLong();
+
+ /**
+ * Gets a char at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 2} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 2}
+ */
+ char readChar();
+
+ /**
+ * Gets a float at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 4}
+ */
+ float readFloat();
+
+ /**
+ * Gets a double at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 8} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 8}
+ */
+ double readDouble();
+
+ /**
+ * Gets a boolean at the current {@code readerIndex}
+ * and increases the {@code readerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.readableBytes} is less than {@code 1}
+ */
+ boolean readBoolean();
+
+ /**
+ * Gets a SimpleString (potentially {@code null}) at the current {@code readerIndex}
+ */
+ SimpleString readNullableSimpleString();
+
+ /**
+ * Gets a String (potentially {@code null}) at the current {@code readerIndex}
+ */
+ String readNullableString();
+
+ /**
+ * Gets a non-null SimpleString at the current {@code readerIndex}
+ */
+ SimpleString readSimpleString();
+
+ /**
+ * Gets a non-null String at the current {@code readerIndex}
+ */
+ String readString();
+
+ /**
+ * Gets a UTF-8 String at the current {@code readerIndex}
+ */
+ String readUTF();
+
+ /**
+ * Transfers this buffer's data to a newly created buffer starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ * The returned buffer's {@code readerIndex} and {@code writerIndex} are
+ * {@code 0} and {@code length} respectively.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @return the newly created buffer which contains the transferred bytes
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ */
+ HornetQBuffer readBytes(int length);
+
+ /**
+ * Returns a new slice of this buffer's sub-region starting at the current
+ * {@code readerIndex} and increases the {@code readerIndex} by the size
+ * of the new slice (= {@code length}).
+ *
+ * @param length the size of the new slice
+ *
+ * @return the newly created slice
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ */
+ HornetQBuffer readSlice(int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} until the destination becomes
+ * non-writable, and increases the {@code readerIndex} by the number of the
+ * transferred bytes. This method is basically same with
+ * {@link #readBytes(HornetQBuffer, int, int)}, except that this method
+ * increases the {@code writerIndex} of the destination by the number of
+ * the transferred bytes while {@link #readBytes(HornetQBuffer, int, int)}
+ * does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code dst.writableBytes} is greater than
+ * {@code this.readableBytes}
+ */
+ void readBytes(HornetQBuffer dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}). This method
+ * is basically same with {@link #readBytes(HornetQBuffer, int, int)},
+ * except that this method increases the {@code writerIndex} of the
+ * destination by the number of the transferred bytes (= {@code length})
+ * while {@link #readBytes(HornetQBuffer, int, int)} does not.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes} or
+ * if {@code length} is greater than {@code dst.writableBytes}
+ */
+ void readBytes(HornetQBuffer dst, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code length} is greater than {@code this.readableBytes}, or
+ * if {@code dstIndex + length} is greater than
+ * {@code dst.capacity}
+ */
+ void readBytes(HornetQBuffer dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code dst.length}).
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code dst.length} is greater than {@code this.readableBytes}
+ */
+ void readBytes(byte[] dst);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} and increases the {@code readerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param dstIndex the first index of the destination
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code dstIndex} is less than {@code 0},
+ * if {@code length} is greater than {@code this.readableBytes}, or
+ * if {@code dstIndex + length} is greater than {@code dst.length}
+ */
+ void readBytes(byte[] dst, int dstIndex, int length);
+
+ /**
+ * Transfers this buffer's data to the specified destination starting at
+ * the current {@code readerIndex} until the destination's position
+ * reaches its limit, and increases the {@code readerIndex} by the
+ * number of the transferred bytes.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code dst.remaining()} is greater than
+ * {@code this.readableBytes}
+ */
+ void readBytes(ByteBuffer dst);
+
+ /**
+ * Increases the current {@code readerIndex} by the specified
+ * {@code length} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.readableBytes}
+ */
+ void skipBytes(int length);
+
+ /**
+ * Sets the specified byte at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 1} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 1}
+ */
+ void writeByte(byte value);
+
+ /**
+ * Sets the specified 16-bit short integer at the current
+ * {@code writerIndex} and increases the {@code writerIndex} by {@code 2}
+ * in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 2}
+ */
+ void writeShort(short value);
+
+ /**
+ * Sets the specified 32-bit integer at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 4}
+ */
+ void writeInt(int value);
+
+ /**
+ * Sets the specified 64-bit long integer at the current
+ * {@code writerIndex} and increases the {@code writerIndex} by {@code 8}
+ * in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 8}
+ */
+ void writeLong(long value);
+
+ /**
+ * Sets the specified char at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 2} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 2}
+ */
+ void writeChar(char chr);
+
+ /**
+ * Sets the specified float at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 4} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 4}
+ */
+ void writeFloat(float value);
+
+ /**
+ * Sets the specified double at the current {@code writerIndex}
+ * and increases the {@code writerIndex} by {@code 8} in this buffer.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code this.writableBytes} is less than {@code 8}
+ */
+ void writeDouble(double value);
+
+ /**
+ * Sets the specified boolean at the current {@code writerIndex}
+ */
+ void writeBoolean(boolean val);
+
+ /**
+ * Sets the specified SimpleString (potentially {@code null}) at the current {@code writerIndex}
+ */
+ void writeNullableSimpleString(SimpleString val);
+
+ /**
+ * Sets the specified String (potentially {@code null}) at the current {@code writerIndex}
+ */
+ void writeNullableString(String val);
+
+ /**
+ * Sets the specified non-null SimpleString at the current {@code writerIndex}
+ */
+ void writeSimpleString(SimpleString val);
+
+ /**
+ * Sets the specified non-null String at the current {@code writerIndex}
+ */
+ void writeString(String val);
+
+ /**
+ * Sets the specified UTF-8 String at the current {@code writerIndex}
+ */
+
+ void writeUTF(String utf);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code length}). This method
+ * is basically same with {@link #writeBytes(HornetQBuffer, int, int)},
+ * except that this method increases the {@code readerIndex} of the source
+ * buffer by the number of the transferred bytes (= {@code length}) while
+ * {@link #writeBytes(HornetQBuffer, int, int)} does not.
+ *
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code length} is greater than {@code this.writableBytes} or
+ * if {@code length} is greater then {@code src.readableBytes}
+ */
+ void writeBytes(HornetQBuffer src, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param srcIndex the first index of the source
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code srcIndex + length} is greater than
+ * {@code src.capacity}, or
+ * if {@code length} is greater than {@code this.writableBytes}
+ */
+ void writeBytes(HornetQBuffer src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code src.length}).
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code src.length} is greater than {@code this.writableBytes}
+ */
+ void writeBytes(byte[] src);
+
+ /**
+ * Transfers the specified source array's data to this buffer starting at
+ * the current {@code writerIndex} and increases the {@code writerIndex}
+ * by the number of the transferred bytes (= {@code length}).
+ *
+ * @param srcIndex the first index of the source
+ * @param length the number of bytes to transfer
+ *
+ * @throws IndexOutOfBoundsException
+ * if the specified {@code srcIndex} is less than {@code 0},
+ * if {@code srcIndex + length} is greater than
+ * {@code src.length}, or
+ * if {@code length} is greater than {@code this.writableBytes}
+ */
+ void writeBytes(byte[] src, int srcIndex, int length);
+
+ /**
+ * Transfers the specified source buffer's data to this buffer starting at
+ * the current {@code writerIndex} until the source buffer's position
+ * reaches its limit, and increases the {@code writerIndex} by the
+ * number of the transferred bytes.
+ *
+ * @throws IndexOutOfBoundsException
+ * if {@code src.remaining()} is greater than
+ * {@code this.writableBytes}
+ */
+ void writeBytes(ByteBuffer src);
+
+ /**
+ * Returns a copy of this buffer's readable bytes. Modifying the content
+ * of the returned buffer or this buffer does not affect each other at all.
+ * This method is identical to {@code buf.copy(buf.readerIndex(), buf.readableBytes())}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ *
+ */
+ HornetQBuffer copy();
+
+ /**
+ * Returns a copy of this buffer's sub-region. Modifying the content of
+ * the returned buffer or this buffer does not affect each other at all.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ */
+ HornetQBuffer copy(int index, int length);
+
+ /**
+ * Returns a slice of this buffer's readable bytes. Modifying the content
+ * of the returned buffer or this buffer affects each other's content
+ * while they maintain separate indexes and marks. This method is
+ * identical to {@code buf.slice(buf.readerIndex(), buf.readableBytes())}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ */
+ HornetQBuffer slice();
+
+ /**
+ * Returns a slice of this buffer's sub-region. Modifying the content of
+ * the returned buffer or this buffer affects each other's content while
+ * they maintain separate indexes and marks.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ */
+ HornetQBuffer slice(int index, int length);
+
+ /**
+ * Returns a buffer which shares the whole region of this buffer.
+ * Modifying the content of the returned buffer or this buffer affects
+ * each other's content while they maintain separate indexes and marks.
+ * This method is identical to {@code buf.slice(0, buf.capacity())}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ */
+ HornetQBuffer duplicate();
+
+ /**
+ * Converts this buffer's readable bytes into a NIO buffer. The returned
+ * buffer might or might not share the content with this buffer, while
+ * they have separate indexes and marks. This method is identical to
+ * {@code buf.toByteBuffer(buf.readerIndex(), buf.readableBytes())}.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ */
+ ByteBuffer toByteBuffer();
+
+ /**
+ * Converts this buffer's sub-region into a NIO buffer. The returned
+ * buffer might or might not share the content with this buffer, while
+ * they have separate indexes and marks.
+ * This method does not modify {@code readerIndex} or {@code writerIndex} of
+ * this buffer.
+ */
+ ByteBuffer toByteBuffer(int index, int length);
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffers.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffers.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffers.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/HornetQBuffers.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.api.core;
+
+import java.nio.ByteBuffer;
+
+import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+
+/**
+ * Factory class to create HornetQBuffers
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ */
+public final class HornetQBuffers
+{
+ /**
+ * Creates a <em>self-expanding</em> HornetQBuffer with the given initial size
+ *
+ * @param size the initial size of the created HornetQBuffer
+ * @return a self-expanding HornetQBuffer starting with the given size
+ */
+ public static HornetQBuffer dynamicBuffer(final int size)
+ {
+ return new ChannelBufferWrapper(ChannelBuffers.dynamicBuffer(size));
+ }
+
+ /**
+ * Creates a <em>self-expanding</em> HornetQBuffer filled with the given byte array
+ *
+ * @param bytes the created buffer will be initially filled with this byte array
+ * @return a self-expanding HornetQBuffer filled with the given byte array
+ */
+ public static HornetQBuffer dynamicBuffer(final byte[] bytes)
+ {
+ ChannelBuffer buff = ChannelBuffers.dynamicBuffer(bytes.length);
+
+ buff.writeBytes(bytes);
+
+ return new ChannelBufferWrapper(buff);
+ }
+
+ /**
+ * Creates a HornetQBuffer wrapping an underlying NIO ByteBuffer
+ *
+ * The position on this buffer won't affect the position on the inner buffer
+ *
+ * @param underlying the underlying NIO ByteBuffer
+ * @return a HornetQBuffer wrapping the underlying NIO ByteBuffer
+ */
+ public static HornetQBuffer wrappedBuffer(final ByteBuffer underlying)
+ {
+ HornetQBuffer buff = new ChannelBufferWrapper(ChannelBuffers.wrappedBuffer(underlying));
+
+ buff.clear();
+
+ return buff;
+ }
+
+ /**
+ * Creates a HornetQBuffer wrapping an underlying byte array
+ *
+ * @param underlying the underlying byte array
+ * @return a HornetQBuffer wrapping the underlying byte array
+ */
+ public static HornetQBuffer wrappedBuffer(final byte[] underlying)
+ {
+ return new ChannelBufferWrapper(ChannelBuffers.wrappedBuffer(underlying));
+ }
+
+ /**
+ * Creates a <em>fixed</em> HornetQBuffer of the given size
+ *
+ * @param size the size of the created HornetQBuffer
+ * @return a fixed HornetQBuffer with the given size
+ */
+ public static HornetQBuffer fixedBuffer(final int size)
+ {
+ return new ChannelBufferWrapper(ChannelBuffers.buffer(size));
+ }
+
+ private HornetQBuffers()
+ {
+ }
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/Pair.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/Pair.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/Pair.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/Pair.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.api.core;
+
+import java.io.Serializable;
+
+/**
+ *
+ * A Pair is a holder for 2 objects.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class Pair<A, B> implements Serializable
+{
+ private static final long serialVersionUID = -2496357457812368127L;
+
+ public Pair(final A a, final B b)
+ {
+ this.a = a;
+
+ this.b = b;
+ }
+
+ public A a;
+
+ public B b;
+
+ private int hash = -1;
+
+ @Override
+ public int hashCode()
+ {
+ if (hash == -1)
+ {
+ if (a == null && b == null)
+ {
+ return super.hashCode();
+ }
+ else
+ {
+ hash = (a == null ? 0 : a.hashCode()) + 37 * (b == null ? 0 : b.hashCode());
+ }
+ }
+
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ if (other == this)
+ {
+ return true;
+ }
+
+ if (other instanceof Pair == false)
+ {
+ return false;
+ }
+
+ Pair<A, B> pother = (Pair<A, B>)other;
+
+ return (pother.a == null ? a == null : pother.a.equals(a)) && (pother.b == null ? b == null : pother.b.equals(b));
+
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Pair[a=" + a + ", b=" + b + "]";
+ }
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/SimpleString.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/api/core/SimpleString.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,373 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.api.core;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A simple String class that can store all characters, and stores as simple
+ * byte[], this minimises expensive copying between String objects.
+ *
+ * This object is used heavily throughout HornetQ for performance reasons.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+
+public final class SimpleString implements CharSequence, Serializable, Comparable<SimpleString>
+{
+ private static final long serialVersionUID = 4204223851422244307L;
+
+ // Attributes
+ // ------------------------------------------------------------------------
+ private final byte[] data;
+
+ private transient int hash;
+
+ // Cache the string
+ private transient String str;
+
+ // Static
+ // ----------------------------------------------------------------------
+
+ /**
+ * Returns a SimpleString constructed from the <code>string</code> parameter.
+ * If <code>string</code> is <code>null</code>, the return value will be
+ * <code>null</code> too.
+ */
+ public static SimpleString toSimpleString(final String string) {
+ if (string == null) {
+ return null;
+ }
+ return new SimpleString(string);
+ }
+
+ // Constructors
+ // ----------------------------------------------------------------------
+ /**
+ * creates a SimpleString from a conventional String
+ * @param string the string to transform
+ */
+ public SimpleString(final String string) {
+ int len = string.length();
+
+ data = new byte[len << 1];
+
+ int j = 0;
+
+ for (int i = 0; i < len; i++) {
+ char c = string.charAt(i);
+
+ byte low = (byte) (c & 0xFF); // low byte
+
+ data[j++] = low;
+
+ byte high = (byte) (c >> 8 & 0xFF); // high byte
+
+ data[j++] = high;
+ }
+
+ str = string;
+ }
+
+ /**
+ * creates a SimpleString from a byte array
+ * @param data the byte array to use
+ */
+ public SimpleString(final byte[] data) {
+ this.data = data;
+ }
+
+ // CharSequence implementation
+ // ---------------------------------------------------------------------------
+
+ public int length() {
+ return data.length >> 1;
+ }
+
+ public char charAt(int pos) {
+ if (pos < 0 || pos >= data.length >> 1) {
+ throw new IndexOutOfBoundsException();
+ }
+ pos <<= 1;
+
+ return (char) (data[pos] | data[pos + 1] << 8);
+ }
+
+ public CharSequence subSequence(final int start, final int end) {
+ int len = data.length >> 1;
+
+ if (end < start || start < 0 || end > len) {
+ throw new IndexOutOfBoundsException();
+ } else {
+ int newlen = end - start << 1;
+ byte[] bytes = new byte[newlen];
+
+ System.arraycopy(data, start << 1, bytes, 0, newlen);
+
+ return new SimpleString(bytes);
+ }
+ }
+
+ // Comparable implementation -------------------------------------
+
+ public int compareTo(final SimpleString o) {
+ return toString().compareTo(o.toString());
+ }
+
+ // Public
+ // ---------------------------------------------------------------------------
+
+ /**
+ * returns the underlying byte array of this SimpleString
+ * @return the byte array
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ /**
+ * returns true if the SimpleString parameter starts with the same data as
+ * this one. false if not.
+ * @param other the SimpelString to look for
+ * @return true if this SimpleString starts with the same data
+ */
+ public boolean startsWith(final SimpleString other) {
+ byte[] otherdata = other.data;
+
+ if (otherdata.length > data.length) {
+ return false;
+ }
+
+ for (int i = 0; i < otherdata.length; i++) {
+ if (data[i] != otherdata[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ if (str == null) {
+ int len = data.length >> 1;
+
+ char[] chars = new char[len];
+
+ int j = 0;
+
+ for (int i = 0; i < len; i++) {
+ int low = data[j++] & 0xFF;
+
+ int high = data[j++] << 8 & 0xFF00;
+
+ chars[i] = (char) (low | high);
+ }
+
+ str = new String(chars);
+ }
+
+ return str;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other instanceof SimpleString) {
+ SimpleString s = (SimpleString) other;
+
+ if (data.length != s.data.length) {
+ return false;
+ }
+
+ for (int i = 0; i < data.length; i++) {
+ if (data[i] != s.data[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ if (hash == 0) {
+ int tmphash = 0;
+ for (byte element : data) {
+ tmphash = (tmphash << 5) - tmphash + element; // (hash << 5) - hash is
+ // same as hash * 31
+ }
+ hash = tmphash;
+ }
+
+ return hash;
+ }
+
+ /**
+ * splits this SimpleString into an array of SimpleString using the char param
+ * as the delimeter.
+ *
+ * i.e. "a.b" would return "a" and "b" if . was the delimeter
+ * @param delim
+ */
+ public SimpleString[] split(final char delim) {
+ if (!contains(delim)) {
+ return new SimpleString[] { this };
+ } else {
+ List<SimpleString> all = new ArrayList<SimpleString>();
+ int lasPos = 0;
+ for (int i = 0; i < data.length; i += 2) {
+ byte low = (byte) (delim & 0xFF); // low byte
+ byte high = (byte) (delim >> 8 & 0xFF); // high byte
+ if (data[i] == low && data[i + 1] == high) {
+ byte[] bytes = new byte[i - lasPos];
+ System.arraycopy(data, lasPos, bytes, 0, bytes.length);
+ lasPos = i + 2;
+ all.add(new SimpleString(bytes));
+ }
+ }
+ byte[] bytes = new byte[data.length - lasPos];
+ System.arraycopy(data, lasPos, bytes, 0, bytes.length);
+ all.add(new SimpleString(bytes));
+ SimpleString[] parts = new SimpleString[all.size()];
+ return all.toArray(parts);
+ }
+ }
+
+ /**
+ * checks to see if this SimpleString contains the char parameter passed in
+ *
+ * @param c the char to check for
+ * @return true if the char is found, false otherwise.
+ */
+ public boolean contains(final char c) {
+ for (int i = 0; i < data.length; i += 2) {
+ byte low = (byte) (c & 0xFF); // low byte
+ byte high = (byte) (c >> 8 & 0xFF); // high byte
+ if (data[i] == low && data[i + 1] == high) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * concatanates a SimpleString and a String
+ *
+ * @param toAdd the String to concate with.
+ * @return the concatanated SimpleString
+ */
+ public SimpleString concat(final String toAdd) {
+ return concat(new SimpleString(toAdd));
+ }
+
+ /**
+ * concatanates 2 SimpleString's
+ *
+ * @param toAdd the SimpleString to concate with.
+ * @return the concatanated SimpleString
+ */
+ public SimpleString concat(final SimpleString toAdd) {
+ byte[] bytes = new byte[data.length + toAdd.getData().length];
+ System.arraycopy(data, 0, bytes, 0, data.length);
+ System.arraycopy(toAdd.getData(), 0, bytes, data.length, toAdd.getData().length);
+ return new SimpleString(bytes);
+ }
+
+ /**
+ * concatanates a SimpleString and a char
+ *
+ * @param c the char to concate with.
+ * @return the concatanated SimpleString
+ */
+ public SimpleString concat(final char c) {
+ byte[] bytes = new byte[data.length + 2];
+ System.arraycopy(data, 0, bytes, 0, data.length);
+ bytes[data.length] = (byte) (c & 0xFF);
+ bytes[data.length + 1] = (byte) (c >> 8 & 0xFF);
+ return new SimpleString(bytes);
+ }
+
+ /**
+ * returns the size of this SimpleString
+ * @return the size
+ */
+ public int sizeof() {
+ return DataConstants.SIZE_INT + data.length;
+ }
+
+ /**
+ * returns the size of a SimpleString
+ * @param str the SimpleString to check
+ * @return the size
+ */
+ public static int sizeofString(final SimpleString str) {
+ return str.sizeof();
+ }
+
+ /**
+ * returns the size of a SimpleString which could be null
+ * @param str the SimpleString to check
+ * @return the size
+ */
+ public static int sizeofNullableString(final SimpleString str) {
+ if (str == null) {
+ return 1;
+ } else {
+ return 1 + str.sizeof();
+ }
+ }
+
+ /**
+ *
+ * @param srcBegin
+ * @param srcEnd
+ * @param dst
+ * @param dstBegin
+ */
+ public void getChars(final int srcBegin, final int srcEnd, final char dst[],
+ final int dstBegin) {
+ if (srcBegin < 0) {
+ throw new StringIndexOutOfBoundsException(srcBegin);
+ }
+ if (srcEnd > length()) {
+ throw new StringIndexOutOfBoundsException(srcEnd);
+ }
+ if (srcBegin > srcEnd) {
+ throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
+ }
+
+ int j = 0;
+
+ for (int i = srcBegin; i < srcEnd - srcBegin; i++) {
+ int low = data[j++] & 0xFF;
+
+ int high = data[j++] << 8 & 0xFF00;
+
+ dst[i] = (char) (low | high);
+ }
+ }
+
+}
\ No newline at end of file
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,620 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.buffers.impl;
+
+import java.nio.ByteBuffer;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.utils.DataConstants;
+import org.hornetq.utils.UTF8Util;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+/**
+ *
+ * A ChannelBufferWrapper
+ *
+ * @author Tim Fox
+ *
+ *
+ */
+public class ChannelBufferWrapper implements HornetQBuffer
+{
+ private static final Logger log = Logger.getLogger(ChannelBufferWrapper.class);
+
+ protected ChannelBuffer buffer;
+
+ public ChannelBufferWrapper(final ChannelBuffer buffer)
+ {
+ this.buffer = buffer;
+ }
+
+ public boolean readBoolean()
+ {
+ return readByte() != 0;
+ }
+
+ public SimpleString readNullableSimpleString()
+ {
+ int b = buffer.readByte();
+ if (b == DataConstants.NULL)
+ {
+ return null;
+ }
+ else
+ {
+ return readSimpleStringInternal();
+ }
+ }
+
+ public String readNullableString()
+ {
+ int b = buffer.readByte();
+ if (b == DataConstants.NULL)
+ {
+ return null;
+ }
+ else
+ {
+ return readStringInternal();
+ }
+ }
+
+ public SimpleString readSimpleString()
+ {
+ return readSimpleStringInternal();
+ }
+
+ private SimpleString readSimpleStringInternal()
+ {
+ int len = buffer.readInt();
+ byte[] data = new byte[len];
+ buffer.readBytes(data);
+ return new SimpleString(data);
+ }
+
+ public String readString()
+ {
+ return readStringInternal();
+ }
+
+ private String readStringInternal()
+ {
+ int len = buffer.readInt();
+
+ if (len < 9)
+ {
+ char[] chars = new char[len];
+ for (int i = 0; i < len; i++)
+ {
+ chars[i] = (char)buffer.readShort();
+ }
+ return new String(chars);
+ }
+ else if (len < 0xfff)
+ {
+ return readUTF();
+ }
+ else
+ {
+ return readSimpleStringInternal().toString();
+ }
+ }
+
+ public String readUTF()
+ {
+ return UTF8Util.readUTF(this);
+ }
+
+ public void writeBoolean(final boolean val)
+ {
+ buffer.writeByte((byte)(val ? -1 : 0));
+ }
+
+ public void writeNullableSimpleString(final SimpleString val)
+ {
+ if (val == null)
+ {
+ buffer.writeByte(DataConstants.NULL);
+ }
+ else
+ {
+ buffer.writeByte(DataConstants.NOT_NULL);
+ writeSimpleStringInternal(val);
+ }
+ }
+
+ public void writeNullableString(final String val)
+ {
+ if (val == null)
+ {
+ buffer.writeByte(DataConstants.NULL);
+ }
+ else
+ {
+ buffer.writeByte(DataConstants.NOT_NULL);
+ writeStringInternal(val);
+ }
+ }
+
+ public void writeSimpleString(final SimpleString val)
+ {
+ writeSimpleStringInternal(val);
+ }
+
+ private void writeSimpleStringInternal(final SimpleString val)
+ {
+ byte[] data = val.getData();
+ buffer.writeInt(data.length);
+ buffer.writeBytes(data);
+ }
+
+ public void writeString(final String val)
+ {
+ writeStringInternal(val);
+ }
+
+ private void writeStringInternal(final String val)
+ {
+ int length = val.length();
+
+ buffer.writeInt(length);
+
+ if (length < 9)
+ {
+ // If very small it's more performant to store char by char
+ for (int i = 0; i < val.length(); i++)
+ {
+ buffer.writeShort((short)val.charAt(i));
+ }
+ }
+ else if (length < 0xfff)
+ {
+ // Store as UTF - this is quicker than char by char for most strings
+ writeUTF(val);
+ }
+ else
+ {
+ // Store as SimpleString, since can't store utf > 0xffff in length
+ writeSimpleStringInternal(new SimpleString(val));
+ }
+ }
+
+ public void writeUTF(final String utf)
+ {
+ UTF8Util.saveUTF(this, utf);
+ }
+
+ public int capacity()
+ {
+ return buffer.capacity();
+ }
+
+ public ChannelBuffer channelBuffer()
+ {
+ return buffer;
+ }
+
+ public void clear()
+ {
+ buffer.clear();
+ }
+
+ public HornetQBuffer copy()
+ {
+ return new ChannelBufferWrapper(buffer.copy());
+ }
+
+ public HornetQBuffer copy(final int index, final int length)
+ {
+ return new ChannelBufferWrapper(buffer.copy(index, length));
+ }
+
+ public void discardReadBytes()
+ {
+ buffer.discardReadBytes();
+ }
+
+ public HornetQBuffer duplicate()
+ {
+ return new ChannelBufferWrapper(buffer.duplicate());
+ }
+
+ public byte getByte(final int index)
+ {
+ return buffer.getByte(index);
+ }
+
+ public void getBytes(final int index, final byte[] dst, final int dstIndex, final int length)
+ {
+ buffer.getBytes(index, dst, dstIndex, length);
+ }
+
+ public void getBytes(final int index, final byte[] dst)
+ {
+ buffer.getBytes(index, dst);
+ }
+
+ public void getBytes(final int index, final ByteBuffer dst)
+ {
+ buffer.getBytes(index, dst);
+ }
+
+ public void getBytes(final int index, final HornetQBuffer dst, final int dstIndex, final int length)
+ {
+ buffer.getBytes(index, dst.channelBuffer(), dstIndex, length);
+ }
+
+ public void getBytes(final int index, final HornetQBuffer dst, final int length)
+ {
+ buffer.getBytes(index, dst.channelBuffer(), length);
+ }
+
+ public void getBytes(final int index, final HornetQBuffer dst)
+ {
+ buffer.getBytes(index, dst.channelBuffer());
+ }
+
+ public char getChar(final int index)
+ {
+ return (char)buffer.getShort(index);
+ }
+
+ public double getDouble(final int index)
+ {
+ return Double.longBitsToDouble(buffer.getLong(index));
+ }
+
+ public float getFloat(final int index)
+ {
+ return Float.intBitsToFloat(buffer.getInt(index));
+ }
+
+ public int getInt(final int index)
+ {
+ return buffer.getInt(index);
+ }
+
+ public long getLong(final int index)
+ {
+ return buffer.getLong(index);
+ }
+
+ public short getShort(final int index)
+ {
+ return buffer.getShort(index);
+ }
+
+ public short getUnsignedByte(final int index)
+ {
+ return buffer.getUnsignedByte(index);
+ }
+
+ public long getUnsignedInt(final int index)
+ {
+ return buffer.getUnsignedInt(index);
+ }
+
+ public int getUnsignedShort(final int index)
+ {
+ return buffer.getUnsignedShort(index);
+ }
+
+ public void markReaderIndex()
+ {
+ buffer.markReaderIndex();
+ }
+
+ public void markWriterIndex()
+ {
+ buffer.markWriterIndex();
+ }
+
+ public boolean readable()
+ {
+ return buffer.readable();
+ }
+
+ public int readableBytes()
+ {
+ return buffer.readableBytes();
+ }
+
+ public byte readByte()
+ {
+ return buffer.readByte();
+ }
+
+ public void readBytes(final byte[] dst, final int dstIndex, final int length)
+ {
+ buffer.readBytes(dst, dstIndex, length);
+ }
+
+ public void readBytes(final byte[] dst)
+ {
+ buffer.readBytes(dst);
+ }
+
+ public void readBytes(final ByteBuffer dst)
+ {
+ buffer.readBytes(dst);
+ }
+
+ public void readBytes(final HornetQBuffer dst, final int dstIndex, final int length)
+ {
+ buffer.readBytes(dst.channelBuffer(), dstIndex, length);
+ }
+
+ public void readBytes(final HornetQBuffer dst, final int length)
+ {
+ buffer.readBytes(dst.channelBuffer(), length);
+ }
+
+ public void readBytes(final HornetQBuffer dst)
+ {
+ buffer.readBytes(dst.channelBuffer());
+ }
+
+ public HornetQBuffer readBytes(final int length)
+ {
+ return new ChannelBufferWrapper(buffer.readBytes(length));
+ }
+
+ public char readChar()
+ {
+ return (char)buffer.readShort();
+ }
+
+ public double readDouble()
+ {
+ return Double.longBitsToDouble(buffer.readLong());
+ }
+
+ public int readerIndex()
+ {
+ return buffer.readerIndex();
+ }
+
+ public void readerIndex(final int readerIndex)
+ {
+ buffer.readerIndex(readerIndex);
+ }
+
+ public float readFloat()
+ {
+ return Float.intBitsToFloat(buffer.readInt());
+ }
+
+ public int readInt()
+ {
+ return buffer.readInt();
+ }
+
+ public long readLong()
+ {
+ return buffer.readLong();
+ }
+
+ public short readShort()
+ {
+ return buffer.readShort();
+ }
+
+ public HornetQBuffer readSlice(final int length)
+ {
+ return new ChannelBufferWrapper(buffer.readSlice(length));
+ }
+
+ public short readUnsignedByte()
+ {
+ return buffer.readUnsignedByte();
+ }
+
+ public long readUnsignedInt()
+ {
+ return buffer.readUnsignedInt();
+ }
+
+ public int readUnsignedShort()
+ {
+ return buffer.readUnsignedShort();
+ }
+
+ public void resetReaderIndex()
+ {
+ buffer.resetReaderIndex();
+ }
+
+ public void resetWriterIndex()
+ {
+ buffer.resetWriterIndex();
+ }
+
+ public void setByte(final int index, final byte value)
+ {
+ buffer.setByte(index, value);
+ }
+
+ public void setBytes(final int index, final byte[] src, final int srcIndex, final int length)
+ {
+ buffer.setBytes(index, src, srcIndex, length);
+ }
+
+ public void setBytes(final int index, final byte[] src)
+ {
+ buffer.setBytes(index, src);
+ }
+
+ public void setBytes(final int index, final ByteBuffer src)
+ {
+ buffer.setBytes(index, src);
+ }
+
+ public void setBytes(final int index, final HornetQBuffer src, final int srcIndex, final int length)
+ {
+ buffer.setBytes(index, src.channelBuffer(), srcIndex, length);
+ }
+
+ public void setBytes(final int index, final HornetQBuffer src, final int length)
+ {
+ buffer.setBytes(index, src.channelBuffer(), length);
+ }
+
+ public void setBytes(final int index, final HornetQBuffer src)
+ {
+ buffer.setBytes(index, src.channelBuffer());
+ }
+
+ public void setChar(final int index, final char value)
+ {
+ buffer.setShort(index, (short)value);
+ }
+
+ public void setDouble(final int index, final double value)
+ {
+ buffer.setLong(index, Double.doubleToLongBits(value));
+ }
+
+ public void setFloat(final int index, final float value)
+ {
+ buffer.setInt(index, Float.floatToIntBits(value));
+ }
+
+ public void setIndex(final int readerIndex, final int writerIndex)
+ {
+ buffer.setIndex(readerIndex, writerIndex);
+ }
+
+ public void setInt(final int index, final int value)
+ {
+ buffer.setInt(index, value);
+ }
+
+ public void setLong(final int index, final long value)
+ {
+ buffer.setLong(index, value);
+ }
+
+ public void setShort(final int index, final short value)
+ {
+ buffer.setShort(index, value);
+ }
+
+ public void skipBytes(final int length)
+ {
+ buffer.skipBytes(length);
+ }
+
+ public HornetQBuffer slice()
+ {
+ return new ChannelBufferWrapper(buffer.slice());
+ }
+
+ public HornetQBuffer slice(final int index, final int length)
+ {
+ return new ChannelBufferWrapper(buffer.slice(index, length));
+ }
+
+ public ByteBuffer toByteBuffer()
+ {
+ return buffer.toByteBuffer();
+ }
+
+ public ByteBuffer toByteBuffer(final int index, final int length)
+ {
+ return buffer.toByteBuffer(index, length);
+ }
+
+ public boolean writable()
+ {
+ return buffer.writable();
+ }
+
+ public int writableBytes()
+ {
+ return buffer.writableBytes();
+ }
+
+ public void writeByte(final byte value)
+ {
+ buffer.writeByte(value);
+ }
+
+ public void writeBytes(final byte[] src, final int srcIndex, final int length)
+ {
+ buffer.writeBytes(src, srcIndex, length);
+ }
+
+ public void writeBytes(final byte[] src)
+ {
+ buffer.writeBytes(src);
+ }
+
+ public void writeBytes(final ByteBuffer src)
+ {
+ buffer.writeBytes(src);
+ }
+
+ public void writeBytes(final HornetQBuffer src, final int srcIndex, final int length)
+ {
+ buffer.writeBytes(src.channelBuffer(), srcIndex, length);
+ }
+
+ public void writeBytes(final HornetQBuffer src, final int length)
+ {
+ buffer.writeBytes(src.channelBuffer(), length);
+ }
+
+ public void writeChar(final char chr)
+ {
+ buffer.writeShort((short)chr);
+ }
+
+ public void writeDouble(final double value)
+ {
+ buffer.writeLong(Double.doubleToLongBits(value));
+ }
+
+ public void writeFloat(final float value)
+ {
+ buffer.writeInt(Float.floatToIntBits(value));
+ }
+
+ public void writeInt(final int value)
+ {
+ buffer.writeInt(value);
+ }
+
+ public void writeLong(final long value)
+ {
+ buffer.writeLong(value);
+ }
+
+ public int writerIndex()
+ {
+ return buffer.writerIndex();
+ }
+
+ public void writerIndex(final int writerIndex)
+ {
+ buffer.writerIndex(writerIndex);
+ }
+
+ public void writeShort(final short value)
+ {
+ buffer.writeShort(value);
+ }
+
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/Logger.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/Logger.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/Logger.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/Logger.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.logging;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.hornetq.core.logging.impl.JULLogDelegateFactory;
+import org.hornetq.spi.core.logging.LogDelegate;
+import org.hornetq.spi.core.logging.LogDelegateFactory;
+
+/**
+ *
+ * A Logger
+ *
+ * This class allows us to isolate all our logging dependencies in one place
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class Logger
+{
+ public static final String LOGGER_DELEGATE_FACTORY_CLASS_NAME = "org.hornetq.logger-delegate-factory-class-name";
+
+ private static volatile LogDelegateFactory delegateFactory;
+
+ private static final ConcurrentMap<Class<?>, Logger> loggers = new ConcurrentHashMap<Class<?>, Logger>();
+
+ static
+ {
+ Logger.initialise();
+ }
+
+ public static synchronized void setDelegateFactory(final LogDelegateFactory delegateFactory)
+ {
+ Logger.clear();
+
+ Logger.delegateFactory = delegateFactory;
+ }
+
+ private static void clear()
+ {
+ Logger.loggers.clear();
+ }
+
+ public static synchronized void reset()
+ {
+ Logger.clear();
+
+ Logger.initialise();
+ }
+
+ public static synchronized void initialise()
+ {
+ LogDelegateFactory delegateFactory;
+
+ // If a system property is specified then this overrides any delegate factory which is set
+ // programmatically - this is primarily of use so we can configure the logger delegate on the client side.
+ // call to System.getProperty is wrapped in a try block as it will fail if the client runs in a secured
+ // environment
+ String className = JULLogDelegateFactory.class.getName();
+ try
+ {
+ className = System.getProperty(Logger.LOGGER_DELEGATE_FACTORY_CLASS_NAME);
+ }
+ catch (Exception e)
+ {
+ }
+
+ if (className != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Class<?> clz = loader.loadClass(className);
+ delegateFactory = (LogDelegateFactory)clz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("Error instantiating transformer class \"" + className + "\"", e);
+ }
+ }
+ else
+ {
+ delegateFactory = new JULLogDelegateFactory();
+ }
+
+ Logger.delegateFactory = delegateFactory;
+
+ Logger.loggers.clear();
+ }
+
+ public static Logger getLogger(final Class<?> clazz)
+ {
+ Logger logger = Logger.loggers.get(clazz);
+
+ if (logger == null)
+ {
+ LogDelegate delegate = Logger.delegateFactory.createDelegate(clazz);
+
+ logger = new Logger(delegate);
+
+ Logger oldLogger = Logger.loggers.putIfAbsent(clazz, logger);
+
+ if (oldLogger != null)
+ {
+ logger = oldLogger;
+ }
+ }
+
+ return logger;
+ }
+
+ private final LogDelegate delegate;
+
+ Logger(final LogDelegate delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public LogDelegate getDelegate()
+ {
+ return delegate;
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return delegate.isInfoEnabled();
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return delegate.isDebugEnabled();
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return delegate.isTraceEnabled();
+ }
+
+ public void fatal(final Object message)
+ {
+ delegate.fatal(message);
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ delegate.fatal(message, t);
+ }
+
+ public void error(final Object message)
+ {
+ delegate.error(message);
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ delegate.error(message, t);
+ }
+
+ public void warn(final Object message)
+ {
+ delegate.warn(message);
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ delegate.warn(message, t);
+ }
+
+ public void info(final Object message)
+ {
+ delegate.info(message);
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ delegate.info(message, t);
+ }
+
+ public void debug(final Object message)
+ {
+ delegate.debug(message);
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ delegate.debug(message, t);
+ }
+
+ public void trace(final Object message)
+ {
+ delegate.trace(message);
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ delegate.trace(message, t);
+ }
+
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.logging.impl;
+
+import java.util.logging.Level;
+
+import org.hornetq.spi.core.logging.LogDelegate;
+
+/**
+ *
+ * A {@link LogDelegate} which delegates to java.util.logging
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ */
+public class JULLogDelegate implements LogDelegate
+{
+ private final java.util.logging.Logger logger;
+
+ JULLogDelegate(final Class<?> clazz)
+ {
+ logger = java.util.logging.Logger.getLogger(clazz.getName());
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return logger.isLoggable(Level.INFO);
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return logger.isLoggable(Level.FINE);
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return logger.isLoggable(Level.FINEST);
+ }
+
+ public void fatal(final Object message)
+ {
+ logger.log(Level.SEVERE, message == null ? "NULL" : message.toString());
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ logger.log(Level.SEVERE, message == null ? "NULL" : message.toString(), t);
+ }
+
+ public void error(final Object message)
+ {
+ logger.log(Level.SEVERE, message == null ? "NULL" : message.toString());
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ logger.log(Level.SEVERE, message == null ? "NULL" : message.toString(), t);
+ }
+
+ public void warn(final Object message)
+ {
+ logger.log(Level.WARNING, message == null ? "NULL" : message.toString());
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ logger.log(Level.WARNING, message == null ? "NULL" : message.toString(), t);
+ }
+
+ public void info(final Object message)
+ {
+ logger.log(Level.INFO, message == null ? "NULL" : message.toString());
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ logger.log(Level.INFO, message == null ? "NULL" : message.toString(), t);
+ }
+
+ public void debug(final Object message)
+ {
+ logger.log(Level.FINE, message == null ? "NULL" : message.toString());
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ logger.log(Level.FINE, message == null ? "NULL" : message.toString(), t);
+ }
+
+ public void trace(final Object message)
+ {
+ logger.log(Level.FINEST, message == null ? "NULL" : message.toString());
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ logger.log(Level.FINEST, message == null ? "NULL" : message.toString(), t);
+ }
+
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.logging.impl;
+
+import org.hornetq.spi.core.logging.LogDelegate;
+import org.hornetq.spi.core.logging.LogDelegateFactory;
+
+/**
+ * A {@link LogDelegateFactory} which creates {@link JULLogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public class JULLogDelegateFactory implements LogDelegateFactory
+{
+ public LogDelegate createDelegate(final Class<?> clazz)
+ {
+ return new JULLogDelegate(clazz);
+ }
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.hornetq.integration.logging;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.logging.LogRecord;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+public class HornetQLoggerFormatter extends java.util.logging.Formatter
+{
+ private static String LINE_SEPARATOR = System.getProperty("line.separator");
+
+ @Override
+ public String format(final LogRecord record)
+ {
+ Date date = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss,SSS");
+ StringBuffer sb = new StringBuffer();
+ // Minimize memory allocations here.
+ date.setTime(record.getMillis());
+ sb.append("[").append(Thread.currentThread().getName()).append("] ");
+ sb.append(dateFormat.format(date)).append(" ");
+ sb.append(record.getLevel()).append(" [");
+ sb.append(record.getLoggerName()).append("]").append(" ");
+ sb.append(record.getMessage());
+
+ sb.append(HornetQLoggerFormatter.LINE_SEPARATOR);
+ if (record.getThrown() != null)
+ {
+ try
+ {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ record.getThrown().printStackTrace(pw);
+ pw.close();
+ sb.append(sw.toString());
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ return sb.toString();
+ }
+
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.integration.logging;
+
+import org.hornetq.spi.core.logging.LogDelegate;
+
+/**
+ *
+ * A {@link LogDelegate} which delegates to Apache Log4j
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ */
+public class Log4jLogDelegate implements LogDelegate
+{
+ private final org.apache.log4j.Logger logger;
+
+ Log4jLogDelegate(final Class<?> clazz)
+ {
+ logger = org.apache.log4j.Logger.getLogger(clazz);
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return logger.isInfoEnabled();
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return logger.isDebugEnabled();
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return logger.isTraceEnabled();
+ }
+
+ public void fatal(final Object message)
+ {
+ logger.fatal(message);
+ }
+
+ public void fatal(final Object message, final Throwable t)
+ {
+ logger.fatal(message, t);
+ }
+
+ public void error(final Object message)
+ {
+ logger.error(message);
+ }
+
+ public void error(final Object message, final Throwable t)
+ {
+ logger.error(message, t);
+ }
+
+ public void warn(final Object message)
+ {
+ logger.warn(message);
+ }
+
+ public void warn(final Object message, final Throwable t)
+ {
+ logger.warn(message, t);
+ }
+
+ public void info(final Object message)
+ {
+ logger.info(message);
+ }
+
+ public void info(final Object message, final Throwable t)
+ {
+ logger.info(message, t);
+ }
+
+ public void debug(final Object message)
+ {
+ logger.debug(message);
+ }
+
+ public void debug(final Object message, final Throwable t)
+ {
+ logger.debug(message, t);
+ }
+
+ public void trace(final Object message)
+ {
+ logger.trace(message);
+ }
+
+ public void trace(final Object message, final Throwable t)
+ {
+ logger.trace(message, t);
+ }
+
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.integration.logging;
+
+import org.hornetq.spi.core.logging.LogDelegate;
+import org.hornetq.spi.core.logging.LogDelegateFactory;
+
+/**
+ * A {@link LogDelegateFactory} which creates {@link Log4jLogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public class Log4jLogDelegateFactory implements LogDelegateFactory
+{
+ /* (non-Javadoc)
+ * @see org.hornetq.core.logging.LogDelegateFactory#getLogDelegate(java.lang.Class)
+ */
+ public LogDelegate createDelegate(final Class<?> clazz)
+ {
+ return new Log4jLogDelegate(clazz);
+ }
+
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.spi.core.logging;
+
+/**
+ * I represent operations that are delegated to underlying logging frameworks.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public interface LogDelegate
+{
+ boolean isInfoEnabled();
+
+ boolean isDebugEnabled();
+
+ boolean isTraceEnabled();
+
+ void fatal(Object message);
+
+ void fatal(Object message, Throwable t);
+
+ void error(Object message);
+
+ void error(Object message, Throwable t);
+
+ void warn(Object message);
+
+ void warn(Object message, Throwable t);
+
+ void info(Object message);
+
+ void info(Object message, Throwable t);
+
+ void debug(Object message);
+
+ void debug(Object message, Throwable t);
+
+ void trace(Object message);
+
+ void trace(Object message, Throwable t);
+}
\ No newline at end of file
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.spi.core.logging;
+
+/**
+ * I am responsible for creating {@link LogDelegate} instances.
+ *
+ * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
+ *
+ *
+ */
+public interface LogDelegateFactory
+{
+ LogDelegate createDelegate(Class<?> clazz);
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/package-info.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/package-info.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/package-info.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/spi/core/logging/package-info.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+/**
+ * Logging SPI.
+ * <br>
+ * This package defines the Service Provide Interface to
+ * support different logging implementation.
+ */
+package org.hornetq.spi.core.logging;
+
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/DataConstants.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/DataConstants.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/DataConstants.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/DataConstants.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.utils;
+
+/**
+ *
+ * A DataConstants
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class DataConstants
+{
+ public static final int SIZE_INT = 4;
+
+ public static final int SIZE_BOOLEAN = 1;
+
+ public static final int SIZE_LONG = 8;
+
+ public static final int SIZE_BYTE = 1;
+
+ public static final int SIZE_SHORT = 2;
+
+ public static final int SIZE_DOUBLE = 8;
+
+ public static final int SIZE_FLOAT = 4;
+
+ public static final int SIZE_CHAR = 2;
+
+ public static final byte TRUE = 1;
+
+ public static final byte FALSE = 0;
+
+ public static final byte NULL = 0;
+
+ public static final byte NOT_NULL = 1;
+
+ public static final byte BOOLEAN = 2;
+
+ public static final byte BYTE = 3;
+
+ public static final byte BYTES = 4;
+
+ public static final byte SHORT = 5;
+
+ public static final byte INT = 6;
+
+ public static final byte LONG = 7;
+
+ public static final byte FLOAT = 8;
+
+ public static final byte DOUBLE = 9;
+
+ public static final byte STRING = 10;
+
+ public static final byte CHAR = 11;
+}
Copied: branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/UTF8Util.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-commons/src/main/java/org/hornetq/utils/UTF8Util.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.utils;
+
+import java.lang.ref.SoftReference;
+
+import org.hornetq.api.core.HornetQBuffer;
+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 at jboss.org">Clebert Suconic</a>
+ *
+ * Created Feb 20, 2009 1:37:18 PM
+ *
+ *
+ */
+public class UTF8Util
+{
+ static boolean optimizeStrings = true;
+
+ private static final Logger log = Logger.getLogger(UTF8Util.class);
+
+ private static final boolean isTrace = UTF8Util.log.isTraceEnabled();
+
+ private static ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer = new ThreadLocal<SoftReference<StringUtilBuffer>>();
+
+ public static void saveUTF(final HornetQBuffer out, final String str)
+ {
+ StringUtilBuffer buffer = UTF8Util.getThreadLocalBuffer();
+
+ if (str.length() > 0xffff)
+ {
+ throw new IllegalArgumentException("the specified string is too long (" + str.length() + ")");
+ }
+
+ final int len = UTF8Util.calculateUTFSize(str, buffer);
+
+ if (len > 0xffff)
+ {
+ throw new IllegalArgumentException("the encoded string is too long (" + len + ")");
+ }
+
+ out.writeShort((short)len);
+
+ if (len > buffer.byteBuffer.length)
+ {
+ buffer.resizeByteBuffer(len);
+ }
+
+ if (len == (long)str.length())
+ {
+ for (int byteLocation = 0; byteLocation < len; byteLocation++)
+ {
+ buffer.byteBuffer[byteLocation] = (byte)buffer.charBuffer[byteLocation];
+ }
+ out.writeBytes(buffer.byteBuffer, 0, len);
+ }
+ else
+ {
+ if (UTF8Util.isTrace)
+ {
+ // This message is too verbose for debug, that's why we are using trace here
+ UTF8Util.log.trace("Saving string with utfSize=" + len + " stringSize=" + str.length());
+ }
+
+ int stringLength = str.length();
+
+ int charCount = 0;
+
+ for (int i = 0; i < stringLength; i++)
+ {
+ char charAtPos = buffer.charBuffer[i];
+ if (charAtPos >= 1 && charAtPos < 0x7f)
+ {
+ buffer.byteBuffer[charCount++] = (byte)charAtPos;
+ }
+ else if (charAtPos >= 0x800)
+ {
+ buffer.byteBuffer[charCount++] = (byte)(0xE0 | charAtPos >> 12 & 0x0F);
+ buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 6 & 0x3F);
+ buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
+ }
+ else
+ {
+ buffer.byteBuffer[charCount++] = (byte)(0xC0 | charAtPos >> 6 & 0x1F);
+ buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
+
+ }
+ }
+ out.writeBytes(buffer.byteBuffer, 0, len);
+ }
+ }
+
+ public static String readUTF(final HornetQBuffer input)
+ {
+ StringUtilBuffer buffer = UTF8Util.getThreadLocalBuffer();
+
+ final int size = input.readUnsignedShort();
+
+ if (size > buffer.byteBuffer.length)
+ {
+ buffer.resizeByteBuffer(size);
+ }
+
+ if (size > buffer.charBuffer.length)
+ {
+ buffer.resizeCharBuffer(size);
+ }
+
+ if (UTF8Util.isTrace)
+ {
+ // This message is too verbose for debug, that's why we are using trace here
+ UTF8Util.log.trace("Reading string with utfSize=" + size);
+ }
+
+ int count = 0;
+ int byte1, byte2, byte3;
+ int charCount = 0;
+
+ input.readBytes(buffer.byteBuffer, 0, size);
+
+ while (count < size)
+ {
+ byte1 = buffer.byteBuffer[count++];
+
+ if (byte1 > 0 && byte1 <= 0x7F)
+ {
+ buffer.charBuffer[charCount++] = (char)byte1;
+ }
+ else
+ {
+ int c = byte1 & 0xff;
+ switch (c >> 4)
+ {
+ case 0xc:
+ case 0xd:
+ byte2 = buffer.byteBuffer[count++];
+ buffer.charBuffer[charCount++] = (char)((c & 0x1F) << 6 | byte2 & 0x3F);
+ break;
+ case 0xe:
+ byte2 = buffer.byteBuffer[count++];
+ byte3 = buffer.byteBuffer[count++];
+ buffer.charBuffer[charCount++] = (char)((c & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F) << 0);
+ break;
+ }
+ }
+ }
+
+ return new String(buffer.charBuffer, 0, charCount);
+
+ }
+
+ private static StringUtilBuffer getThreadLocalBuffer()
+ {
+ SoftReference<StringUtilBuffer> softReference = UTF8Util.currenBuffer.get();
+ StringUtilBuffer value;
+ if (softReference == null)
+ {
+ value = new StringUtilBuffer();
+ softReference = new SoftReference<StringUtilBuffer>(value);
+ UTF8Util.currenBuffer.set(softReference);
+ }
+ else
+ {
+ value = softReference.get();
+ }
+
+ if (value == null)
+ {
+ value = new StringUtilBuffer();
+ softReference = new SoftReference<StringUtilBuffer>(value);
+ UTF8Util.currenBuffer.set(softReference);
+ }
+
+ return value;
+ }
+
+ public static void clearBuffer()
+ {
+ SoftReference<StringUtilBuffer> ref = UTF8Util.currenBuffer.get();
+ if (ref.get() != null)
+ {
+ ref.clear();
+ }
+ }
+
+ public static int calculateUTFSize(final String str, final StringUtilBuffer stringBuffer)
+ {
+ int calculatedLen = 0;
+
+ int stringLength = str.length();
+
+ if (stringLength > stringBuffer.charBuffer.length)
+ {
+ stringBuffer.resizeCharBuffer(stringLength);
+ }
+
+ str.getChars(0, stringLength, stringBuffer.charBuffer, 0);
+
+ for (int i = 0; i < stringLength; i++)
+ {
+ char c = stringBuffer.charBuffer[i];
+
+ if (c >= 1 && c < 0x7f)
+ {
+ calculatedLen++;
+ }
+ else if (c >= 0x800)
+ {
+ calculatedLen += 3;
+ }
+ else
+ {
+ calculatedLen += 2;
+ }
+ }
+ return calculatedLen;
+ }
+
+ private static class StringUtilBuffer
+ {
+
+ public char charBuffer[];
+
+ public byte byteBuffer[];
+
+ public void resizeCharBuffer(final int newSize)
+ {
+ if (newSize > charBuffer.length)
+ {
+ charBuffer = new char[newSize];
+ }
+ }
+
+ public void resizeByteBuffer(final int newSize)
+ {
+ if (newSize > byteBuffer.length)
+ {
+ byteBuffer = new byte[newSize];
+ }
+ }
+
+ public StringUtilBuffer()
+ {
+ this(1024, 1024);
+ }
+
+ public StringUtilBuffer(final int sizeChar, final int sizeByte)
+ {
+ charBuffer = new char[sizeChar];
+ byteBuffer = new byte[sizeByte];
+ }
+
+ }
+
+}
Modified: branches/HORNETQ-698_SplitJournal/hornetq-core/pom.xml
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-core/pom.xml 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-core/pom.xml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -22,6 +22,11 @@
<artifactId>hornetq-journal</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-commons</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<profiles>
Modified: branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/deployers/impl/XmlDeployer.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -271,12 +271,12 @@
public abstract void deploy(final Node node) throws Exception;
/**
- * Validate the DOM
+ * Validate the DOM
*/
public abstract void validate(final Node rootNode) throws Exception;
/**
- * undeploys an element
+ * Undeploys an element.
* @param node the element to undeploy
* @throws Exception .
*/
Copied: branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/message/BodyEncoder.java (from rev 10726, branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/message/BodyEncoder.java)
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/message/BodyEncoder.java (rev 0)
+++ branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/message/BodyEncoder.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.message;
+
+import java.nio.ByteBuffer;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.api.core.HornetQException;
+
+/**
+ * Class used to encode message body into buffers.
+ * <br>
+ * Used to send large streams over the wire
+ *
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ */
+public interface BodyEncoder
+{
+ /**
+ * This method must not be called directly by HornetQ clients.
+ */
+ void open() throws HornetQException;
+
+ /**
+ * This method must not be called directly by HornetQ clients.
+ */
+ void close() throws HornetQException;
+
+ /**
+ * This method must not be called directly by HornetQ clients.
+ */
+ int encode(ByteBuffer bufferRead) throws HornetQException;
+
+ /**
+ * This method must not be called directly by HornetQ clients.
+ */
+ int encode(HornetQBuffer bufferOut, int size) throws HornetQException;
+
+ /**
+ * This method must not be called directly by HornetQ clients.
+ */
+ long getLargeBodySize();
+}
Modified: branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -518,7 +518,7 @@
getContext(syncNonTransactional));
}
- public void storeCursorAcknowledge(long queueID, PagePosition position) throws Exception
+ public void storeCursorAcknowledge(final long queueID, final PagePosition position) throws Exception
{
long ackID = idGenerator.generateID();
position.setRecordID(ackID);
@@ -639,7 +639,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#storeCursorAcknowledgeTransactional(long, long, org.hornetq.core.paging.cursor.PagePosition)
*/
- public void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position) throws Exception
+ public void storeCursorAcknowledgeTransactional(final long txID, final long queueID, final PagePosition position) throws Exception
{
long ackID = idGenerator.generateID();
position.setRecordID(ackID);
@@ -652,7 +652,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#deleteCursorAcknowledgeTransactional(long, long)
*/
- public void deleteCursorAcknowledgeTransactional(long txID, long ackID) throws Exception
+ public void deleteCursorAcknowledgeTransactional(final long txID, final long ackID) throws Exception
{
messageJournal.appendDeleteRecordTransactional(txID, ackID);
}
@@ -767,7 +767,7 @@
}
- public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception
+ public void storeAddressSetting(final PersistedAddressSetting addressSetting) throws Exception
{
deleteAddressSetting(addressSetting.getAddressMatch());
long id = idGenerator.generateID();
@@ -796,7 +796,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#storeSecurityRoles(org.hornetq.core.persistconfig.PersistedRoles)
*/
- public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception
+ public void storeSecurityRoles(final PersistedRoles persistedRoles) throws Exception
{
deleteSecurityRoles(persistedRoles.getAddressMatch());
@@ -806,7 +806,7 @@
mapPersistedRoles.put(persistedRoles.getAddressMatch(), persistedRoles);
}
- public void deleteAddressSetting(SimpleString addressMatch) throws Exception
+ public void deleteAddressSetting(final SimpleString addressMatch) throws Exception
{
PersistedAddressSetting oldSetting = mapPersistedAddressSettings.remove(addressMatch);
if (oldSetting != null)
@@ -816,7 +816,7 @@
}
- public void deleteSecurityRoles(SimpleString addressMatch) throws Exception
+ public void deleteSecurityRoles(final SimpleString addressMatch) throws Exception
{
PersistedRoles oldRoles = mapPersistedRoles.remove(addressMatch);
if (oldRoles != null)
@@ -829,7 +829,7 @@
final PagingManager pagingManager,
final ResourceManager resourceManager,
final Map<Long, Queue> queues,
- Map<Long, QueueBindingInfo> queueInfos,
+ final Map<Long, QueueBindingInfo> queueInfos,
final Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap) throws Exception
{
List<RecordInfo> records = new ArrayList<RecordInfo>();
@@ -1309,7 +1309,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#storePageCounterAdd(long, long, int)
*/
- public long storePageCounterInc(long txID, long queueID, int value) throws Exception
+ public long storePageCounterInc(final long txID, final long queueID, final int value) throws Exception
{
long recordID = idGenerator.generateID();
messageJournal.appendAddRecordTransactional(txID,
@@ -1322,7 +1322,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#storePageCounterAdd(long, long, int)
*/
- public long storePageCounterInc(long queueID, int value) throws Exception
+ public long storePageCounterInc(final long queueID, final int value) throws Exception
{
long recordID = idGenerator.generateID();
messageJournal.appendAddRecord(recordID,
@@ -1336,7 +1336,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#storePageCounter(long, long, long)
*/
- public long storePageCounter(long txID, long queueID, long value) throws Exception
+ public long storePageCounter(final long txID, final long queueID, final long value) throws Exception
{
long recordID = idGenerator.generateID();
messageJournal.appendAddRecordTransactional(txID,
@@ -1349,7 +1349,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#deleteIncrementRecord(long, long)
*/
- public void deleteIncrementRecord(long txID, long recordID) throws Exception
+ public void deleteIncrementRecord(final long txID, final long recordID) throws Exception
{
messageJournal.appendDeleteRecordTransactional(txID, recordID);
}
@@ -1357,7 +1357,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.persistence.StorageManager#deletePageCounter(long, long)
*/
- public void deletePageCounter(long txID, long recordID) throws Exception
+ public void deletePageCounter(final long txID, final long recordID) throws Exception
{
messageJournal.appendDeleteRecordTransactional(txID, recordID);
}
@@ -2425,19 +2425,19 @@
public PageUpdateTXEncoding(final long pageTX, final int records)
{
this.pageTX = pageTX;
- this.recods = records;
+ recods = records;
}
- public void decode(HornetQBuffer buffer)
+ public void decode(final HornetQBuffer buffer)
{
- this.pageTX = buffer.readLong();
- this.recods = buffer.readInt();
+ pageTX = buffer.readLong();
+ recods = buffer.readInt();
}
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
*/
- public void encode(HornetQBuffer buffer)
+ public void encode(final HornetQBuffer buffer)
{
buffer.writeLong(pageTX);
buffer.writeInt(recods);
@@ -2621,7 +2621,7 @@
}
- PageCountRecord(long queueID, long value)
+ PageCountRecord(final long queueID, final long value)
{
this.queueID = queueID;
this.value = value;
@@ -2642,7 +2642,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
*/
- public void encode(HornetQBuffer buffer)
+ public void encode(final HornetQBuffer buffer)
{
buffer.writeLong(queueID);
buffer.writeLong(value);
@@ -2651,7 +2651,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
*/
- public void decode(HornetQBuffer buffer)
+ public void decode(final HornetQBuffer buffer)
{
queueID = buffer.readLong();
value = buffer.readLong();
@@ -2676,7 +2676,7 @@
}
- PageCountRecordInc(long queueID, int value)
+ PageCountRecordInc(final long queueID, final int value)
{
this.queueID = queueID;
this.value = value;
@@ -2697,7 +2697,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
*/
- public void encode(HornetQBuffer buffer)
+ public void encode(final HornetQBuffer buffer)
{
buffer.writeLong(queueID);
buffer.writeInt(value);
@@ -2706,7 +2706,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
*/
- public void decode(HornetQBuffer buffer)
+ public void decode(final HornetQBuffer buffer)
{
queueID = buffer.readLong();
value = buffer.readInt();
@@ -2738,7 +2738,7 @@
public CursorAckRecordEncoding()
{
- this.position = new PagePositionImpl();
+ position = new PagePositionImpl();
}
/* (non-Javadoc)
@@ -2765,7 +2765,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
*/
- public void encode(HornetQBuffer buffer)
+ public void encode(final HornetQBuffer buffer)
{
buffer.writeLong(queueID);
buffer.writeLong(position.getPageNr());
@@ -2775,12 +2775,12 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
*/
- public void decode(HornetQBuffer buffer)
+ public void decode(final HornetQBuffer buffer)
{
queueID = buffer.readLong();
long pageNR = buffer.readLong();
int messageNR = buffer.readInt();
- this.position = new PagePositionImpl(pageNR, messageNR);
+ position = new PagePositionImpl(pageNR, messageNR);
}
}
@@ -2821,7 +2821,7 @@
}
- private static String describeRecord(RecordInfo info)
+ private static String describeRecord(final RecordInfo info)
{
return "recordID=" + info.id +
";userRecordType=" +
@@ -2832,14 +2832,14 @@
newObjectEncoding(info);
}
- private static String describeRecord(RecordInfo info, Object o)
+ private static String describeRecord(final RecordInfo info, final Object o)
{
return "recordID=" + info.id + ";userRecordType=" + info.userRecordType + ";isUpdate=" + info.isUpdate + ";" + o;
}
// Encoding functions for binding Journal
- private static Object newObjectEncoding(RecordInfo info)
+ private static Object newObjectEncoding(final RecordInfo info)
{
HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(info.data);
long id = info.id;
@@ -2985,7 +2985,7 @@
{
RefEncoding refEncoding;
- public ReferenceDescribe(RefEncoding refEncoding)
+ public ReferenceDescribe(final RefEncoding refEncoding)
{
this.refEncoding = refEncoding;
}
@@ -3001,7 +3001,7 @@
{
RefEncoding refEncoding;
- public AckDescribe(RefEncoding refEncoding)
+ public AckDescribe(final RefEncoding refEncoding)
{
this.refEncoding = refEncoding;
}
@@ -3015,7 +3015,7 @@
private static class MessageDescribe
{
- public MessageDescribe(Message msg)
+ public MessageDescribe(final Message msg)
{
this.msg = msg;
}
@@ -3061,7 +3061,7 @@
* @param buffer
* @return
*/
- protected static PersistedRoles newSecurityRecord(long id, HornetQBuffer buffer)
+ protected static PersistedRoles newSecurityRecord(final long id, final HornetQBuffer buffer)
{
PersistedRoles roles = new PersistedRoles();
roles.decode(buffer);
@@ -3074,7 +3074,7 @@
* @param buffer
* @return
*/
- protected static PersistedAddressSetting newAddressEncoding(long id, HornetQBuffer buffer)
+ protected static PersistedAddressSetting newAddressEncoding(final long id, final HornetQBuffer buffer)
{
PersistedAddressSetting setting = new PersistedAddressSetting();
setting.decode(buffer);
@@ -3087,7 +3087,7 @@
* @param buffer
* @return
*/
- protected static GroupingEncoding newGroupEncoding(long id, HornetQBuffer buffer)
+ protected static GroupingEncoding newGroupEncoding(final long id, final HornetQBuffer buffer)
{
GroupingEncoding encoding = new GroupingEncoding();
encoding.decode(buffer);
@@ -3100,7 +3100,7 @@
* @param buffer
* @return
*/
- protected static PersistentQueueBindingEncoding newBindingEncoding(long id, HornetQBuffer buffer)
+ protected static PersistentQueueBindingEncoding newBindingEncoding(final long id, final HornetQBuffer buffer)
{
PersistentQueueBindingEncoding bindingEncoding = new PersistentQueueBindingEncoding();
@@ -3120,7 +3120,7 @@
* @param journal
* @throws Exception
*/
- protected static void describeJournal(SequentialFileFactory fileFactory, JournalImpl journal) throws Exception
+ protected static void describeJournal(final SequentialFileFactory fileFactory, final JournalImpl journal) throws Exception
{
List<JournalFile> files = journal.orderFiles();
@@ -3206,7 +3206,7 @@
journal.load(records, preparedTransactions, new TransactionFailureCallback()
{
- public void failedTransaction(long transactionID, List<RecordInfo> records, List<RecordInfo> recordsToDelete)
+ public void failedTransaction(final long transactionID, final List<RecordInfo> records, final List<RecordInfo> recordsToDelete)
{
bufferFailingTransactions.append("Transaction " + transactionID + " failed with these records:\n");
for (RecordInfo info : records)
Modified: branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -28,9 +28,10 @@
import org.hornetq.core.persistence.OperationContext;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.replication.ReplicationManager;
+import org.hornetq.core.server.HornetQComponent;
/**
- * Used by the {@link JournalStorageManager} to replicate journal calls.
+ * Used by the {@link JournalStorageManager} to replicate journal calls.
*
* @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
*
@@ -193,7 +194,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.Journal#appendCommitRecord(long, boolean, org.hornetq.core.journal.IOCompletion, boolean)
*/
- public void appendCommitRecord(long txID, boolean sync, IOCompletion callback, boolean lineUpContext) throws Exception
+ public void appendCommitRecord(final long txID, final boolean sync, final IOCompletion callback, final boolean lineUpContext) throws Exception
{
if (ReplicatedJournal.trace)
{
@@ -201,10 +202,10 @@
}
replicationManager.appendCommitRecord(journalID, txID, lineUpContext);
localJournal.appendCommitRecord(txID, sync, callback, lineUpContext);
-
+
}
-
+
/**
* @param id
* @param sync
@@ -563,7 +564,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.journal.Journal#lineUpContex(org.hornetq.core.journal.IOCompletion)
*/
- public void lineUpContex(IOCompletion callback)
+ public void lineUpContex(final IOCompletion callback)
{
((OperationContext)callback).replicationLineUp();
localJournal.lineUpContex(callback);
Modified: branches/HORNETQ-698_SplitJournal/hornetq-journal/pom.xml
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/pom.xml 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/pom.xml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -17,6 +17,12 @@
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-commons</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<profiles>
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffer.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffer.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffer.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,1086 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.api.core;
-
-import java.nio.ByteBuffer;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-
-/**
- *
- * A HornetQBuffer wraps a Netty's ChannelBuffer and is used throughout HornetQ code base.
- *
- * Much of it derived from Netty ChannelBuffer by Trustin Lee
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * @see HornetQBuffers
- *
- */
-public interface HornetQBuffer
-{
- /**
- * Returns the underlying Netty's ChannelBuffer
- *
- * @return the underlying Netty's ChannelBuffer
- */
- ChannelBuffer channelBuffer();
-
- /**
- * Returns the number of bytes this buffer can contain.
- */
- int capacity();
-
- /**
- * Returns the {@code readerIndex} of this buffer.
- */
- int readerIndex();
-
- /**
- * Sets the {@code readerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code readerIndex} is
- * less than {@code 0} or
- * greater than {@code this.writerIndex}
- */
- void readerIndex(int readerIndex);
-
- /**
- * Returns the {@code writerIndex} of this buffer.
- */
- int writerIndex();
-
- /**
- * Sets the {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code writerIndex} is
- * less than {@code this.readerIndex} or
- * greater than {@code this.capacity}
- */
- void writerIndex(int writerIndex);
-
- /**
- * Sets the {@code readerIndex} and {@code writerIndex} of this buffer
- * in one shot. This method is useful when you have to worry about the
- * invocation order of {@link #readerIndex(int)} and {@link #writerIndex(int)}
- * methods. For example, the following code will fail:
- *
- * <pre>
- * // Create a buffer whose readerIndex, writerIndex and capacity are
- * // 0, 0 and 8 respectively.
- * ChannelBuffer buf = ChannelBuffers.buffer(8);
- *
- * // IndexOutOfBoundsException is thrown because the specified
- * // readerIndex (2) cannot be greater than the current writerIndex (0).
- * buf.readerIndex(2);
- * buf.writerIndex(4);
- * </pre>
- *
- * The following code will also fail:
- *
- * <pre>
- * // Create a buffer whose readerIndex, writerIndex and capacity are
- * // 0, 8 and 8 respectively.
- * ChannelBuffer buf = ChannelBuffers.wrappedBuffer(new byte[8]);
- *
- * // readerIndex becomes 8.
- * buf.readLong();
- *
- * // IndexOutOfBoundsException is thrown because the specified
- * // writerIndex (4) cannot be less than the current readerIndex (8).
- * buf.writerIndex(4);
- * buf.readerIndex(2);
- * </pre>
- *
- * By contrast, {@link #setIndex(int, int)} guarantees that it never
- * throws an {@link IndexOutOfBoundsException} as long as the specified
- * indexes meet basic constraints, regardless what the current index
- * values of the buffer are:
- *
- * <pre>
- * // No matter what the current state of the buffer is, the following
- * // call always succeeds as long as the capacity of the buffer is not
- * // less than 4.
- * buf.setIndex(2, 4);
- * </pre>
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code readerIndex} is less than 0,
- * if the specified {@code writerIndex} is less than the specified
- * {@code readerIndex} or if the specified {@code writerIndex} is
- * greater than {@code this.capacity}
- */
- void setIndex(int readerIndex, int writerIndex);
-
- /**
- * Returns the number of readable bytes which is equal to
- * {@code (this.writerIndex - this.readerIndex)}.
- */
- int readableBytes();
-
- /**
- * Returns the number of writable bytes which is equal to
- * {@code (this.capacity - this.writerIndex)}.
- */
- int writableBytes();
-
- /**
- * Returns {@code true}
- * if and only if {@code (this.writerIndex - this.readerIndex)} is greater
- * than {@code 0}.
- */
- boolean readable();
-
- /**
- * Returns {@code true}
- * if and only if {@code (this.capacity - this.writerIndex)} is greater
- * than {@code 0}.
- */
- boolean writable();
-
- /**
- * Sets the {@code readerIndex} and {@code writerIndex} of this buffer to
- * {@code 0}.
- * This method is identical to {@link #setIndex(int, int) setIndex(0, 0)}.
- * <p>
- * Please note that the behavior of this method is different
- * from that of NIO buffer, which sets the {@code limit} to
- * the {@code capacity} of the buffer.
- */
- void clear();
-
- /**
- * Marks the current {@code readerIndex} in this buffer. You can
- * reposition the current {@code readerIndex} to the marked
- * {@code readerIndex} by calling {@link #resetReaderIndex()}.
- * The initial value of the marked {@code readerIndex} is {@code 0}.
- */
- void markReaderIndex();
-
- /**
- * Repositions the current {@code readerIndex} to the marked
- * {@code readerIndex} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the current {@code writerIndex} is less than the marked
- * {@code readerIndex}
- */
- void resetReaderIndex();
-
- /**
- * Marks the current {@code writerIndex} in this buffer. You can
- * reposition the current {@code writerIndex} to the marked
- * {@code writerIndex} by calling {@link #resetWriterIndex()}.
- * The initial value of the marked {@code writerIndex} is {@code 0}.
- */
- void markWriterIndex();
-
- /**
- * Repositions the current {@code writerIndex} to the marked
- * {@code writerIndex} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the current {@code readerIndex} is greater than the marked
- * {@code writerIndex}
- */
- void resetWriterIndex();
-
- /**
- * Discards the bytes between the 0th index and {@code readerIndex}.
- * It moves the bytes between {@code readerIndex} and {@code writerIndex}
- * to the 0th index, and sets {@code readerIndex} and {@code writerIndex}
- * to {@code 0} and {@code oldWriterIndex - oldReaderIndex} respectively.
- * <p>
- * Please refer to the class documentation for more detailed explanation.
- */
- void discardReadBytes();
-
- /**
- * Gets a byte at the specified absolute {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 1} is greater than {@code this.capacity}
- */
- byte getByte(int index);
-
- /**
- * Gets an unsigned byte at the specified absolute {@code index} in this
- * buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 1} is greater than {@code this.capacity}
- */
- short getUnsignedByte(int index);
-
- /**
- * Gets a 16-bit short integer at the specified absolute {@code index} in
- * this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 2} is greater than {@code this.capacity}
- */
- short getShort(int index);
-
- /**
- * Gets an unsigned 16-bit short integer at the specified absolute
- * {@code index} in this buffer. This method does not modify
- * {@code readerIndex} or {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 2} is greater than {@code this.capacity}
- */
- int getUnsignedShort(int index);
-
- /**
- * Gets a 32-bit integer at the specified absolute {@code index} in
- * this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 4} is greater than {@code this.capacity}
- */
- int getInt(int index);
-
- /**
- * Gets an unsigned 32-bit integer at the specified absolute {@code index}
- * in this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 4} is greater than {@code this.capacity}
- */
- long getUnsignedInt(int index);
-
- /**
- * Gets a 64-bit long integer at the specified absolute {@code index} in
- * this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 8} is greater than {@code this.capacity}
- */
- long getLong(int index);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the specified absolute {@code index} until the destination becomes
- * non-writable. This method is basically same with
- * {@link #getBytes(int, HornetQBuffer, int, int)}, except that this
- * method increases the {@code writerIndex} of the destination by the
- * number of the transferred bytes while
- * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * the source buffer (i.e. {@code this}).
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * if {@code index + dst.writableBytes} is greater than
- * {@code this.capacity}
- */
- void getBytes(int index, HornetQBuffer dst);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the specified absolute {@code index}. This method is basically same
- * with {@link #getBytes(int, HornetQBuffer, int, int)}, except that this
- * method increases the {@code writerIndex} of the destination by the
- * number of the transferred bytes while
- * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * the source buffer (i.e. {@code this}).
- *
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0},
- * if {@code index + length} is greater than
- * {@code this.capacity}, or
- * if {@code length} is greater than {@code dst.writableBytes}
- */
- void getBytes(int index, HornetQBuffer dst, int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the specified absolute {@code index}.
- * This method does not modify {@code readerIndex} or {@code writerIndex}
- * of both the source (i.e. {@code this}) and the destination.
- *
- * @param dstIndex the first index of the destination
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0},
- * if the specified {@code dstIndex} is less than {@code 0},
- * if {@code index + length} is greater than
- * {@code this.capacity}, or
- * if {@code dstIndex + length} is greater than
- * {@code dst.capacity}
- */
- void getBytes(int index, HornetQBuffer dst, int dstIndex, int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the specified absolute {@code index}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * if {@code index + dst.length} is greater than
- * {@code this.capacity}
- */
- void getBytes(int index, byte[] dst);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the specified absolute {@code index}.
- * This method does not modify {@code readerIndex} or {@code writerIndex}
- * of this buffer.
- *
- * @param dstIndex the first index of the destination
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0},
- * if the specified {@code dstIndex} is less than {@code 0},
- * if {@code index + length} is greater than
- * {@code this.capacity}, or
- * if {@code dstIndex + length} is greater than
- * {@code dst.length}
- */
- void getBytes(int index, byte[] dst, int dstIndex, int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the specified absolute {@code index} until the destination's position
- * reaches its limit.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer while the destination's {@code position} will be increased.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * if {@code index + dst.remaining()} is greater than
- * {@code this.capacity}
- */
- void getBytes(int index, ByteBuffer dst);
-
- /**
- * Gets a char at the specified absolute {@code index} in
- * this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 2} is greater than {@code this.capacity}
- */
- char getChar(int index);
-
- /**
- * Gets a float at the specified absolute {@code index} in
- * this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 4} is greater than {@code this.capacity}
- */
- float getFloat(int index);
-
- /**
- * Gets a double at the specified absolute {@code index} in
- * this buffer. This method does not modify {@code readerIndex} or
- * {@code writerIndex} of this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 8} is greater than {@code this.capacity}
- */
- double getDouble(int index);
-
- /**
- * Sets the specified byte at the specified absolute {@code index} in this
- * buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 1} is greater than {@code this.capacity}
- */
- void setByte(int index, byte value);
-
- /**
- * Sets the specified 16-bit short integer at the specified absolute
- * {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 2} is greater than {@code this.capacity}
- */
- void setShort(int index, short value);
-
- /**
- * Sets the specified 32-bit integer at the specified absolute
- * {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 4} is greater than {@code this.capacity}
- */
- void setInt(int index, int value);
-
- /**
- * Sets the specified 64-bit long integer at the specified absolute
- * {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 8} is greater than {@code this.capacity}
- */
- void setLong(int index, long value);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the specified absolute {@code index} until the destination becomes
- * unreadable. This method is basically same with
- * {@link #setBytes(int, HornetQBuffer, int, int)}, except that this
- * method increases the {@code readerIndex} of the source buffer by
- * the number of the transferred bytes while
- * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * the source buffer (i.e. {@code this}).
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * if {@code index + src.readableBytes} is greater than
- * {@code this.capacity}
- */
- void setBytes(int index, HornetQBuffer src);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the specified absolute {@code index}. This method is basically same
- * with {@link #setBytes(int, HornetQBuffer, int, int)}, except that this
- * method increases the {@code readerIndex} of the source buffer by
- * the number of the transferred bytes while
- * {@link #getBytes(int, HornetQBuffer, int, int)} does not.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * the source buffer (i.e. {@code this}).
- *
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0},
- * if {@code index + length} is greater than
- * {@code this.capacity}, or
- * if {@code length} is greater than {@code src.readableBytes}
- */
- void setBytes(int index, HornetQBuffer src, int length);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the specified absolute {@code index}.
- * This method does not modify {@code readerIndex} or {@code writerIndex}
- * of both the source (i.e. {@code this}) and the destination.
- *
- * @param srcIndex the first index of the source
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0},
- * if the specified {@code srcIndex} is less than {@code 0},
- * if {@code index + length} is greater than
- * {@code this.capacity}, or
- * if {@code srcIndex + length} is greater than
- * {@code src.capacity}
- */
- void setBytes(int index, HornetQBuffer src, int srcIndex, int length);
-
- /**
- * Transfers the specified source array's data to this buffer starting at
- * the specified absolute {@code index}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * if {@code index + src.length} is greater than
- * {@code this.capacity}
- */
- void setBytes(int index, byte[] src);
-
- /**
- * Transfers the specified source array's data to this buffer starting at
- * the specified absolute {@code index}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0},
- * if the specified {@code srcIndex} is less than {@code 0},
- * if {@code index + length} is greater than
- * {@code this.capacity}, or
- * if {@code srcIndex + length} is greater than {@code src.length}
- */
- void setBytes(int index, byte[] src, int srcIndex, int length);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the specified absolute {@code index} until the source buffer's position
- * reaches its limit.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * if {@code index + src.remaining()} is greater than
- * {@code this.capacity}
- */
- void setBytes(int index, ByteBuffer src);
-
- /**
- * Sets the specified char at the specified absolute
- * {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 2} is greater than {@code this.capacity}
- */
- void setChar(int index, char value);
-
- /**
- * Sets the specified float at the specified absolute
- * {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 4} is greater than {@code this.capacity}
- */
- void setFloat(int index, float value);
-
- /**
- * Sets the specified double at the specified absolute
- * {@code index} in this buffer.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code index} is less than {@code 0} or
- * {@code index + 8} is greater than {@code this.capacity}
- */
- void setDouble(int index, double value);
-
- /**
- * Gets a byte at the current {@code readerIndex} and increases
- * the {@code readerIndex} by {@code 1} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 1}
- */
- byte readByte();
-
- /**
- * Gets an unsigned byte at the current {@code readerIndex} and increases
- * the {@code readerIndex} by {@code 1} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 1}
- */
- short readUnsignedByte();
-
- /**
- * Gets a 16-bit short integer at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 2} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 2}
- */
- short readShort();
-
- /**
- * Gets an unsigned 16-bit short integer at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 2} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 2}
- */
- int readUnsignedShort();
-
- /**
- * Gets a 32-bit integer at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 4} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 4}
- */
- int readInt();
-
- /**
- * Gets an unsigned 32-bit integer at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 4} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 4}
- */
- long readUnsignedInt();
-
- /**
- * Gets a 64-bit integer at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 8} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 8}
- */
- long readLong();
-
- /**
- * Gets a char at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 2} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 2}
- */
- char readChar();
-
- /**
- * Gets a float at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 4} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 4}
- */
- float readFloat();
-
- /**
- * Gets a double at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 8} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 8}
- */
- double readDouble();
-
- /**
- * Gets a boolean at the current {@code readerIndex}
- * and increases the {@code readerIndex} by {@code 1} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.readableBytes} is less than {@code 1}
- */
- boolean readBoolean();
-
- /**
- * Gets a SimpleString (potentially {@code null}) at the current {@code readerIndex}
- */
- SimpleString readNullableSimpleString();
-
- /**
- * Gets a String (potentially {@code null}) at the current {@code readerIndex}
- */
- String readNullableString();
-
- /**
- * Gets a non-null SimpleString at the current {@code readerIndex}
- */
- SimpleString readSimpleString();
-
- /**
- * Gets a non-null String at the current {@code readerIndex}
- */
- String readString();
-
- /**
- * Gets a UTF-8 String at the current {@code readerIndex}
- */
- String readUTF();
-
- /**
- * Transfers this buffer's data to a newly created buffer starting at
- * the current {@code readerIndex} and increases the {@code readerIndex}
- * by the number of the transferred bytes (= {@code length}).
- * The returned buffer's {@code readerIndex} and {@code writerIndex} are
- * {@code 0} and {@code length} respectively.
- *
- * @param length the number of bytes to transfer
- *
- * @return the newly created buffer which contains the transferred bytes
- *
- * @throws IndexOutOfBoundsException
- * if {@code length} is greater than {@code this.readableBytes}
- */
- HornetQBuffer readBytes(int length);
-
- /**
- * Returns a new slice of this buffer's sub-region starting at the current
- * {@code readerIndex} and increases the {@code readerIndex} by the size
- * of the new slice (= {@code length}).
- *
- * @param length the size of the new slice
- *
- * @return the newly created slice
- *
- * @throws IndexOutOfBoundsException
- * if {@code length} is greater than {@code this.readableBytes}
- */
- HornetQBuffer readSlice(int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the current {@code readerIndex} until the destination becomes
- * non-writable, and increases the {@code readerIndex} by the number of the
- * transferred bytes. This method is basically same with
- * {@link #readBytes(HornetQBuffer, int, int)}, except that this method
- * increases the {@code writerIndex} of the destination by the number of
- * the transferred bytes while {@link #readBytes(HornetQBuffer, int, int)}
- * does not.
- *
- * @throws IndexOutOfBoundsException
- * if {@code dst.writableBytes} is greater than
- * {@code this.readableBytes}
- */
- void readBytes(HornetQBuffer dst);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the current {@code readerIndex} and increases the {@code readerIndex}
- * by the number of the transferred bytes (= {@code length}). This method
- * is basically same with {@link #readBytes(HornetQBuffer, int, int)},
- * except that this method increases the {@code writerIndex} of the
- * destination by the number of the transferred bytes (= {@code length})
- * while {@link #readBytes(HornetQBuffer, int, int)} does not.
- *
- * @throws IndexOutOfBoundsException
- * if {@code length} is greater than {@code this.readableBytes} or
- * if {@code length} is greater than {@code dst.writableBytes}
- */
- void readBytes(HornetQBuffer dst, int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the current {@code readerIndex} and increases the {@code readerIndex}
- * by the number of the transferred bytes (= {@code length}).
- *
- * @param dstIndex the first index of the destination
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code dstIndex} is less than {@code 0},
- * if {@code length} is greater than {@code this.readableBytes}, or
- * if {@code dstIndex + length} is greater than
- * {@code dst.capacity}
- */
- void readBytes(HornetQBuffer dst, int dstIndex, int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the current {@code readerIndex} and increases the {@code readerIndex}
- * by the number of the transferred bytes (= {@code dst.length}).
- *
- * @throws IndexOutOfBoundsException
- * if {@code dst.length} is greater than {@code this.readableBytes}
- */
- void readBytes(byte[] dst);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the current {@code readerIndex} and increases the {@code readerIndex}
- * by the number of the transferred bytes (= {@code length}).
- *
- * @param dstIndex the first index of the destination
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code dstIndex} is less than {@code 0},
- * if {@code length} is greater than {@code this.readableBytes}, or
- * if {@code dstIndex + length} is greater than {@code dst.length}
- */
- void readBytes(byte[] dst, int dstIndex, int length);
-
- /**
- * Transfers this buffer's data to the specified destination starting at
- * the current {@code readerIndex} until the destination's position
- * reaches its limit, and increases the {@code readerIndex} by the
- * number of the transferred bytes.
- *
- * @throws IndexOutOfBoundsException
- * if {@code dst.remaining()} is greater than
- * {@code this.readableBytes}
- */
- void readBytes(ByteBuffer dst);
-
- /**
- * Increases the current {@code readerIndex} by the specified
- * {@code length} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code length} is greater than {@code this.readableBytes}
- */
- void skipBytes(int length);
-
- /**
- * Sets the specified byte at the current {@code writerIndex}
- * and increases the {@code writerIndex} by {@code 1} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 1}
- */
- void writeByte(byte value);
-
- /**
- * Sets the specified 16-bit short integer at the current
- * {@code writerIndex} and increases the {@code writerIndex} by {@code 2}
- * in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 2}
- */
- void writeShort(short value);
-
- /**
- * Sets the specified 32-bit integer at the current {@code writerIndex}
- * and increases the {@code writerIndex} by {@code 4} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 4}
- */
- void writeInt(int value);
-
- /**
- * Sets the specified 64-bit long integer at the current
- * {@code writerIndex} and increases the {@code writerIndex} by {@code 8}
- * in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 8}
- */
- void writeLong(long value);
-
- /**
- * Sets the specified char at the current {@code writerIndex}
- * and increases the {@code writerIndex} by {@code 2} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 2}
- */
- void writeChar(char chr);
-
- /**
- * Sets the specified float at the current {@code writerIndex}
- * and increases the {@code writerIndex} by {@code 4} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 4}
- */
- void writeFloat(float value);
-
- /**
- * Sets the specified double at the current {@code writerIndex}
- * and increases the {@code writerIndex} by {@code 8} in this buffer.
- *
- * @throws IndexOutOfBoundsException
- * if {@code this.writableBytes} is less than {@code 8}
- */
- void writeDouble(double value);
-
- /**
- * Sets the specified boolean at the current {@code writerIndex}
- */
- void writeBoolean(boolean val);
-
- /**
- * Sets the specified SimpleString (potentially {@code null}) at the current {@code writerIndex}
- */
- void writeNullableSimpleString(SimpleString val);
-
- /**
- * Sets the specified String (potentially {@code null}) at the current {@code writerIndex}
- */
- void writeNullableString(String val);
-
- /**
- * Sets the specified non-null SimpleString at the current {@code writerIndex}
- */
- void writeSimpleString(SimpleString val);
-
- /**
- * Sets the specified non-null String at the current {@code writerIndex}
- */
- void writeString(String val);
-
- /**
- * Sets the specified UTF-8 String at the current {@code writerIndex}
- */
-
- void writeUTF(String utf);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the current {@code writerIndex} and increases the {@code writerIndex}
- * by the number of the transferred bytes (= {@code length}). This method
- * is basically same with {@link #writeBytes(HornetQBuffer, int, int)},
- * except that this method increases the {@code readerIndex} of the source
- * buffer by the number of the transferred bytes (= {@code length}) while
- * {@link #writeBytes(HornetQBuffer, int, int)} does not.
- *
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if {@code length} is greater than {@code this.writableBytes} or
- * if {@code length} is greater then {@code src.readableBytes}
- */
- void writeBytes(HornetQBuffer src, int length);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the current {@code writerIndex} and increases the {@code writerIndex}
- * by the number of the transferred bytes (= {@code length}).
- *
- * @param srcIndex the first index of the source
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code srcIndex} is less than {@code 0},
- * if {@code srcIndex + length} is greater than
- * {@code src.capacity}, or
- * if {@code length} is greater than {@code this.writableBytes}
- */
- void writeBytes(HornetQBuffer src, int srcIndex, int length);
-
- /**
- * Transfers the specified source array's data to this buffer starting at
- * the current {@code writerIndex} and increases the {@code writerIndex}
- * by the number of the transferred bytes (= {@code src.length}).
- *
- * @throws IndexOutOfBoundsException
- * if {@code src.length} is greater than {@code this.writableBytes}
- */
- void writeBytes(byte[] src);
-
- /**
- * Transfers the specified source array's data to this buffer starting at
- * the current {@code writerIndex} and increases the {@code writerIndex}
- * by the number of the transferred bytes (= {@code length}).
- *
- * @param srcIndex the first index of the source
- * @param length the number of bytes to transfer
- *
- * @throws IndexOutOfBoundsException
- * if the specified {@code srcIndex} is less than {@code 0},
- * if {@code srcIndex + length} is greater than
- * {@code src.length}, or
- * if {@code length} is greater than {@code this.writableBytes}
- */
- void writeBytes(byte[] src, int srcIndex, int length);
-
- /**
- * Transfers the specified source buffer's data to this buffer starting at
- * the current {@code writerIndex} until the source buffer's position
- * reaches its limit, and increases the {@code writerIndex} by the
- * number of the transferred bytes.
- *
- * @throws IndexOutOfBoundsException
- * if {@code src.remaining()} is greater than
- * {@code this.writableBytes}
- */
- void writeBytes(ByteBuffer src);
-
- /**
- * Returns a copy of this buffer's readable bytes. Modifying the content
- * of the returned buffer or this buffer does not affect each other at all.
- * This method is identical to {@code buf.copy(buf.readerIndex(), buf.readableBytes())}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- *
- */
- HornetQBuffer copy();
-
- /**
- * Returns a copy of this buffer's sub-region. Modifying the content of
- * the returned buffer or this buffer does not affect each other at all.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- */
- HornetQBuffer copy(int index, int length);
-
- /**
- * Returns a slice of this buffer's readable bytes. Modifying the content
- * of the returned buffer or this buffer affects each other's content
- * while they maintain separate indexes and marks. This method is
- * identical to {@code buf.slice(buf.readerIndex(), buf.readableBytes())}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- */
- HornetQBuffer slice();
-
- /**
- * Returns a slice of this buffer's sub-region. Modifying the content of
- * the returned buffer or this buffer affects each other's content while
- * they maintain separate indexes and marks.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- */
- HornetQBuffer slice(int index, int length);
-
- /**
- * Returns a buffer which shares the whole region of this buffer.
- * Modifying the content of the returned buffer or this buffer affects
- * each other's content while they maintain separate indexes and marks.
- * This method is identical to {@code buf.slice(0, buf.capacity())}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- */
- HornetQBuffer duplicate();
-
- /**
- * Converts this buffer's readable bytes into a NIO buffer. The returned
- * buffer might or might not share the content with this buffer, while
- * they have separate indexes and marks. This method is identical to
- * {@code buf.toByteBuffer(buf.readerIndex(), buf.readableBytes())}.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- */
- ByteBuffer toByteBuffer();
-
- /**
- * Converts this buffer's sub-region into a NIO buffer. The returned
- * buffer might or might not share the content with this buffer, while
- * they have separate indexes and marks.
- * This method does not modify {@code readerIndex} or {@code writerIndex} of
- * this buffer.
- */
- ByteBuffer toByteBuffer(int index, int length);
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffers.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffers.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/HornetQBuffers.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,97 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.api.core;
-
-import java.nio.ByteBuffer;
-
-import org.hornetq.core.buffers.impl.ChannelBufferWrapper;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-
-/**
- * Factory class to create HornetQBuffers
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- */
-public class HornetQBuffers
-{
- /**
- * Creates a <em>self-expanding</em> HornetQBuffer with the given initial size
- *
- * @param size the initial size of the created HornetQBuffer
- * @return a self-expanding HornetQBuffer starting with the given size
- */
- public static HornetQBuffer dynamicBuffer(final int size)
- {
- return new ChannelBufferWrapper(ChannelBuffers.dynamicBuffer(size));
- }
-
- /**
- * Creates a <em>self-expanding</em> HornetQBuffer filled with the given byte array
- *
- * @param bytes the created buffer will be initially filled with this byte array
- * @return a self-expanding HornetQBuffer filled with the given byte array
- */
- public static HornetQBuffer dynamicBuffer(final byte[] bytes)
- {
- ChannelBuffer buff = ChannelBuffers.dynamicBuffer(bytes.length);
-
- buff.writeBytes(bytes);
-
- return new ChannelBufferWrapper(buff);
- }
-
- /**
- * Creates a HornetQBuffer wrapping an underlying NIO ByteBuffer
- *
- * The position on this buffer won't affect the position on the inner buffer
- *
- * @param underlying the underlying NIO ByteBuffer
- * @return a HornetQBuffer wrapping the underlying NIO ByteBuffer
- */
- public static HornetQBuffer wrappedBuffer(final ByteBuffer underlying)
- {
- HornetQBuffer buff = new ChannelBufferWrapper(ChannelBuffers.wrappedBuffer(underlying));
-
- buff.clear();
-
- return buff;
- }
-
- /**
- * Creates a HornetQBuffer wrapping an underlying byte array
- *
- * @param underlying the underlying byte array
- * @return a HornetQBuffer wrapping the underlying byte array
- */
- public static HornetQBuffer wrappedBuffer(final byte[] underlying)
- {
- return new ChannelBufferWrapper(ChannelBuffers.wrappedBuffer(underlying));
- }
-
- /**
- * Creates a <em>fixed</em> HornetQBuffer of the given size
- *
- * @param size the size of the created HornetQBuffer
- * @return a fixed HornetQBuffer with the given size
- */
- public static HornetQBuffer fixedBuffer(final int size)
- {
- return new ChannelBufferWrapper(ChannelBuffers.buffer(size));
- }
-
- private HornetQBuffers()
- {
- }
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/Pair.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/Pair.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/Pair.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,84 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.api.core;
-
-import java.io.Serializable;
-
-/**
- *
- * A Pair is a holder for 2 objects.
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class Pair<A, B> implements Serializable
-{
- private static final long serialVersionUID = -2496357457812368127L;
-
- public Pair(final A a, final B b)
- {
- this.a = a;
-
- this.b = b;
- }
-
- public A a;
-
- public B b;
-
- private int hash = -1;
-
- @Override
- public int hashCode()
- {
- if (hash == -1)
- {
- if (a == null && b == null)
- {
- return super.hashCode();
- }
- else
- {
- hash = (a == null ? 0 : a.hashCode()) + 37 * (b == null ? 0 : b.hashCode());
- }
- }
-
- return hash;
- }
-
- @Override
- public boolean equals(final Object other)
- {
- if (other == this)
- {
- return true;
- }
-
- if (other instanceof Pair == false)
- {
- return false;
- }
-
- Pair<A, B> pother = (Pair<A, B>)other;
-
- return (pother.a == null ? a == null : pother.a.equals(a)) && (pother.b == null ? b == null : pother.b.equals(b));
-
- }
-
- @Override
- public String toString()
- {
- return "Pair[a=" + a + ", b=" + b + "]";
- }
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/SimpleString.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/SimpleString.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/api/core/SimpleString.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,372 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.api.core;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hornetq.utils.DataConstants;
-
-/**
- * A simple String class that can store all characters, and stores as simple
- * byte[], this minimises expensive copying between String objects.
- *
- * This object is used heavily throughout HornetQ for performance reasons.
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-
-public class SimpleString implements CharSequence, Serializable, Comparable<SimpleString> {
- private static final long serialVersionUID = 4204223851422244307L;
-
- // Attributes
- // ------------------------------------------------------------------------
- private final byte[] data;
-
- private transient int hash;
-
- // Cache the string
- private transient String str;
-
- // Static
- // ----------------------------------------------------------------------
-
- /**
- * Returns a SimpleString constructed from the <code>string</code> parameter.
- * If <code>string</code> is <code>null</code>, the return value will be
- * <code>null</code> too.
- */
- public static SimpleString toSimpleString(final String string) {
- if (string == null) {
- return null;
- }
- return new SimpleString(string);
- }
-
- // Constructors
- // ----------------------------------------------------------------------
- /**
- * creates a SimpleString from a conventional String
- * @param string the string to transform
- */
- public SimpleString(final String string) {
- int len = string.length();
-
- data = new byte[len << 1];
-
- int j = 0;
-
- for (int i = 0; i < len; i++) {
- char c = string.charAt(i);
-
- byte low = (byte) (c & 0xFF); // low byte
-
- data[j++] = low;
-
- byte high = (byte) (c >> 8 & 0xFF); // high byte
-
- data[j++] = high;
- }
-
- str = string;
- }
-
- /**
- * creates a SimpleString from a byte array
- * @param data the byte array to use
- */
- public SimpleString(final byte[] data) {
- this.data = data;
- }
-
- // CharSequence implementation
- // ---------------------------------------------------------------------------
-
- public int length() {
- return data.length >> 1;
- }
-
- public char charAt(int pos) {
- if (pos < 0 || pos >= data.length >> 1) {
- throw new IndexOutOfBoundsException();
- }
- pos <<= 1;
-
- return (char) (data[pos] | data[pos + 1] << 8);
- }
-
- public CharSequence subSequence(final int start, final int end) {
- int len = data.length >> 1;
-
- if (end < start || start < 0 || end > len) {
- throw new IndexOutOfBoundsException();
- } else {
- int newlen = end - start << 1;
- byte[] bytes = new byte[newlen];
-
- System.arraycopy(data, start << 1, bytes, 0, newlen);
-
- return new SimpleString(bytes);
- }
- }
-
- // Comparable implementation -------------------------------------
-
- public int compareTo(final SimpleString o) {
- return toString().compareTo(o.toString());
- }
-
- // Public
- // ---------------------------------------------------------------------------
-
- /**
- * returns the underlying byte array of this SimpleString
- * @return the byte array
- */
- public byte[] getData() {
- return data;
- }
-
- /**
- * returns true if the SimpleString parameter starts with the same data as
- * this one. false if not.
- * @param other the SimpelString to look for
- * @return true if this SimpleString starts with the same data
- */
- public boolean startsWith(final SimpleString other) {
- byte[] otherdata = other.data;
-
- if (otherdata.length > data.length) {
- return false;
- }
-
- for (int i = 0; i < otherdata.length; i++) {
- if (data[i] != otherdata[i]) {
- return false;
- }
- }
-
- return true;
- }
-
- @Override
- public String toString() {
- if (str == null) {
- int len = data.length >> 1;
-
- char[] chars = new char[len];
-
- int j = 0;
-
- for (int i = 0; i < len; i++) {
- int low = data[j++] & 0xFF;
-
- int high = data[j++] << 8 & 0xFF00;
-
- chars[i] = (char) (low | high);
- }
-
- str = new String(chars);
- }
-
- return str;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (this == other) {
- return true;
- }
-
- if (other instanceof SimpleString) {
- SimpleString s = (SimpleString) other;
-
- if (data.length != s.data.length) {
- return false;
- }
-
- for (int i = 0; i < data.length; i++) {
- if (data[i] != s.data[i]) {
- return false;
- }
- }
-
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- if (hash == 0) {
- int tmphash = 0;
- for (byte element : data) {
- tmphash = (tmphash << 5) - tmphash + element; // (hash << 5) - hash is
- // same as hash * 31
- }
- hash = tmphash;
- }
-
- return hash;
- }
-
- /**
- * splits this SimpleString into an array of SimpleString using the char param
- * as the delimeter.
- *
- * i.e. "a.b" would return "a" and "b" if . was the delimeter
- * @param delim
- */
- public SimpleString[] split(final char delim) {
- if (!contains(delim)) {
- return new SimpleString[] { this };
- } else {
- List<SimpleString> all = new ArrayList<SimpleString>();
- int lasPos = 0;
- for (int i = 0; i < data.length; i += 2) {
- byte low = (byte) (delim & 0xFF); // low byte
- byte high = (byte) (delim >> 8 & 0xFF); // high byte
- if (data[i] == low && data[i + 1] == high) {
- byte[] bytes = new byte[i - lasPos];
- System.arraycopy(data, lasPos, bytes, 0, bytes.length);
- lasPos = i + 2;
- all.add(new SimpleString(bytes));
- }
- }
- byte[] bytes = new byte[data.length - lasPos];
- System.arraycopy(data, lasPos, bytes, 0, bytes.length);
- all.add(new SimpleString(bytes));
- SimpleString[] parts = new SimpleString[all.size()];
- return all.toArray(parts);
- }
- }
-
- /**
- * checks to see if this SimpleString contains the char parameter passed in
- *
- * @param c the char to check for
- * @return true if the char is found, false otherwise.
- */
- public boolean contains(final char c) {
- for (int i = 0; i < data.length; i += 2) {
- byte low = (byte) (c & 0xFF); // low byte
- byte high = (byte) (c >> 8 & 0xFF); // high byte
- if (data[i] == low && data[i + 1] == high) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * concatanates a SimpleString and a String
- *
- * @param toAdd the String to concate with.
- * @return the concatanated SimpleString
- */
- public SimpleString concat(final String toAdd) {
- return concat(new SimpleString(toAdd));
- }
-
- /**
- * concatanates 2 SimpleString's
- *
- * @param toAdd the SimpleString to concate with.
- * @return the concatanated SimpleString
- */
- public SimpleString concat(final SimpleString toAdd) {
- byte[] bytes = new byte[data.length + toAdd.getData().length];
- System.arraycopy(data, 0, bytes, 0, data.length);
- System.arraycopy(toAdd.getData(), 0, bytes, data.length, toAdd.getData().length);
- return new SimpleString(bytes);
- }
-
- /**
- * concatanates a SimpleString and a char
- *
- * @param c the char to concate with.
- * @return the concatanated SimpleString
- */
- public SimpleString concat(final char c) {
- byte[] bytes = new byte[data.length + 2];
- System.arraycopy(data, 0, bytes, 0, data.length);
- bytes[data.length] = (byte) (c & 0xFF);
- bytes[data.length + 1] = (byte) (c >> 8 & 0xFF);
- return new SimpleString(bytes);
- }
-
- /**
- * returns the size of this SimpleString
- * @return the size
- */
- public int sizeof() {
- return DataConstants.SIZE_INT + data.length;
- }
-
- /**
- * returns the size of a SimpleString
- * @param str the SimpleString to check
- * @return the size
- */
- public static int sizeofString(final SimpleString str) {
- return str.sizeof();
- }
-
- /**
- * returns the size of a SimpleString which could be null
- * @param str the SimpleString to check
- * @return the size
- */
- public static int sizeofNullableString(final SimpleString str) {
- if (str == null) {
- return 1;
- } else {
- return 1 + str.sizeof();
- }
- }
-
- /**
- *
- * @param srcBegin
- * @param srcEnd
- * @param dst
- * @param dstBegin
- */
- public void getChars(final int srcBegin, final int srcEnd, final char dst[],
- final int dstBegin) {
- if (srcBegin < 0) {
- throw new StringIndexOutOfBoundsException(srcBegin);
- }
- if (srcEnd > length()) {
- throw new StringIndexOutOfBoundsException(srcEnd);
- }
- if (srcBegin > srcEnd) {
- throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
- }
-
- int j = 0;
-
- for (int i = srcBegin; i < srcEnd - srcBegin; i++) {
- int low = data[j++] & 0xFF;
-
- int high = data[j++] << 8 & 0xFF00;
-
- dst[i] = (char) (low | high);
- }
- }
-
-}
\ No newline at end of file
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/buffers/impl/ChannelBufferWrapper.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,620 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.buffers.impl;
-
-import java.nio.ByteBuffer;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.utils.DataConstants;
-import org.hornetq.utils.UTF8Util;
-import org.jboss.netty.buffer.ChannelBuffer;
-
-/**
- *
- * A ChannelBufferWrapper
- *
- * @author Tim Fox
- *
- *
- */
-public class ChannelBufferWrapper implements HornetQBuffer
-{
- private static final Logger log = Logger.getLogger(ChannelBufferWrapper.class);
-
- protected ChannelBuffer buffer;
-
- public ChannelBufferWrapper(final ChannelBuffer buffer)
- {
- this.buffer = buffer;
- }
-
- public boolean readBoolean()
- {
- return readByte() != 0;
- }
-
- public SimpleString readNullableSimpleString()
- {
- int b = buffer.readByte();
- if (b == DataConstants.NULL)
- {
- return null;
- }
- else
- {
- return readSimpleStringInternal();
- }
- }
-
- public String readNullableString()
- {
- int b = buffer.readByte();
- if (b == DataConstants.NULL)
- {
- return null;
- }
- else
- {
- return readStringInternal();
- }
- }
-
- public SimpleString readSimpleString()
- {
- return readSimpleStringInternal();
- }
-
- private SimpleString readSimpleStringInternal()
- {
- int len = buffer.readInt();
- byte[] data = new byte[len];
- buffer.readBytes(data);
- return new SimpleString(data);
- }
-
- public String readString()
- {
- return readStringInternal();
- }
-
- private String readStringInternal()
- {
- int len = buffer.readInt();
-
- if (len < 9)
- {
- char[] chars = new char[len];
- for (int i = 0; i < len; i++)
- {
- chars[i] = (char)buffer.readShort();
- }
- return new String(chars);
- }
- else if (len < 0xfff)
- {
- return readUTF();
- }
- else
- {
- return readSimpleStringInternal().toString();
- }
- }
-
- public String readUTF()
- {
- return UTF8Util.readUTF(this);
- }
-
- public void writeBoolean(final boolean val)
- {
- buffer.writeByte((byte)(val ? -1 : 0));
- }
-
- public void writeNullableSimpleString(final SimpleString val)
- {
- if (val == null)
- {
- buffer.writeByte(DataConstants.NULL);
- }
- else
- {
- buffer.writeByte(DataConstants.NOT_NULL);
- writeSimpleStringInternal(val);
- }
- }
-
- public void writeNullableString(final String val)
- {
- if (val == null)
- {
- buffer.writeByte(DataConstants.NULL);
- }
- else
- {
- buffer.writeByte(DataConstants.NOT_NULL);
- writeStringInternal(val);
- }
- }
-
- public void writeSimpleString(final SimpleString val)
- {
- writeSimpleStringInternal(val);
- }
-
- private void writeSimpleStringInternal(final SimpleString val)
- {
- byte[] data = val.getData();
- buffer.writeInt(data.length);
- buffer.writeBytes(data);
- }
-
- public void writeString(final String val)
- {
- writeStringInternal(val);
- }
-
- private void writeStringInternal(final String val)
- {
- int length = val.length();
-
- buffer.writeInt(length);
-
- if (length < 9)
- {
- // If very small it's more performant to store char by char
- for (int i = 0; i < val.length(); i++)
- {
- buffer.writeShort((short)val.charAt(i));
- }
- }
- else if (length < 0xfff)
- {
- // Store as UTF - this is quicker than char by char for most strings
- writeUTF(val);
- }
- else
- {
- // Store as SimpleString, since can't store utf > 0xffff in length
- writeSimpleStringInternal(new SimpleString(val));
- }
- }
-
- public void writeUTF(final String utf)
- {
- UTF8Util.saveUTF(this, utf);
- }
-
- public int capacity()
- {
- return buffer.capacity();
- }
-
- public ChannelBuffer channelBuffer()
- {
- return buffer;
- }
-
- public void clear()
- {
- buffer.clear();
- }
-
- public HornetQBuffer copy()
- {
- return new ChannelBufferWrapper(buffer.copy());
- }
-
- public HornetQBuffer copy(final int index, final int length)
- {
- return new ChannelBufferWrapper(buffer.copy(index, length));
- }
-
- public void discardReadBytes()
- {
- buffer.discardReadBytes();
- }
-
- public HornetQBuffer duplicate()
- {
- return new ChannelBufferWrapper(buffer.duplicate());
- }
-
- public byte getByte(final int index)
- {
- return buffer.getByte(index);
- }
-
- public void getBytes(final int index, final byte[] dst, final int dstIndex, final int length)
- {
- buffer.getBytes(index, dst, dstIndex, length);
- }
-
- public void getBytes(final int index, final byte[] dst)
- {
- buffer.getBytes(index, dst);
- }
-
- public void getBytes(final int index, final ByteBuffer dst)
- {
- buffer.getBytes(index, dst);
- }
-
- public void getBytes(final int index, final HornetQBuffer dst, final int dstIndex, final int length)
- {
- buffer.getBytes(index, dst.channelBuffer(), dstIndex, length);
- }
-
- public void getBytes(final int index, final HornetQBuffer dst, final int length)
- {
- buffer.getBytes(index, dst.channelBuffer(), length);
- }
-
- public void getBytes(final int index, final HornetQBuffer dst)
- {
- buffer.getBytes(index, dst.channelBuffer());
- }
-
- public char getChar(final int index)
- {
- return (char)buffer.getShort(index);
- }
-
- public double getDouble(final int index)
- {
- return Double.longBitsToDouble(buffer.getLong(index));
- }
-
- public float getFloat(final int index)
- {
- return Float.intBitsToFloat(buffer.getInt(index));
- }
-
- public int getInt(final int index)
- {
- return buffer.getInt(index);
- }
-
- public long getLong(final int index)
- {
- return buffer.getLong(index);
- }
-
- public short getShort(final int index)
- {
- return buffer.getShort(index);
- }
-
- public short getUnsignedByte(final int index)
- {
- return buffer.getUnsignedByte(index);
- }
-
- public long getUnsignedInt(final int index)
- {
- return buffer.getUnsignedInt(index);
- }
-
- public int getUnsignedShort(final int index)
- {
- return buffer.getUnsignedShort(index);
- }
-
- public void markReaderIndex()
- {
- buffer.markReaderIndex();
- }
-
- public void markWriterIndex()
- {
- buffer.markWriterIndex();
- }
-
- public boolean readable()
- {
- return buffer.readable();
- }
-
- public int readableBytes()
- {
- return buffer.readableBytes();
- }
-
- public byte readByte()
- {
- return buffer.readByte();
- }
-
- public void readBytes(final byte[] dst, final int dstIndex, final int length)
- {
- buffer.readBytes(dst, dstIndex, length);
- }
-
- public void readBytes(final byte[] dst)
- {
- buffer.readBytes(dst);
- }
-
- public void readBytes(final ByteBuffer dst)
- {
- buffer.readBytes(dst);
- }
-
- public void readBytes(final HornetQBuffer dst, final int dstIndex, final int length)
- {
- buffer.readBytes(dst.channelBuffer(), dstIndex, length);
- }
-
- public void readBytes(final HornetQBuffer dst, final int length)
- {
- buffer.readBytes(dst.channelBuffer(), length);
- }
-
- public void readBytes(final HornetQBuffer dst)
- {
- buffer.readBytes(dst.channelBuffer());
- }
-
- public HornetQBuffer readBytes(final int length)
- {
- return new ChannelBufferWrapper(buffer.readBytes(length));
- }
-
- public char readChar()
- {
- return (char)buffer.readShort();
- }
-
- public double readDouble()
- {
- return Double.longBitsToDouble(buffer.readLong());
- }
-
- public int readerIndex()
- {
- return buffer.readerIndex();
- }
-
- public void readerIndex(final int readerIndex)
- {
- buffer.readerIndex(readerIndex);
- }
-
- public float readFloat()
- {
- return Float.intBitsToFloat(buffer.readInt());
- }
-
- public int readInt()
- {
- return buffer.readInt();
- }
-
- public long readLong()
- {
- return buffer.readLong();
- }
-
- public short readShort()
- {
- return buffer.readShort();
- }
-
- public HornetQBuffer readSlice(final int length)
- {
- return new ChannelBufferWrapper(buffer.readSlice(length));
- }
-
- public short readUnsignedByte()
- {
- return buffer.readUnsignedByte();
- }
-
- public long readUnsignedInt()
- {
- return buffer.readUnsignedInt();
- }
-
- public int readUnsignedShort()
- {
- return buffer.readUnsignedShort();
- }
-
- public void resetReaderIndex()
- {
- buffer.resetReaderIndex();
- }
-
- public void resetWriterIndex()
- {
- buffer.resetWriterIndex();
- }
-
- public void setByte(final int index, final byte value)
- {
- buffer.setByte(index, value);
- }
-
- public void setBytes(final int index, final byte[] src, final int srcIndex, final int length)
- {
- buffer.setBytes(index, src, srcIndex, length);
- }
-
- public void setBytes(final int index, final byte[] src)
- {
- buffer.setBytes(index, src);
- }
-
- public void setBytes(final int index, final ByteBuffer src)
- {
- buffer.setBytes(index, src);
- }
-
- public void setBytes(final int index, final HornetQBuffer src, final int srcIndex, final int length)
- {
- buffer.setBytes(index, src.channelBuffer(), srcIndex, length);
- }
-
- public void setBytes(final int index, final HornetQBuffer src, final int length)
- {
- buffer.setBytes(index, src.channelBuffer(), length);
- }
-
- public void setBytes(final int index, final HornetQBuffer src)
- {
- buffer.setBytes(index, src.channelBuffer());
- }
-
- public void setChar(final int index, final char value)
- {
- buffer.setShort(index, (short)value);
- }
-
- public void setDouble(final int index, final double value)
- {
- buffer.setLong(index, Double.doubleToLongBits(value));
- }
-
- public void setFloat(final int index, final float value)
- {
- buffer.setInt(index, Float.floatToIntBits(value));
- }
-
- public void setIndex(final int readerIndex, final int writerIndex)
- {
- buffer.setIndex(readerIndex, writerIndex);
- }
-
- public void setInt(final int index, final int value)
- {
- buffer.setInt(index, value);
- }
-
- public void setLong(final int index, final long value)
- {
- buffer.setLong(index, value);
- }
-
- public void setShort(final int index, final short value)
- {
- buffer.setShort(index, value);
- }
-
- public void skipBytes(final int length)
- {
- buffer.skipBytes(length);
- }
-
- public HornetQBuffer slice()
- {
- return new ChannelBufferWrapper(buffer.slice());
- }
-
- public HornetQBuffer slice(final int index, final int length)
- {
- return new ChannelBufferWrapper(buffer.slice(index, length));
- }
-
- public ByteBuffer toByteBuffer()
- {
- return buffer.toByteBuffer();
- }
-
- public ByteBuffer toByteBuffer(final int index, final int length)
- {
- return buffer.toByteBuffer(index, length);
- }
-
- public boolean writable()
- {
- return buffer.writable();
- }
-
- public int writableBytes()
- {
- return buffer.writableBytes();
- }
-
- public void writeByte(final byte value)
- {
- buffer.writeByte(value);
- }
-
- public void writeBytes(final byte[] src, final int srcIndex, final int length)
- {
- buffer.writeBytes(src, srcIndex, length);
- }
-
- public void writeBytes(final byte[] src)
- {
- buffer.writeBytes(src);
- }
-
- public void writeBytes(final ByteBuffer src)
- {
- buffer.writeBytes(src);
- }
-
- public void writeBytes(final HornetQBuffer src, final int srcIndex, final int length)
- {
- buffer.writeBytes(src.channelBuffer(), srcIndex, length);
- }
-
- public void writeBytes(final HornetQBuffer src, final int length)
- {
- buffer.writeBytes(src.channelBuffer(), length);
- }
-
- public void writeChar(final char chr)
- {
- buffer.writeShort((short)chr);
- }
-
- public void writeDouble(final double value)
- {
- buffer.writeLong(Double.doubleToLongBits(value));
- }
-
- public void writeFloat(final float value)
- {
- buffer.writeInt(Float.floatToIntBits(value));
- }
-
- public void writeInt(final int value)
- {
- buffer.writeInt(value);
- }
-
- public void writeLong(final long value)
- {
- buffer.writeLong(value);
- }
-
- public int writerIndex()
- {
- return buffer.writerIndex();
- }
-
- public void writerIndex(final int writerIndex)
- {
- buffer.writerIndex(writerIndex);
- }
-
- public void writeShort(final short value)
- {
- buffer.writeShort(value);
- }
-
-}
Modified: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/ImportJournal.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/ImportJournal.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/ImportJournal.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -29,11 +29,12 @@
/**
* Use this class to import the journal data from a listed file. You can use it as a main class or through its native method {@link ImportJournal#importJournal(String, String, String, int, int, String)}
- *
+ *
* If you use the main method, use it as <JournalDirectory> <JournalPrefix> <FileExtension> <MinFiles> <FileSize> <FileOutput>
- *
- * Example: java -cp hornetq-core.jar org.hornetq.core.journal.impl.ExportJournal /journalDir hornetq-data hq 2 10485760 /tmp/export.dat
*
+ * Example:<pre>
+ * java -cp hornetq-core.jar org.hornetq.core.journal.impl.ExportJournal /journalDir hornetq-data hq 2 10485760 /tmp/export.dat
+ *</pre>
* @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
*
*
Modified: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/SyncSpeedTest.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -27,10 +27,8 @@
import org.hornetq.core.logging.Logger;
/**
- * A SyncSpeedTest
- *
- * This class just provides some diagnostics on how fast your disk can sync
- * Useful when determining performance issues
+ * SyncSpeedTest provides diagnostics on how fast your disk can sync.<p>
+ * It is used to investigate performance issues.
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a> fox
*
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/Logger.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/Logger.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/Logger.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,212 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.logging;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.hornetq.core.logging.impl.JULLogDelegateFactory;
-import org.hornetq.spi.core.logging.LogDelegate;
-import org.hornetq.spi.core.logging.LogDelegateFactory;
-
-/**
- *
- * A Logger
- *
- * This class allows us to isolate all our logging dependencies in one place
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class Logger
-{
- public static final String LOGGER_DELEGATE_FACTORY_CLASS_NAME = "org.hornetq.logger-delegate-factory-class-name";
-
- private static volatile LogDelegateFactory delegateFactory;
-
- private static final ConcurrentMap<Class<?>, Logger> loggers = new ConcurrentHashMap<Class<?>, Logger>();
-
- static
- {
- Logger.initialise();
- }
-
- public static synchronized void setDelegateFactory(final LogDelegateFactory delegateFactory)
- {
- Logger.clear();
-
- Logger.delegateFactory = delegateFactory;
- }
-
- private static void clear()
- {
- Logger.loggers.clear();
- }
-
- public static synchronized void reset()
- {
- Logger.clear();
-
- Logger.initialise();
- }
-
- public static synchronized void initialise()
- {
- LogDelegateFactory delegateFactory;
-
- // If a system property is specified then this overrides any delegate factory which is set
- // programmatically - this is primarily of use so we can configure the logger delegate on the client side.
- // call to System.getProperty is wrapped in a try block as it will fail if the client runs in a secured
- // environment
- String className = JULLogDelegateFactory.class.getName();
- try
- {
- className = System.getProperty(Logger.LOGGER_DELEGATE_FACTORY_CLASS_NAME);
- }
- catch (Exception e)
- {
- }
-
- if (className != null)
- {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- try
- {
- Class<?> clz = loader.loadClass(className);
- delegateFactory = (LogDelegateFactory)clz.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalArgumentException("Error instantiating transformer class \"" + className + "\"", e);
- }
- }
- else
- {
- delegateFactory = new JULLogDelegateFactory();
- }
-
- Logger.delegateFactory = delegateFactory;
-
- Logger.loggers.clear();
- }
-
- public static Logger getLogger(final Class<?> clazz)
- {
- Logger logger = Logger.loggers.get(clazz);
-
- if (logger == null)
- {
- LogDelegate delegate = Logger.delegateFactory.createDelegate(clazz);
-
- logger = new Logger(delegate);
-
- Logger oldLogger = Logger.loggers.putIfAbsent(clazz, logger);
-
- if (oldLogger != null)
- {
- logger = oldLogger;
- }
- }
-
- return logger;
- }
-
- private final LogDelegate delegate;
-
- Logger(final LogDelegate delegate)
- {
- this.delegate = delegate;
- }
-
- public LogDelegate getDelegate()
- {
- return delegate;
- }
-
- public boolean isInfoEnabled()
- {
- return delegate.isInfoEnabled();
- }
-
- public boolean isDebugEnabled()
- {
- return delegate.isDebugEnabled();
- }
-
- public boolean isTraceEnabled()
- {
- return delegate.isTraceEnabled();
- }
-
- public void fatal(final Object message)
- {
- delegate.fatal(message);
- }
-
- public void fatal(final Object message, final Throwable t)
- {
- delegate.fatal(message, t);
- }
-
- public void error(final Object message)
- {
- delegate.error(message);
- }
-
- public void error(final Object message, final Throwable t)
- {
- delegate.error(message, t);
- }
-
- public void warn(final Object message)
- {
- delegate.warn(message);
- }
-
- public void warn(final Object message, final Throwable t)
- {
- delegate.warn(message, t);
- }
-
- public void info(final Object message)
- {
- delegate.info(message);
- }
-
- public void info(final Object message, final Throwable t)
- {
- delegate.info(message, t);
- }
-
- public void debug(final Object message)
- {
- delegate.debug(message);
- }
-
- public void debug(final Object message, final Throwable t)
- {
- delegate.debug(message, t);
- }
-
- public void trace(final Object message)
- {
- delegate.trace(message);
- }
-
- public void trace(final Object message, final Throwable t)
- {
- delegate.trace(message, t);
- }
-
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegate.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,111 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.logging.impl;
-
-import java.util.logging.Level;
-
-import org.hornetq.spi.core.logging.LogDelegate;
-
-/**
- *
- * A {@link LogDelegate} which delegates to java.util.logging
- *
- * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
- *
- */
-public class JULLogDelegate implements LogDelegate
-{
- private final java.util.logging.Logger logger;
-
- JULLogDelegate(final Class<?> clazz)
- {
- logger = java.util.logging.Logger.getLogger(clazz.getName());
- }
-
- public boolean isInfoEnabled()
- {
- return logger.isLoggable(Level.INFO);
- }
-
- public boolean isDebugEnabled()
- {
- return logger.isLoggable(Level.FINE);
- }
-
- public boolean isTraceEnabled()
- {
- return logger.isLoggable(Level.FINEST);
- }
-
- public void fatal(final Object message)
- {
- logger.log(Level.SEVERE, message == null ? "NULL" : message.toString());
- }
-
- public void fatal(final Object message, final Throwable t)
- {
- logger.log(Level.SEVERE, message == null ? "NULL" : message.toString(), t);
- }
-
- public void error(final Object message)
- {
- logger.log(Level.SEVERE, message == null ? "NULL" : message.toString());
- }
-
- public void error(final Object message, final Throwable t)
- {
- logger.log(Level.SEVERE, message == null ? "NULL" : message.toString(), t);
- }
-
- public void warn(final Object message)
- {
- logger.log(Level.WARNING, message == null ? "NULL" : message.toString());
- }
-
- public void warn(final Object message, final Throwable t)
- {
- logger.log(Level.WARNING, message == null ? "NULL" : message.toString(), t);
- }
-
- public void info(final Object message)
- {
- logger.log(Level.INFO, message == null ? "NULL" : message.toString());
- }
-
- public void info(final Object message, final Throwable t)
- {
- logger.log(Level.INFO, message == null ? "NULL" : message.toString(), t);
- }
-
- public void debug(final Object message)
- {
- logger.log(Level.FINE, message == null ? "NULL" : message.toString());
- }
-
- public void debug(final Object message, final Throwable t)
- {
- logger.log(Level.FINE, message == null ? "NULL" : message.toString(), t);
- }
-
- public void trace(final Object message)
- {
- logger.log(Level.FINEST, message == null ? "NULL" : message.toString());
- }
-
- public void trace(final Object message, final Throwable t)
- {
- logger.log(Level.FINEST, message == null ? "NULL" : message.toString(), t);
- }
-
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/logging/impl/JULLogDelegateFactory.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,32 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.logging.impl;
-
-import org.hornetq.spi.core.logging.LogDelegate;
-import org.hornetq.spi.core.logging.LogDelegateFactory;
-
-/**
- * A {@link LogDelegateFactory} which creates {@link JULLogDelegate} instances.
- *
- * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
- *
- *
- */
-public class JULLogDelegateFactory implements LogDelegateFactory
-{
- public LogDelegate createDelegate(final Class<?> clazz)
- {
- return new JULLogDelegate(clazz);
- }
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/message/BodyEncoder.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/message/BodyEncoder.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/core/message/BodyEncoder.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,55 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.message;
-
-import java.nio.ByteBuffer;
-
-import org.hornetq.api.core.HornetQBuffer;
-import org.hornetq.api.core.HornetQException;
-
-/**
- * Class used to encode message body into buffers.
- * <br>
- * Used to send large streams over the wire
- *
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- */
-public interface BodyEncoder
-{
- /**
- * This method must not be called directly by HornetQ clients.
- */
- void open() throws HornetQException;
-
- /**
- * This method must not be called directly by HornetQ clients.
- */
- void close() throws HornetQException;
-
- /**
- * This method must not be called directly by HornetQ clients.
- */
- int encode(ByteBuffer bufferRead) throws HornetQException;
-
- /**
- * This method must not be called directly by HornetQ clients.
- */
- int encode(HornetQBuffer bufferOut, int size) throws HornetQException;
-
- /**
- * This method must not be called directly by HornetQ clients.
- */
- long getLargeBodySize();
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegate.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,54 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.spi.core.logging;
-
-/**
- * I represent operations that are delegated to underlying logging frameworks.
- *
- * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
- *
- *
- */
-public interface LogDelegate
-{
- boolean isInfoEnabled();
-
- boolean isDebugEnabled();
-
- boolean isTraceEnabled();
-
- void fatal(Object message);
-
- void fatal(Object message, Throwable t);
-
- void error(Object message);
-
- void error(Object message, Throwable t);
-
- void warn(Object message);
-
- void warn(Object message, Throwable t);
-
- void info(Object message);
-
- void info(Object message, Throwable t);
-
- void debug(Object message);
-
- void debug(Object message, Throwable t);
-
- void trace(Object message);
-
- void trace(Object message, Throwable t);
-}
\ No newline at end of file
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/LogDelegateFactory.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,26 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.spi.core.logging;
-
-/**
- * I am responsible for creating {@link LogDelegate} instances.
- *
- * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
- *
- *
- */
-public interface LogDelegateFactory
-{
- LogDelegate createDelegate(Class<?> clazz);
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/package-info.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/package-info.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/spi/core/logging/package-info.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,21 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-/**
- * Logging SPI.
- * <br>
- * This package defines the Service Provide Interface to
- * support different logging implementation.
- */
-package org.hornetq.spi.core.logging;
-
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/DataConstants.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/DataConstants.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/DataConstants.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,68 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.utils;
-
-/**
- *
- * A DataConstants
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class DataConstants
-{
- public static final int SIZE_INT = 4;
-
- public static final int SIZE_BOOLEAN = 1;
-
- public static final int SIZE_LONG = 8;
-
- public static final int SIZE_BYTE = 1;
-
- public static final int SIZE_SHORT = 2;
-
- public static final int SIZE_DOUBLE = 8;
-
- public static final int SIZE_FLOAT = 4;
-
- public static final int SIZE_CHAR = 2;
-
- public static final byte TRUE = 1;
-
- public static final byte FALSE = 0;
-
- public static final byte NULL = 0;
-
- public static final byte NOT_NULL = 1;
-
- public static final byte BOOLEAN = 2;
-
- public static final byte BYTE = 3;
-
- public static final byte BYTES = 4;
-
- public static final byte SHORT = 5;
-
- public static final byte INT = 6;
-
- public static final byte LONG = 7;
-
- public static final byte FLOAT = 8;
-
- public static final byte DOUBLE = 9;
-
- public static final byte STRING = 10;
-
- public static final byte CHAR = 11;
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/UTF8Util.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/UTF8Util.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-journal/src/main/java/org/hornetq/utils/UTF8Util.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,272 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.utils;
-
-import java.lang.ref.SoftReference;
-
-import org.hornetq.api.core.HornetQBuffer;
-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 at jboss.org">Clebert Suconic</a>
- *
- * Created Feb 20, 2009 1:37:18 PM
- *
- *
- */
-public class UTF8Util
-{
- static boolean optimizeStrings = true;
-
- private static final Logger log = Logger.getLogger(UTF8Util.class);
-
- private static final boolean isTrace = UTF8Util.log.isTraceEnabled();
-
- private static ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer = new ThreadLocal<SoftReference<StringUtilBuffer>>();
-
- public static void saveUTF(final HornetQBuffer out, final String str)
- {
- StringUtilBuffer buffer = UTF8Util.getThreadLocalBuffer();
-
- if (str.length() > 0xffff)
- {
- throw new IllegalArgumentException("the specified string is too long (" + str.length() + ")");
- }
-
- final int len = UTF8Util.calculateUTFSize(str, buffer);
-
- if (len > 0xffff)
- {
- throw new IllegalArgumentException("the encoded string is too long (" + len + ")");
- }
-
- out.writeShort((short)len);
-
- if (len > buffer.byteBuffer.length)
- {
- buffer.resizeByteBuffer(len);
- }
-
- if (len == (long)str.length())
- {
- for (int byteLocation = 0; byteLocation < len; byteLocation++)
- {
- buffer.byteBuffer[byteLocation] = (byte)buffer.charBuffer[byteLocation];
- }
- out.writeBytes(buffer.byteBuffer, 0, len);
- }
- else
- {
- if (UTF8Util.isTrace)
- {
- // This message is too verbose for debug, that's why we are using trace here
- UTF8Util.log.trace("Saving string with utfSize=" + len + " stringSize=" + str.length());
- }
-
- int stringLength = str.length();
-
- int charCount = 0;
-
- for (int i = 0; i < stringLength; i++)
- {
- char charAtPos = buffer.charBuffer[i];
- if (charAtPos >= 1 && charAtPos < 0x7f)
- {
- buffer.byteBuffer[charCount++] = (byte)charAtPos;
- }
- else if (charAtPos >= 0x800)
- {
- buffer.byteBuffer[charCount++] = (byte)(0xE0 | charAtPos >> 12 & 0x0F);
- buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 6 & 0x3F);
- buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
- }
- else
- {
- buffer.byteBuffer[charCount++] = (byte)(0xC0 | charAtPos >> 6 & 0x1F);
- buffer.byteBuffer[charCount++] = (byte)(0x80 | charAtPos >> 0 & 0x3F);
-
- }
- }
- out.writeBytes(buffer.byteBuffer, 0, len);
- }
- }
-
- public static String readUTF(final HornetQBuffer input)
- {
- StringUtilBuffer buffer = UTF8Util.getThreadLocalBuffer();
-
- final int size = input.readUnsignedShort();
-
- if (size > buffer.byteBuffer.length)
- {
- buffer.resizeByteBuffer(size);
- }
-
- if (size > buffer.charBuffer.length)
- {
- buffer.resizeCharBuffer(size);
- }
-
- if (UTF8Util.isTrace)
- {
- // This message is too verbose for debug, that's why we are using trace here
- UTF8Util.log.trace("Reading string with utfSize=" + size);
- }
-
- int count = 0;
- int byte1, byte2, byte3;
- int charCount = 0;
-
- input.readBytes(buffer.byteBuffer, 0, size);
-
- while (count < size)
- {
- byte1 = buffer.byteBuffer[count++];
-
- if (byte1 > 0 && byte1 <= 0x7F)
- {
- buffer.charBuffer[charCount++] = (char)byte1;
- }
- else
- {
- int c = byte1 & 0xff;
- switch (c >> 4)
- {
- case 0xc:
- case 0xd:
- byte2 = buffer.byteBuffer[count++];
- buffer.charBuffer[charCount++] = (char)((c & 0x1F) << 6 | byte2 & 0x3F);
- break;
- case 0xe:
- byte2 = buffer.byteBuffer[count++];
- byte3 = buffer.byteBuffer[count++];
- buffer.charBuffer[charCount++] = (char)((c & 0x0F) << 12 | (byte2 & 0x3F) << 6 | (byte3 & 0x3F) << 0);
- break;
- }
- }
- }
-
- return new String(buffer.charBuffer, 0, charCount);
-
- }
-
- private static StringUtilBuffer getThreadLocalBuffer()
- {
- SoftReference<StringUtilBuffer> softReference = UTF8Util.currenBuffer.get();
- StringUtilBuffer value;
- if (softReference == null)
- {
- value = new StringUtilBuffer();
- softReference = new SoftReference<StringUtilBuffer>(value);
- UTF8Util.currenBuffer.set(softReference);
- }
- else
- {
- value = softReference.get();
- }
-
- if (value == null)
- {
- value = new StringUtilBuffer();
- softReference = new SoftReference<StringUtilBuffer>(value);
- UTF8Util.currenBuffer.set(softReference);
- }
-
- return value;
- }
-
- public static void clearBuffer()
- {
- SoftReference<StringUtilBuffer> ref = UTF8Util.currenBuffer.get();
- if (ref.get() != null)
- {
- ref.clear();
- }
- }
-
- public static int calculateUTFSize(final String str, final StringUtilBuffer stringBuffer)
- {
- int calculatedLen = 0;
-
- int stringLength = str.length();
-
- if (stringLength > stringBuffer.charBuffer.length)
- {
- stringBuffer.resizeCharBuffer(stringLength);
- }
-
- str.getChars(0, stringLength, stringBuffer.charBuffer, 0);
-
- for (int i = 0; i < stringLength; i++)
- {
- char c = stringBuffer.charBuffer[i];
-
- if (c >= 1 && c < 0x7f)
- {
- calculatedLen++;
- }
- else if (c >= 0x800)
- {
- calculatedLen += 3;
- }
- else
- {
- calculatedLen += 2;
- }
- }
- return calculatedLen;
- }
-
- private static class StringUtilBuffer
- {
-
- public char charBuffer[];
-
- public byte byteBuffer[];
-
- public void resizeCharBuffer(final int newSize)
- {
- if (newSize > charBuffer.length)
- {
- charBuffer = new char[newSize];
- }
- }
-
- public void resizeByteBuffer(final int newSize)
- {
- if (newSize > byteBuffer.length)
- {
- byteBuffer = new byte[newSize];
- }
- }
-
- public StringUtilBuffer()
- {
- this(1024, 1024);
- }
-
- public StringUtilBuffer(final int sizeChar, final int sizeByte)
- {
- charBuffer = new char[sizeChar];
- byteBuffer = new byte[sizeByte];
- }
-
- }
-
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-logging/hornetq-logging.iml
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-logging/hornetq-logging.iml 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-logging/hornetq-logging.iml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <excludeFolder url="file://$MODULE_DIR$/target" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="hornetq-core" />
- <orderEntry type="library" name="Maven: org.jboss.netty:netty:3.2.3.Final" level="project" />
- <orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
- </component>
-</module>
-
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-logging/pom.xml
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-logging/pom.xml 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-logging/pom.xml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,28 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-pom</artifactId>
- <version>2.2.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>hornetq-logging</artifactId>
- <packaging>jar</packaging>
- <name>HornetQ Logging</name>
-
- <dependencies>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- </dependencies>
-
-
-</project>
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/HornetQLoggerFormatter.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,60 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package org.hornetq.integration.logging;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.logging.LogRecord;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class HornetQLoggerFormatter extends java.util.logging.Formatter
-{
- private static String LINE_SEPARATOR = System.getProperty("line.separator");
-
- @Override
- public String format(final LogRecord record)
- {
- Date date = new Date();
- SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss,SSS");
- StringBuffer sb = new StringBuffer();
- // Minimize memory allocations here.
- date.setTime(record.getMillis());
- sb.append("[").append(Thread.currentThread().getName()).append("] ");
- sb.append(dateFormat.format(date)).append(" ");
- sb.append(record.getLevel()).append(" [");
- sb.append(record.getLoggerName()).append("]").append(" ");
- sb.append(record.getMessage());
-
- sb.append(HornetQLoggerFormatter.LINE_SEPARATOR);
- if (record.getThrown() != null)
- {
- try
- {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- record.getThrown().printStackTrace(pw);
- pw.close();
- sb.append(sw.toString());
- }
- catch (Exception ex)
- {
- }
- }
- return sb.toString();
- }
-
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegate.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,109 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.integration.logging;
-
-import org.hornetq.spi.core.logging.LogDelegate;
-
-/**
- *
- * A {@link LogDelegate} which delegates to Apache Log4j
- *
- * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
- *
- */
-public class Log4jLogDelegate implements LogDelegate
-{
- private final org.apache.log4j.Logger logger;
-
- Log4jLogDelegate(final Class<?> clazz)
- {
- logger = org.apache.log4j.Logger.getLogger(clazz);
- }
-
- public boolean isInfoEnabled()
- {
- return logger.isInfoEnabled();
- }
-
- public boolean isDebugEnabled()
- {
- return logger.isDebugEnabled();
- }
-
- public boolean isTraceEnabled()
- {
- return logger.isTraceEnabled();
- }
-
- public void fatal(final Object message)
- {
- logger.fatal(message);
- }
-
- public void fatal(final Object message, final Throwable t)
- {
- logger.fatal(message, t);
- }
-
- public void error(final Object message)
- {
- logger.error(message);
- }
-
- public void error(final Object message, final Throwable t)
- {
- logger.error(message, t);
- }
-
- public void warn(final Object message)
- {
- logger.warn(message);
- }
-
- public void warn(final Object message, final Throwable t)
- {
- logger.warn(message, t);
- }
-
- public void info(final Object message)
- {
- logger.info(message);
- }
-
- public void info(final Object message, final Throwable t)
- {
- logger.info(message, t);
- }
-
- public void debug(final Object message)
- {
- logger.debug(message);
- }
-
- public void debug(final Object message, final Throwable t)
- {
- logger.debug(message, t);
- }
-
- public void trace(final Object message)
- {
- logger.trace(message);
- }
-
- public void trace(final Object message, final Throwable t)
- {
- logger.trace(message, t);
- }
-
-}
Deleted: branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java
===================================================================
--- branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/hornetq-logging/src/main/java/org/hornetq/integration/logging/Log4jLogDelegateFactory.java 2011-05-25 17:30:36 UTC (rev 10727)
@@ -1,36 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.integration.logging;
-
-import org.hornetq.spi.core.logging.LogDelegate;
-import org.hornetq.spi.core.logging.LogDelegateFactory;
-
-/**
- * A {@link LogDelegateFactory} which creates {@link Log4jLogDelegate} instances.
- *
- * @author <a href="kenny.macleod at kizoom.com">Kenny MacLeod</a>
- *
- *
- */
-public class Log4jLogDelegateFactory implements LogDelegateFactory
-{
- /* (non-Javadoc)
- * @see org.hornetq.core.logging.LogDelegateFactory#getLogDelegate(java.lang.Class)
- */
- public LogDelegate createDelegate(final Class<?> clazz)
- {
- return new Log4jLogDelegate(clazz);
- }
-
-}
Modified: branches/HORNETQ-698_SplitJournal/pom.xml
===================================================================
--- branches/HORNETQ-698_SplitJournal/pom.xml 2011-05-25 17:25:44 UTC (rev 10726)
+++ branches/HORNETQ-698_SplitJournal/pom.xml 2011-05-25 17:30:36 UTC (rev 10727)
@@ -126,7 +126,7 @@
<module>hornetq-jms-client</module>
<module>hornetq-journal</module>
<module>hornetq-ra</module>
- <module>hornetq-logging</module>
+ <module>hornetq-commons</module>
<module>hornetq-bootstrap</module>
<module>hornetq-jboss-as-integration</module>
<module>hornetq-twitter-integration</module>
More information about the hornetq-commits
mailing list