This closes #255

This commit is contained in:
Clebert Suconic 2015-12-07 13:38:35 -05:00
commit deb84857a6
1541 changed files with 7631 additions and 138 deletions

View File

@ -88,6 +88,7 @@ public class Artemis {
// Sort the list by file name.. // Sort the list by file name..
Collections.sort(files, new Comparator<File>() { Collections.sort(files, new Comparator<File>() {
@Override
public int compare(File file, File file1) { public int compare(File file, File file1) {
return file.getName().compareTo(file1.getName()); return file.getName().compareTo(file1.getName());
} }

View File

@ -47,6 +47,7 @@ public abstract class ActionAbstract implements Action {
} }
} }
@Override
public String getBrokerInstance() { public String getBrokerInstance() {
if (brokerInstance == null) { if (brokerInstance == null) {
/* We use File URI for locating files. The ARTEMIS_HOME variable is used to determine file paths. For Windows /* We use File URI for locating files. The ARTEMIS_HOME variable is used to determine file paths. For Windows
@ -61,6 +62,7 @@ public abstract class ActionAbstract implements Action {
return brokerInstance; return brokerInstance;
} }
@Override
public String getBrokerHome() { public String getBrokerHome() {
if (brokerHome == null) { if (brokerHome == null) {
/* We use File URI for locating files. The ARTEMIS_HOME variable is used to determine file paths. For Windows /* We use File URI for locating files. The ARTEMIS_HOME variable is used to determine file paths. For Windows
@ -80,6 +82,7 @@ public abstract class ActionAbstract implements Action {
return brokerHome; return brokerHome;
} }
@Override
public Object execute(ActionContext context) throws Exception { public Object execute(ActionContext context) throws Exception {
this.context = context; this.context = context;

View File

@ -635,6 +635,7 @@ public class Create extends InputAbstract {
File dir = new File(path(getHome().toString(), false) + "/lib"); File dir = new File(path(getHome().toString(), false) + "/lib");
File[] matches = dir.listFiles(new FilenameFilter() { File[] matches = dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.startsWith("jboss-logmanager") && name.endsWith(".jar"); return name.startsWith("jboss-logmanager") && name.endsWith(".jar");
} }

View File

@ -160,6 +160,7 @@ public class Run extends Configurable {
}, 500, 500); }, 500, 500);
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() { public void run() {
try { try {
server.stop(); server.stop();

View File

@ -54,6 +54,7 @@ public class DecodeJournal extends LockAbstract {
@Option(name = "--input", description = "The input file name (default=exp.dmp)", required = true) @Option(name = "--input", description = "The input file name (default=exp.dmp)", required = true)
public String input = "exp.dmp"; public String input = "exp.dmp";
@Override
public Object execute(ActionContext context) throws Exception { public Object execute(ActionContext context) throws Exception {
super.execute(context); super.execute(context);
try { try {

View File

@ -48,6 +48,7 @@ public class EncodeJournal extends LockAbstract {
@Option(name = "--file-size", description = "The journal size (default 10485760)") @Option(name = "--file-size", description = "The journal size (default 10485760)")
public int size = 10485760; public int size = 10485760;
@Override
public Object execute(ActionContext context) throws Exception { public Object execute(ActionContext context) throws Exception {
super.execute(context); super.execute(context);
try { try {
@ -122,18 +123,22 @@ public class EncodeJournal extends LockAbstract {
final JournalFile file) throws Exception { final JournalFile file) throws Exception {
JournalImpl.readJournalFile(fileFactory, file, new JournalReaderCallback() { JournalImpl.readJournalFile(fileFactory, file, new JournalReaderCallback() {
@Override
public void onReadUpdateRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception { public void onReadUpdateRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception {
out.println("operation@UpdateTX,txID@" + transactionID + "," + describeRecord(recordInfo)); out.println("operation@UpdateTX,txID@" + transactionID + "," + describeRecord(recordInfo));
} }
@Override
public void onReadUpdateRecord(final RecordInfo recordInfo) throws Exception { public void onReadUpdateRecord(final RecordInfo recordInfo) throws Exception {
out.println("operation@Update," + describeRecord(recordInfo)); out.println("operation@Update," + describeRecord(recordInfo));
} }
@Override
public void onReadRollbackRecord(final long transactionID) throws Exception { public void onReadRollbackRecord(final long transactionID) throws Exception {
out.println("operation@Rollback,txID@" + transactionID); out.println("operation@Rollback,txID@" + transactionID);
} }
@Override
public void onReadPrepareRecord(final long transactionID, public void onReadPrepareRecord(final long transactionID,
final byte[] extraData, final byte[] extraData,
final int numberOfRecords) throws Exception { final int numberOfRecords) throws Exception {
@ -144,28 +149,34 @@ public class EncodeJournal extends LockAbstract {
encode(extraData)); encode(extraData));
} }
@Override
public void onReadDeleteRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception { public void onReadDeleteRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception {
out.println("operation@DeleteRecordTX,txID@" + transactionID + out.println("operation@DeleteRecordTX,txID@" + transactionID +
"," + "," +
describeRecord(recordInfo)); describeRecord(recordInfo));
} }
@Override
public void onReadDeleteRecord(final long recordID) throws Exception { public void onReadDeleteRecord(final long recordID) throws Exception {
out.println("operation@DeleteRecord,id@" + recordID); out.println("operation@DeleteRecord,id@" + recordID);
} }
@Override
public void onReadCommitRecord(final long transactionID, final int numberOfRecords) throws Exception { public void onReadCommitRecord(final long transactionID, final int numberOfRecords) throws Exception {
out.println("operation@Commit,txID@" + transactionID + ",numberOfRecords@" + numberOfRecords); out.println("operation@Commit,txID@" + transactionID + ",numberOfRecords@" + numberOfRecords);
} }
@Override
public void onReadAddRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception { public void onReadAddRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception {
out.println("operation@AddRecordTX,txID@" + transactionID + "," + describeRecord(recordInfo)); out.println("operation@AddRecordTX,txID@" + transactionID + "," + describeRecord(recordInfo));
} }
@Override
public void onReadAddRecord(final RecordInfo recordInfo) throws Exception { public void onReadAddRecord(final RecordInfo recordInfo) throws Exception {
out.println("operation@AddRecord," + describeRecord(recordInfo)); out.println("operation@AddRecord," + describeRecord(recordInfo));
} }
@Override
public void markAsDataFile(final JournalFile file) { public void markAsDataFile(final JournalFile file) {
} }
}); });

View File

@ -64,6 +64,7 @@ public class ProducerThread extends Thread {
this.session = session; this.session = session;
} }
@Override
public void run() { public void run() {
MessageProducer producer = null; MessageProducer producer = null;
String threadName = Thread.currentThread().getName(); String threadName = Thread.currentThread().getName();

View File

@ -30,6 +30,7 @@ public class ProcessBuilder {
static { static {
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() { public void run() {
for (Process p : processes) { for (Process p : processes) {
// if (p.isAlive()) // if (p.isAlive())

View File

@ -43,6 +43,7 @@ public class FileBroker implements Broker {
this.configurationUrl = broker.configuration; this.configurationUrl = broker.configuration;
} }
@Override
public synchronized void start() throws Exception { public synchronized void start() throws Exception {
if (started) { if (started) {
return; return;

View File

@ -54,6 +54,7 @@ public class ServerUtil {
final Process process = builder.start(); final Process process = builder.start();
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() { public void run() {
process.destroy(); process.destroy();
} }

View File

@ -634,6 +634,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a byte at the current {@code readerIndex} * @return a byte at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 1} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 1}
*/ */
@Override
byte readByte(); byte readByte();
/** /**
@ -643,6 +644,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return an unsigned byte at the current {@code readerIndex} * @return an unsigned byte at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 1} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 1}
*/ */
@Override
int readUnsignedByte(); int readUnsignedByte();
/** /**
@ -652,6 +654,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a 16-bit short integer at the current {@code readerIndex} * @return a 16-bit short integer at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 2} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 2}
*/ */
@Override
short readShort(); short readShort();
/** /**
@ -661,6 +664,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return an unsigned 16-bit short integer at the current {@code readerIndex} * @return an unsigned 16-bit short integer at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 2} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 2}
*/ */
@Override
int readUnsignedShort(); int readUnsignedShort();
/** /**
@ -670,6 +674,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a 32-bit integer at the current {@code readerIndex} * @return a 32-bit integer at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 4} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 4}
*/ */
@Override
int readInt(); int readInt();
/** /**
@ -688,6 +693,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a 64-bit integer at the current {@code readerIndex} * @return a 64-bit integer at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 8} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 8}
*/ */
@Override
long readLong(); long readLong();
/** /**
@ -697,6 +703,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a char at the current {@code readerIndex} * @return a char at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 2} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 2}
*/ */
@Override
char readChar(); char readChar();
/** /**
@ -706,6 +713,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a float at the current {@code readerIndex} * @return a float at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 4} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 4}
*/ */
@Override
float readFloat(); float readFloat();
/** /**
@ -715,6 +723,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a double at the current {@code readerIndex} * @return a double at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 8} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 8}
*/ */
@Override
double readDouble(); double readDouble();
/** /**
@ -724,6 +733,7 @@ public interface ActiveMQBuffer extends DataInput {
* @return a boolean at the current {@code readerIndex} * @return a boolean at the current {@code readerIndex}
* @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 1} * @throws IndexOutOfBoundsException if {@code this.readableBytes} is less than {@code 1}
*/ */
@Override
boolean readBoolean(); boolean readBoolean();
/** /**
@ -759,6 +769,7 @@ public interface ActiveMQBuffer extends DataInput {
* *
* @return a UTF-8 String at the current {@code readerIndex} * @return a UTF-8 String at the current {@code readerIndex}
*/ */
@Override
String readUTF(); String readUTF();
/** /**
@ -875,6 +886,7 @@ public interface ActiveMQBuffer extends DataInput {
* @param length The number of bytes to skip * @param length The number of bytes to skip
* @throws IndexOutOfBoundsException if {@code length} is greater than {@code this.readableBytes} * @throws IndexOutOfBoundsException if {@code length} is greater than {@code this.readableBytes}
*/ */
@Override
int skipBytes(int length); int skipBytes(int length);
/** /**

View File

@ -101,10 +101,12 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
// CharSequence implementation // CharSequence implementation
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@Override
public int length() { public int length() {
return data.length >> 1; return data.length >> 1;
} }
@Override
public char charAt(int pos) { public char charAt(int pos) {
if (pos < 0 || pos >= data.length >> 1) { if (pos < 0 || pos >= data.length >> 1) {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();
@ -114,6 +116,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
return (char) ((data[pos] & 0xFF) | (data[pos + 1] << 8) & 0xFF00); return (char) ((data[pos] & 0xFF) | (data[pos + 1] << 8) & 0xFF00);
} }
@Override
public CharSequence subSequence(final int start, final int end) { public CharSequence subSequence(final int start, final int end) {
int len = data.length >> 1; int len = data.length >> 1;
@ -132,6 +135,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
// Comparable implementation ------------------------------------- // Comparable implementation -------------------------------------
@Override
public int compareTo(final SimpleString o) { public int compareTo(final SimpleString o) {
return toString().compareTo(o.toString()); return toString().compareTo(o.toString());
} }

View File

@ -56,10 +56,12 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
this.releasable = releasable; this.releasable = releasable;
} }
@Override
public boolean readBoolean() { public boolean readBoolean() {
return readByte() != 0; return readByte() != 0;
} }
@Override
public SimpleString readNullableSimpleString() { public SimpleString readNullableSimpleString() {
int b = buffer.readByte(); int b = buffer.readByte();
if (b == DataConstants.NULL) { if (b == DataConstants.NULL) {
@ -68,6 +70,7 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
return readSimpleStringInternal(); return readSimpleStringInternal();
} }
@Override
public String readNullableString() { public String readNullableString() {
int b = buffer.readByte(); int b = buffer.readByte();
if (b == DataConstants.NULL) { if (b == DataConstants.NULL) {
@ -76,6 +79,7 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
return readStringInternal(); return readStringInternal();
} }
@Override
public SimpleString readSimpleString() { public SimpleString readSimpleString() {
return readSimpleStringInternal(); return readSimpleStringInternal();
} }
@ -87,6 +91,7 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
return new SimpleString(data); return new SimpleString(data);
} }
@Override
public String readString() { public String readString() {
return readStringInternal(); return readStringInternal();
} }
@ -109,14 +114,17 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
} }
} }
@Override
public String readUTF() { public String readUTF() {
return UTF8Util.readUTF(this); return UTF8Util.readUTF(this);
} }
@Override
public void writeBoolean(final boolean val) { public void writeBoolean(final boolean val) {
buffer.writeByte((byte) (val ? -1 : 0)); buffer.writeByte((byte) (val ? -1 : 0));
} }
@Override
public void writeNullableSimpleString(final SimpleString val) { public void writeNullableSimpleString(final SimpleString val) {
if (val == null) { if (val == null) {
buffer.writeByte(DataConstants.NULL); buffer.writeByte(DataConstants.NULL);
@ -127,6 +135,7 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
} }
} }
@Override
public void writeNullableString(final String val) { public void writeNullableString(final String val) {
if (val == null) { if (val == null) {
buffer.writeByte(DataConstants.NULL); buffer.writeByte(DataConstants.NULL);
@ -137,6 +146,7 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
} }
} }
@Override
public void writeSimpleString(final SimpleString val) { public void writeSimpleString(final SimpleString val) {
writeSimpleStringInternal(val); writeSimpleStringInternal(val);
} }
@ -147,6 +157,7 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
buffer.writeBytes(data); buffer.writeBytes(data);
} }
@Override
public void writeString(final String val) { public void writeString(final String val) {
writeStringInternal(val); writeStringInternal(val);
} }
@ -172,343 +183,428 @@ public class ChannelBufferWrapper implements ActiveMQBuffer {
} }
} }
@Override
public void writeUTF(final String utf) { public void writeUTF(final String utf) {
UTF8Util.saveUTF(this, utf); UTF8Util.saveUTF(this, utf);
} }
@Override
public int capacity() { public int capacity() {
return buffer.capacity(); return buffer.capacity();
} }
@Override
public ByteBuf byteBuf() { public ByteBuf byteBuf() {
return buffer; return buffer;
} }
@Override
public void clear() { public void clear() {
buffer.clear(); buffer.clear();
} }
@Override
public ActiveMQBuffer copy() { public ActiveMQBuffer copy() {
return new ChannelBufferWrapper(buffer.copy(), releasable); return new ChannelBufferWrapper(buffer.copy(), releasable);
} }
@Override
public ActiveMQBuffer copy(final int index, final int length) { public ActiveMQBuffer copy(final int index, final int length) {
return new ChannelBufferWrapper(buffer.copy(index, length), releasable); return new ChannelBufferWrapper(buffer.copy(index, length), releasable);
} }
@Override
public void discardReadBytes() { public void discardReadBytes() {
buffer.discardReadBytes(); buffer.discardReadBytes();
} }
@Override
public ActiveMQBuffer duplicate() { public ActiveMQBuffer duplicate() {
return new ChannelBufferWrapper(buffer.duplicate(), releasable); return new ChannelBufferWrapper(buffer.duplicate(), releasable);
} }
@Override
public byte getByte(final int index) { public byte getByte(final int index) {
return buffer.getByte(index); return buffer.getByte(index);
} }
@Override
public void getBytes(final int index, final byte[] dst, final int dstIndex, final int length) { public void getBytes(final int index, final byte[] dst, final int dstIndex, final int length) {
buffer.getBytes(index, dst, dstIndex, length); buffer.getBytes(index, dst, dstIndex, length);
} }
@Override
public void getBytes(final int index, final byte[] dst) { public void getBytes(final int index, final byte[] dst) {
buffer.getBytes(index, dst); buffer.getBytes(index, dst);
} }
@Override
public void getBytes(final int index, final ByteBuffer dst) { public void getBytes(final int index, final ByteBuffer dst) {
buffer.getBytes(index, dst); buffer.getBytes(index, dst);
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst, final int dstIndex, final int length) { public void getBytes(final int index, final ActiveMQBuffer dst, final int dstIndex, final int length) {
buffer.getBytes(index, dst.byteBuf(), dstIndex, length); buffer.getBytes(index, dst.byteBuf(), dstIndex, length);
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst, final int length) { public void getBytes(final int index, final ActiveMQBuffer dst, final int length) {
buffer.getBytes(index, dst.byteBuf(), length); buffer.getBytes(index, dst.byteBuf(), length);
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst) { public void getBytes(final int index, final ActiveMQBuffer dst) {
buffer.getBytes(index, dst.byteBuf()); buffer.getBytes(index, dst.byteBuf());
} }
@Override
public char getChar(final int index) { public char getChar(final int index) {
return (char) buffer.getShort(index); return (char) buffer.getShort(index);
} }
@Override
public double getDouble(final int index) { public double getDouble(final int index) {
return Double.longBitsToDouble(buffer.getLong(index)); return Double.longBitsToDouble(buffer.getLong(index));
} }
@Override
public float getFloat(final int index) { public float getFloat(final int index) {
return Float.intBitsToFloat(buffer.getInt(index)); return Float.intBitsToFloat(buffer.getInt(index));
} }
@Override
public int getInt(final int index) { public int getInt(final int index) {
return buffer.getInt(index); return buffer.getInt(index);
} }
@Override
public long getLong(final int index) { public long getLong(final int index) {
return buffer.getLong(index); return buffer.getLong(index);
} }
@Override
public short getShort(final int index) { public short getShort(final int index) {
return buffer.getShort(index); return buffer.getShort(index);
} }
@Override
public short getUnsignedByte(final int index) { public short getUnsignedByte(final int index) {
return buffer.getUnsignedByte(index); return buffer.getUnsignedByte(index);
} }
@Override
public long getUnsignedInt(final int index) { public long getUnsignedInt(final int index) {
return buffer.getUnsignedInt(index); return buffer.getUnsignedInt(index);
} }
@Override
public int getUnsignedShort(final int index) { public int getUnsignedShort(final int index) {
return buffer.getUnsignedShort(index); return buffer.getUnsignedShort(index);
} }
@Override
public void markReaderIndex() { public void markReaderIndex() {
buffer.markReaderIndex(); buffer.markReaderIndex();
} }
@Override
public void markWriterIndex() { public void markWriterIndex() {
buffer.markWriterIndex(); buffer.markWriterIndex();
} }
@Override
public boolean readable() { public boolean readable() {
return buffer.isReadable(); return buffer.isReadable();
} }
@Override
public int readableBytes() { public int readableBytes() {
return buffer.readableBytes(); return buffer.readableBytes();
} }
@Override
public byte readByte() { public byte readByte() {
return buffer.readByte(); return buffer.readByte();
} }
@Override
public void readBytes(final byte[] dst, final int dstIndex, final int length) { public void readBytes(final byte[] dst, final int dstIndex, final int length) {
buffer.readBytes(dst, dstIndex, length); buffer.readBytes(dst, dstIndex, length);
} }
@Override
public void readBytes(final byte[] dst) { public void readBytes(final byte[] dst) {
buffer.readBytes(dst); buffer.readBytes(dst);
} }
@Override
public void readBytes(final ByteBuffer dst) { public void readBytes(final ByteBuffer dst) {
buffer.readBytes(dst); buffer.readBytes(dst);
} }
@Override
public void readBytes(final ActiveMQBuffer dst, final int dstIndex, final int length) { public void readBytes(final ActiveMQBuffer dst, final int dstIndex, final int length) {
buffer.readBytes(dst.byteBuf(), dstIndex, length); buffer.readBytes(dst.byteBuf(), dstIndex, length);
} }
@Override
public void readBytes(final ActiveMQBuffer dst, final int length) { public void readBytes(final ActiveMQBuffer dst, final int length) {
buffer.readBytes(dst.byteBuf(), length); buffer.readBytes(dst.byteBuf(), length);
} }
@Override
public void readBytes(final ActiveMQBuffer dst) { public void readBytes(final ActiveMQBuffer dst) {
buffer.readBytes(dst.byteBuf()); buffer.readBytes(dst.byteBuf());
} }
@Override
public ActiveMQBuffer readBytes(final int length) { public ActiveMQBuffer readBytes(final int length) {
return new ChannelBufferWrapper(buffer.readBytes(length), releasable); return new ChannelBufferWrapper(buffer.readBytes(length), releasable);
} }
@Override
public char readChar() { public char readChar() {
return (char) buffer.readShort(); return (char) buffer.readShort();
} }
@Override
public double readDouble() { public double readDouble() {
return Double.longBitsToDouble(buffer.readLong()); return Double.longBitsToDouble(buffer.readLong());
} }
@Override
public int readerIndex() { public int readerIndex() {
return buffer.readerIndex(); return buffer.readerIndex();
} }
@Override
public void readerIndex(final int readerIndex) { public void readerIndex(final int readerIndex) {
buffer.readerIndex(readerIndex); buffer.readerIndex(readerIndex);
} }
@Override
public float readFloat() { public float readFloat() {
return Float.intBitsToFloat(buffer.readInt()); return Float.intBitsToFloat(buffer.readInt());
} }
@Override
public int readInt() { public int readInt() {
return buffer.readInt(); return buffer.readInt();
} }
@Override
public long readLong() { public long readLong() {
return buffer.readLong(); return buffer.readLong();
} }
@Override
public short readShort() { public short readShort() {
return buffer.readShort(); return buffer.readShort();
} }
@Override
public ActiveMQBuffer readSlice(final int length) { public ActiveMQBuffer readSlice(final int length) {
return new ChannelBufferWrapper(buffer.readSlice(length), releasable); return new ChannelBufferWrapper(buffer.readSlice(length), releasable);
} }
@Override
public int readUnsignedByte() { public int readUnsignedByte() {
return buffer.readUnsignedByte(); return buffer.readUnsignedByte();
} }
@Override
public long readUnsignedInt() { public long readUnsignedInt() {
return buffer.readUnsignedInt(); return buffer.readUnsignedInt();
} }
@Override
public int readUnsignedShort() { public int readUnsignedShort() {
return buffer.readUnsignedShort(); return buffer.readUnsignedShort();
} }
@Override
public void resetReaderIndex() { public void resetReaderIndex() {
buffer.resetReaderIndex(); buffer.resetReaderIndex();
} }
@Override
public void resetWriterIndex() { public void resetWriterIndex() {
buffer.resetWriterIndex(); buffer.resetWriterIndex();
} }
@Override
public void setByte(final int index, final byte value) { public void setByte(final int index, final byte value) {
buffer.setByte(index, value); buffer.setByte(index, value);
} }
@Override
public void setBytes(final int index, final byte[] src, final int srcIndex, final int length) { public void setBytes(final int index, final byte[] src, final int srcIndex, final int length) {
buffer.setBytes(index, src, srcIndex, length); buffer.setBytes(index, src, srcIndex, length);
} }
@Override
public void setBytes(final int index, final byte[] src) { public void setBytes(final int index, final byte[] src) {
buffer.setBytes(index, src); buffer.setBytes(index, src);
} }
@Override
public void setBytes(final int index, final ByteBuffer src) { public void setBytes(final int index, final ByteBuffer src) {
buffer.setBytes(index, src); buffer.setBytes(index, src);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src, final int srcIndex, final int length) { public void setBytes(final int index, final ActiveMQBuffer src, final int srcIndex, final int length) {
buffer.setBytes(index, src.byteBuf(), srcIndex, length); buffer.setBytes(index, src.byteBuf(), srcIndex, length);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src, final int length) { public void setBytes(final int index, final ActiveMQBuffer src, final int length) {
buffer.setBytes(index, src.byteBuf(), length); buffer.setBytes(index, src.byteBuf(), length);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src) { public void setBytes(final int index, final ActiveMQBuffer src) {
buffer.setBytes(index, src.byteBuf()); buffer.setBytes(index, src.byteBuf());
} }
@Override
public void setChar(final int index, final char value) { public void setChar(final int index, final char value) {
buffer.setShort(index, (short) value); buffer.setShort(index, (short) value);
} }
@Override
public void setDouble(final int index, final double value) { public void setDouble(final int index, final double value) {
buffer.setLong(index, Double.doubleToLongBits(value)); buffer.setLong(index, Double.doubleToLongBits(value));
} }
@Override
public void setFloat(final int index, final float value) { public void setFloat(final int index, final float value) {
buffer.setInt(index, Float.floatToIntBits(value)); buffer.setInt(index, Float.floatToIntBits(value));
} }
@Override
public void setIndex(final int readerIndex, final int writerIndex) { public void setIndex(final int readerIndex, final int writerIndex) {
buffer.setIndex(readerIndex, writerIndex); buffer.setIndex(readerIndex, writerIndex);
} }
@Override
public void setInt(final int index, final int value) { public void setInt(final int index, final int value) {
buffer.setInt(index, value); buffer.setInt(index, value);
} }
@Override
public void setLong(final int index, final long value) { public void setLong(final int index, final long value) {
buffer.setLong(index, value); buffer.setLong(index, value);
} }
@Override
public void setShort(final int index, final short value) { public void setShort(final int index, final short value) {
buffer.setShort(index, value); buffer.setShort(index, value);
} }
@Override
public int skipBytes(final int length) { public int skipBytes(final int length) {
buffer.skipBytes(length); buffer.skipBytes(length);
return length; return length;
} }
@Override
public ActiveMQBuffer slice() { public ActiveMQBuffer slice() {
return new ChannelBufferWrapper(buffer.slice(), releasable); return new ChannelBufferWrapper(buffer.slice(), releasable);
} }
@Override
public ActiveMQBuffer slice(final int index, final int length) { public ActiveMQBuffer slice(final int index, final int length) {
return new ChannelBufferWrapper(buffer.slice(index, length), releasable); return new ChannelBufferWrapper(buffer.slice(index, length), releasable);
} }
@Override
public ByteBuffer toByteBuffer() { public ByteBuffer toByteBuffer() {
return buffer.nioBuffer(); return buffer.nioBuffer();
} }
@Override
public ByteBuffer toByteBuffer(final int index, final int length) { public ByteBuffer toByteBuffer(final int index, final int length) {
return buffer.nioBuffer(index, length); return buffer.nioBuffer(index, length);
} }
@Override
public boolean writable() { public boolean writable() {
return buffer.isWritable(); return buffer.isWritable();
} }
@Override
public int writableBytes() { public int writableBytes() {
return buffer.writableBytes(); return buffer.writableBytes();
} }
@Override
public void writeByte(final byte value) { public void writeByte(final byte value) {
buffer.writeByte(value); buffer.writeByte(value);
} }
@Override
public void writeBytes(final byte[] src, final int srcIndex, final int length) { public void writeBytes(final byte[] src, final int srcIndex, final int length) {
buffer.writeBytes(src, srcIndex, length); buffer.writeBytes(src, srcIndex, length);
} }
@Override
public void writeBytes(final byte[] src) { public void writeBytes(final byte[] src) {
buffer.writeBytes(src); buffer.writeBytes(src);
} }
@Override
public void writeBytes(final ByteBuffer src) { public void writeBytes(final ByteBuffer src) {
buffer.writeBytes(src); buffer.writeBytes(src);
} }
@Override
public void writeBytes(final ActiveMQBuffer src, final int srcIndex, final int length) { public void writeBytes(final ActiveMQBuffer src, final int srcIndex, final int length) {
buffer.writeBytes(src.byteBuf(), srcIndex, length); buffer.writeBytes(src.byteBuf(), srcIndex, length);
} }
@Override
public void writeBytes(final ActiveMQBuffer src, final int length) { public void writeBytes(final ActiveMQBuffer src, final int length) {
buffer.writeBytes(src.byteBuf(), length); buffer.writeBytes(src.byteBuf(), length);
} }
@Override
public void writeChar(final char chr) { public void writeChar(final char chr) {
buffer.writeShort((short) chr); buffer.writeShort((short) chr);
} }
@Override
public void writeDouble(final double value) { public void writeDouble(final double value) {
buffer.writeLong(Double.doubleToLongBits(value)); buffer.writeLong(Double.doubleToLongBits(value));
} }
@Override
public void writeFloat(final float value) { public void writeFloat(final float value) {
buffer.writeInt(Float.floatToIntBits(value)); buffer.writeInt(Float.floatToIntBits(value));
} }
@Override
public void writeInt(final int value) { public void writeInt(final int value) {
buffer.writeInt(value); buffer.writeInt(value);
} }
@Override
public void writeLong(final long value) { public void writeLong(final long value) {
buffer.writeLong(value); buffer.writeLong(value);
} }
@Override
public int writerIndex() { public int writerIndex() {
return buffer.writerIndex(); return buffer.writerIndex();
} }
@Override
public void writerIndex(final int writerIndex) { public void writerIndex(final int writerIndex) {
buffer.writerIndex(writerIndex); buffer.writerIndex(writerIndex);
} }
@Override
public void writeShort(final short value) { public void writeShort(final short value) {
buffer.writeShort(value); buffer.writeShort(value);
} }

View File

@ -56,6 +56,7 @@ public final class ActiveMQThreadFactory implements ThreadFactory {
this.acc = AccessController.getContext(); this.acc = AccessController.getContext();
} }
@Override
public Thread newThread(final Runnable command) { public Thread newThread(final Runnable command) {
// create a thread in a privileged block if running with Security Manager // create a thread in a privileged block if running with Security Manager
if (acc != null) { if (acc != null) {
@ -74,6 +75,7 @@ public final class ActiveMQThreadFactory implements ThreadFactory {
this.target = target; this.target = target;
} }
@Override
public Thread run() { public Thread run() {
return createThread(target); return createThread(target);
} }

View File

@ -71,6 +71,7 @@ public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSe
return theMap.remove(o) == ConcurrentHashSet.dummy; return theMap.remove(o) == ConcurrentHashSet.dummy;
} }
@Override
public boolean addIfAbsent(final E o) { public boolean addIfAbsent(final E o) {
Object obj = theMap.putIfAbsent(o, ConcurrentHashSet.dummy); Object obj = theMap.putIfAbsent(o, ConcurrentHashSet.dummy);

View File

@ -42,6 +42,7 @@ public class DefaultSensitiveStringCodec implements SensitiveDataCodec<String> {
private byte[] internalKey = "clusterpassword".getBytes(); private byte[] internalKey = "clusterpassword".getBytes();
@Override
public String decode(Object secret) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { public String decode(Object secret) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
SecretKeySpec key = new SecretKeySpec(internalKey, "Blowfish"); SecretKeySpec key = new SecretKeySpec(internalKey, "Blowfish");
@ -77,6 +78,7 @@ public class DefaultSensitiveStringCodec implements SensitiveDataCodec<String> {
return n.toString(16); return n.toString(16);
} }
@Override
public void init(Map<String, String> params) { public void init(Map<String, String> params) {
String key = params.get("key"); String key = params.get("key");
if (key != null) { if (key != null) {

View File

@ -54,6 +54,7 @@ public class FactoryFinder {
final ConcurrentMap<String, Class> classMap = new ConcurrentHashMap<String, Class>(); final ConcurrentMap<String, Class> classMap = new ConcurrentHashMap<String, Class>();
@Override
public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
Class clazz = classMap.get(path); Class clazz = classMap.get(path);
if (clazz == null) { if (clazz == null) {

View File

@ -49,6 +49,7 @@ public class PasswordMaskingUtil {
// load class // load class
codecInstance = AccessController.doPrivileged(new PrivilegedAction<SensitiveDataCodec<String>>() { codecInstance = AccessController.doPrivileged(new PrivilegedAction<SensitiveDataCodec<String>>() {
@Override
public SensitiveDataCodec<String> run() { public SensitiveDataCodec<String> run() {
ClassLoader loader = Thread.currentThread().getContextClassLoader(); ClassLoader loader = Thread.currentThread().getContextClassLoader();
try { try {

View File

@ -279,6 +279,7 @@ public final class UUIDGenerator {
for (final NetworkInterface networkInterface : ifaces) { for (final NetworkInterface networkInterface : ifaces) {
tasks.add(new Callable<byte[]>() { tasks.add(new Callable<byte[]>() {
@Override
public byte[] call() throws Exception { public byte[] call() throws Exception {
boolean up = (Boolean) isUpMethod.invoke(networkInterface); boolean up = (Boolean) isUpMethod.invoke(networkInterface);
boolean loopback = (Boolean) isLoopbackMethod.invoke(networkInterface); boolean loopback = (Boolean) isLoopbackMethod.invoke(networkInterface);

View File

@ -34,6 +34,7 @@ public class ReferenceCounterTest extends Assert {
final AtomicInteger counts = new AtomicInteger(0); final AtomicInteger counts = new AtomicInteger(0);
volatile Thread lastThreadUsed; volatile Thread lastThreadUsed;
@Override
public void run() { public void run() {
counts.incrementAndGet(); counts.incrementAndGet();
latch.countDown(); latch.countDown();
@ -83,6 +84,7 @@ public class ReferenceCounterTest extends Assert {
for (int i = 0; i < t.length; i++) { for (int i = 0; i < t.length; i++) {
t[i] = new Thread() { t[i] = new Thread() {
@Override
public void run() { public void run() {
ref.increment(); ref.increment();
} }
@ -96,6 +98,7 @@ public class ReferenceCounterTest extends Assert {
for (int i = 0; i < t.length; i++) { for (int i = 0; i < t.length; i++) {
t[i] = new Thread() { t[i] = new Thread() {
@Override
public void run() { public void run() {
ref.decrement(); ref.decrement();
} }

View File

@ -46,6 +46,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
this.channelName = channelName; this.channelName = channelName;
} }
@Override
public void broadcast(final byte[] data) throws Exception { public void broadcast(final byte[] data) throws Exception {
if (broadcastOpened) { if (broadcastOpened) {
org.jgroups.Message msg = new org.jgroups.Message(); org.jgroups.Message msg = new org.jgroups.Message();
@ -56,6 +57,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
} }
} }
@Override
public byte[] receiveBroadcast() throws Exception { public byte[] receiveBroadcast() throws Exception {
if (clientOpened) { if (clientOpened) {
return receiver.receiveBroadcast(); return receiver.receiveBroadcast();
@ -65,6 +67,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
} }
} }
@Override
public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception { public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception {
if (clientOpened) { if (clientOpened) {
return receiver.receiveBroadcast(time, unit); return receiver.receiveBroadcast(time, unit);
@ -74,6 +77,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
} }
} }
@Override
public synchronized void openClient() throws Exception { public synchronized void openClient() throws Exception {
if (clientOpened) { if (clientOpened) {
return; return;
@ -84,6 +88,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
clientOpened = true; clientOpened = true;
} }
@Override
public synchronized void openBroadcaster() throws Exception { public synchronized void openBroadcaster() throws Exception {
if (broadcastOpened) if (broadcastOpened)
return; return;
@ -102,6 +107,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
channel.connect(); channel.connect();
} }
@Override
public synchronized void close(boolean isBroadcast) throws Exception { public synchronized void close(boolean isBroadcast) throws Exception {
if (isBroadcast) { if (isBroadcast) {
broadcastOpened = false; broadcastOpened = false;

View File

@ -32,6 +32,7 @@ public final class JGroupsFileBroadcastEndpoint extends JGroupsBroadcastEndpoint
this.file = file; this.file = file;
} }
@Override
public JChannel createChannel() throws Exception { public JChannel createChannel() throws Exception {
URL configURL = Thread.currentThread().getContextClassLoader().getResource(file); URL configURL = Thread.currentThread().getContextClassLoader().getResource(file);

View File

@ -50,6 +50,7 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
public UDPBroadcastEndpointFactory() { public UDPBroadcastEndpointFactory() {
} }
@Override
public BroadcastEndpoint createBroadcastEndpoint() throws Exception { public BroadcastEndpoint createBroadcastEndpoint() throws Exception {
return new UDPBroadcastEndpoint().setGroupAddress(groupAddress != null ? InetAddress.getByName(groupAddress) : null).setGroupPort(groupPort).setLocalBindAddress(localBindAddress != null ? InetAddress.getByName(localBindAddress) : null).setLocalBindPort(localBindPort); return new UDPBroadcastEndpoint().setGroupAddress(groupAddress != null ? InetAddress.getByName(groupAddress) : null).setGroupPort(groupPort).setLocalBindAddress(localBindAddress != null ? InetAddress.getByName(localBindAddress) : null).setLocalBindPort(localBindPort);
} }
@ -135,11 +136,13 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
return this; return this;
} }
@Override
public void broadcast(byte[] data) throws Exception { public void broadcast(byte[] data) throws Exception {
DatagramPacket packet = new DatagramPacket(data, data.length, groupAddress, groupPort); DatagramPacket packet = new DatagramPacket(data, data.length, groupAddress, groupPort);
broadcastingSocket.send(packet); broadcastingSocket.send(packet);
} }
@Override
public byte[] receiveBroadcast() throws Exception { public byte[] receiveBroadcast() throws Exception {
final byte[] data = new byte[65535]; final byte[] data = new byte[65535];
final DatagramPacket packet = new DatagramPacket(data, data.length); final DatagramPacket packet = new DatagramPacket(data, data.length);
@ -162,12 +165,14 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
return data; return data;
} }
@Override
public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception { public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception {
// We just use the regular method on UDP, there's no timeout support // We just use the regular method on UDP, there's no timeout support
// and this is basically for tests only // and this is basically for tests only
return receiveBroadcast(); return receiveBroadcast();
} }
@Override
public void openBroadcaster() throws Exception { public void openBroadcaster() throws Exception {
if (localBindPort != -1) { if (localBindPort != -1) {
broadcastingSocket = new DatagramSocket(localBindPort, localAddress); broadcastingSocket = new DatagramSocket(localBindPort, localAddress);
@ -196,6 +201,7 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
open = true; open = true;
} }
@Override
public void openClient() throws Exception { public void openClient() throws Exception {
// HORNETQ-874 // HORNETQ-874
if (checkForLinux() || checkForSolaris() || checkForHp()) { if (checkForLinux() || checkForSolaris() || checkForHp()) {
@ -224,6 +230,7 @@ public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFacto
} }
//@Todo: using isBroadcast to share endpoint between broadcast and receiving //@Todo: using isBroadcast to share endpoint between broadcast and receiving
@Override
public void close(boolean isBroadcast) throws Exception { public void close(boolean isBroadcast) throws Exception {
open = false; open = false;

View File

@ -111,6 +111,7 @@ public interface ClientConsumer extends AutoCloseable {
* *
* @throws ActiveMQException * @throws ActiveMQException
*/ */
@Override
void close() throws ActiveMQException; void close() throws ActiveMQException;
/** /**

View File

@ -125,111 +125,133 @@ public interface ClientMessage extends Message {
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putBooleanProperty(SimpleString key, boolean value); ClientMessage putBooleanProperty(SimpleString key, boolean value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putBooleanProperty(String key, boolean value); ClientMessage putBooleanProperty(String key, boolean value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putByteProperty(SimpleString key, byte value); ClientMessage putByteProperty(SimpleString key, byte value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putByteProperty(String key, byte value); ClientMessage putByteProperty(String key, byte value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putBytesProperty(SimpleString key, byte[] value); ClientMessage putBytesProperty(SimpleString key, byte[] value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putBytesProperty(String key, byte[] value); ClientMessage putBytesProperty(String key, byte[] value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putShortProperty(SimpleString key, short value); ClientMessage putShortProperty(SimpleString key, short value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putShortProperty(String key, short value); ClientMessage putShortProperty(String key, short value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putCharProperty(SimpleString key, char value); ClientMessage putCharProperty(SimpleString key, char value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putCharProperty(String key, char value); ClientMessage putCharProperty(String key, char value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putIntProperty(SimpleString key, int value); ClientMessage putIntProperty(SimpleString key, int value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putIntProperty(String key, int value); ClientMessage putIntProperty(String key, int value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putLongProperty(SimpleString key, long value); ClientMessage putLongProperty(SimpleString key, long value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putLongProperty(String key, long value); ClientMessage putLongProperty(String key, long value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putFloatProperty(SimpleString key, float value); ClientMessage putFloatProperty(SimpleString key, float value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putFloatProperty(String key, float value); ClientMessage putFloatProperty(String key, float value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putDoubleProperty(SimpleString key, double value); ClientMessage putDoubleProperty(SimpleString key, double value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putDoubleProperty(String key, double value); ClientMessage putDoubleProperty(String key, double value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putStringProperty(SimpleString key, SimpleString value); ClientMessage putStringProperty(SimpleString key, SimpleString value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage putStringProperty(String key, String value); ClientMessage putStringProperty(String key, String value);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage writeBodyBufferBytes(byte[] bytes); ClientMessage writeBodyBufferBytes(byte[] bytes);
/** /**
* Overridden from {@link Message} to enable fluent API * Overridden from {@link Message} to enable fluent API
*/ */
@Override
ClientMessage writeBodyBufferString(String string); ClientMessage writeBodyBufferString(String string);
} }

View File

@ -124,6 +124,7 @@ public interface ClientProducer extends AutoCloseable {
* *
* @throws ActiveMQException if an exception occurs while closing the producer * @throws ActiveMQException if an exception occurs while closing the producer
*/ */
@Override
void close() throws ActiveMQException; void close() throws ActiveMQException;
/** /**

View File

@ -145,6 +145,7 @@ public interface ClientSession extends XAResource, AutoCloseable {
* *
* @throws ActiveMQException if an exception occurs while closing the session * @throws ActiveMQException if an exception occurs while closing the session
*/ */
@Override
void close() throws ActiveMQException; void close() throws ActiveMQException;
/** /**

View File

@ -138,6 +138,7 @@ public interface ClientSessionFactory extends AutoCloseable {
/** /**
* Closes this factory and any session created by it. * Closes this factory and any session created by it.
*/ */
@Override
void close(); void close();
/** /**

View File

@ -722,6 +722,7 @@ public interface ServerLocator extends AutoCloseable {
/** /**
* Closes this factory and release all its resources * Closes this factory and release all its resources
*/ */
@Override
void close(); void close();
/** /**

View File

@ -25,6 +25,7 @@ public final class FirstElementConnectionLoadBalancingPolicy implements Connecti
* @param max param is ignored * @param max param is ignored
* @return 0 * @return 0
*/ */
@Override
public int select(final int max) { public int select(final int max) {
return 0; return 0;
} }

View File

@ -32,6 +32,7 @@ public final class RandomConnectionLoadBalancingPolicy implements ConnectionLoad
* @param max the upper limit of the random number selection * @param max the upper limit of the random number selection
* @see java.util.Random#nextInt(int) * @see java.util.Random#nextInt(int)
*/ */
@Override
public int select(final int max) { public int select(final int max) {
return random.getRandom().nextInt(max); return random.getRandom().nextInt(max);
} }

View File

@ -30,6 +30,7 @@ public final class RandomStickyConnectionLoadBalancingPolicy implements Connecti
/** /**
* @see java.util.Random#nextInt(int) * @see java.util.Random#nextInt(int)
*/ */
@Override
public int select(final int max) { public int select(final int max) {
if (pos == -1) { if (pos == -1) {
pos = random.getRandom().nextInt(max); pos = random.getRandom().nextInt(max);

View File

@ -37,6 +37,7 @@ public final class RoundRobinConnectionLoadBalancingPolicy implements Connection
private int pos; private int pos;
@Override
public int select(final int max) { public int select(final int max) {
if (first) { if (first) {
// We start on a random one // We start on a random one

View File

@ -47,6 +47,7 @@ public enum CoreNotificationType implements NotificationType {
this.value = value; this.value = value;
} }
@Override
public int getType() { public int getType() {
return value; return value;
} }

View File

@ -38,14 +38,17 @@ public class AddressQueryImpl implements ClientSession.AddressQuery {
this.autoCreateJmsQueues = autoCreateJmsQueues; this.autoCreateJmsQueues = autoCreateJmsQueues;
} }
@Override
public List<SimpleString> getQueueNames() { public List<SimpleString> getQueueNames() {
return queueNames; return queueNames;
} }
@Override
public boolean isExists() { public boolean isExists() {
return exists; return exists;
} }
@Override
public boolean isAutoCreateJmsQueues() { public boolean isAutoCreateJmsQueues() {
return autoCreateJmsQueues; return autoCreateJmsQueues;
} }

View File

@ -175,6 +175,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
// ClientConsumer implementation // ClientConsumer implementation
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@Override
public ConsumerContext getConsumerContext() { public ConsumerContext getConsumerContext() {
return consumerContext; return consumerContext;
} }
@ -348,6 +349,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
} }
} }
@Override
public ClientMessage receive(final long timeout) throws ActiveMQException { public ClientMessage receive(final long timeout) throws ActiveMQException {
ClientMessage msg = receive(timeout, false); ClientMessage msg = receive(timeout, false);
@ -358,14 +360,17 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
return msg; return msg;
} }
@Override
public ClientMessage receive() throws ActiveMQException { public ClientMessage receive() throws ActiveMQException {
return receive(0, false); return receive(0, false);
} }
@Override
public ClientMessage receiveImmediate() throws ActiveMQException { public ClientMessage receiveImmediate() throws ActiveMQException {
return receive(0, true); return receive(0, true);
} }
@Override
public MessageHandler getMessageHandler() throws ActiveMQException { public MessageHandler getMessageHandler() throws ActiveMQException {
checkClosed(); checkClosed();
@ -374,6 +379,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
// Must be synchronized since messages may be arriving while handler is being set and might otherwise end // Must be synchronized since messages may be arriving while handler is being set and might otherwise end
// up not queueing enough executors - so messages get stranded // up not queueing enough executors - so messages get stranded
@Override
public synchronized ClientConsumerImpl setMessageHandler(final MessageHandler theHandler) throws ActiveMQException { public synchronized ClientConsumerImpl setMessageHandler(final MessageHandler theHandler) throws ActiveMQException {
checkClosed(); checkClosed();
@ -401,6 +407,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
return this; return this;
} }
@Override
public void close() throws ActiveMQException { public void close() throws ActiveMQException {
doCleanUp(true); doCleanUp(true);
} }
@ -411,6 +418,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
* @param future the future to run once the onMessage Thread has completed * @param future the future to run once the onMessage Thread has completed
* @throws ActiveMQException * @throws ActiveMQException
*/ */
@Override
public Thread prepareForClose(final FutureLatch future) throws ActiveMQException { public Thread prepareForClose(final FutureLatch future) throws ActiveMQException {
closing = true; closing = true;
@ -427,6 +435,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
return onMessageThread; return onMessageThread;
} }
@Override
public void cleanUp() { public void cleanUp() {
try { try {
doCleanUp(false); doCleanUp(false);
@ -436,10 +445,12 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
} }
} }
@Override
public boolean isClosed() { public boolean isClosed() {
return closed; return closed;
} }
@Override
public void stop(final boolean waitForOnMessage) throws ActiveMQException { public void stop(final boolean waitForOnMessage) throws ActiveMQException {
waitForOnMessageToComplete(waitForOnMessage); waitForOnMessageToComplete(waitForOnMessage);
@ -457,6 +468,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
} }
} }
@Override
public void clearAtFailover() { public void clearAtFailover() {
clearBuffer(); clearBuffer();
@ -474,12 +486,14 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
ackIndividually = false; ackIndividually = false;
} }
@Override
public synchronized void start() { public synchronized void start() {
stopped = false; stopped = false;
requeueExecutors(); requeueExecutors();
} }
@Override
public Exception getLastException() { public Exception getLastException() {
return lastException; return lastException;
} }
@ -487,22 +501,27 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
// ClientConsumerInternal implementation // ClientConsumerInternal implementation
// -------------------------------------------------------------- // --------------------------------------------------------------
@Override
public ClientSession.QueueQuery getQueueInfo() { public ClientSession.QueueQuery getQueueInfo() {
return queueInfo; return queueInfo;
} }
@Override
public SimpleString getFilterString() { public SimpleString getFilterString() {
return filterString; return filterString;
} }
@Override
public SimpleString getQueueName() { public SimpleString getQueueName() {
return queueName; return queueName;
} }
@Override
public boolean isBrowseOnly() { public boolean isBrowseOnly() {
return browseOnly; return browseOnly;
} }
@Override
public synchronized void handleMessage(final ClientMessageInternal message) throws Exception { public synchronized void handleMessage(final ClientMessageInternal message) throws Exception {
if (closing) { if (closing) {
// This is ok - we just ignore the message // This is ok - we just ignore the message
@ -586,6 +605,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
handleRegularMessage(largeMessage); handleRegularMessage(largeMessage);
} }
@Override
public synchronized void handleLargeMessage(final ClientLargeMessageInternal clientLargeMessage, public synchronized void handleLargeMessage(final ClientLargeMessageInternal clientLargeMessage,
long largeMessageSize) throws Exception { long largeMessageSize) throws Exception {
if (closing) { if (closing) {
@ -617,6 +637,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
handleRegularMessage(clientLargeMessage); handleRegularMessage(clientLargeMessage);
} }
@Override
public synchronized void handleLargeMessageContinuation(final byte[] chunk, public synchronized void handleLargeMessageContinuation(final byte[] chunk,
final int flowControlSize, final int flowControlSize,
final boolean isContinues) throws Exception { final boolean isContinues) throws Exception {
@ -634,6 +655,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
} }
} }
@Override
public void clear(boolean waitForOnMessage) throws ActiveMQException { public void clear(boolean waitForOnMessage) throws ActiveMQException {
synchronized (this) { synchronized (this) {
// Need to send credits for the messages in the buffer // Need to send credits for the messages in the buffer
@ -681,14 +703,17 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
} }
} }
@Override
public int getClientWindowSize() { public int getClientWindowSize() {
return clientWindowSize; return clientWindowSize;
} }
@Override
public int getBufferSize() { public int getBufferSize() {
return buffer.size(); return buffer.size();
} }
@Override
public void acknowledge(final ClientMessage message) throws ActiveMQException { public void acknowledge(final ClientMessage message) throws ActiveMQException {
ClientMessageInternal cmi = (ClientMessageInternal) message; ClientMessageInternal cmi = (ClientMessageInternal) message;
@ -707,6 +732,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
} }
} }
@Override
public void individualAcknowledge(ClientMessage message) throws ActiveMQException { public void individualAcknowledge(ClientMessage message) throws ActiveMQException {
if (lastAckedMessage != null) { if (lastAckedMessage != null) {
flushAcks(); flushAcks();
@ -715,6 +741,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
session.individualAcknowledge(this, message); session.individualAcknowledge(this, message);
} }
@Override
public void flushAcks() throws ActiveMQException { public void flushAcks() throws ActiveMQException {
if (lastAckedMessage != null) { if (lastAckedMessage != null) {
doAck(lastAckedMessage); doAck(lastAckedMessage);
@ -727,6 +754,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
* *
* @param discountSlowConsumer When dealing with slowConsumers, we need to discount one credit that was pre-sent when the first receive was called. For largeMessage that is only done at the latest packet * @param discountSlowConsumer When dealing with slowConsumers, we need to discount one credit that was pre-sent when the first receive was called. For largeMessage that is only done at the latest packet
*/ */
@Override
public void flowControl(final int messageBytes, final boolean discountSlowConsumer) throws ActiveMQException { public void flowControl(final int messageBytes, final boolean discountSlowConsumer) throws ActiveMQException {
if (clientWindowSize >= 0) { if (clientWindowSize >= 0) {
creditsToSend += messageBytes; creditsToSend += messageBytes;
@ -803,6 +831,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
// If resetting a slow consumer, we need to wait the execution // If resetting a slow consumer, we need to wait the execution
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
flowControlExecutor.execute(new Runnable() { flowControlExecutor.execute(new Runnable() {
@Override
public void run() { public void run() {
latch.countDown(); latch.countDown();
} }
@ -837,6 +866,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
private void sendCredits(final int credits) { private void sendCredits(final int credits) {
pendingFlowControl.countUp(); pendingFlowControl.countUp();
flowControlExecutor.execute(new Runnable() { flowControlExecutor.execute(new Runnable() {
@Override
public void run() { public void run() {
try { try {
sessionContext.sendConsumerCredits(ClientConsumerImpl.this, credits); sessionContext.sendConsumerCredits(ClientConsumerImpl.this, credits);
@ -918,6 +948,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
ActiveMQClientLogger.LOGGER.trace("Calling handler.onMessage"); ActiveMQClientLogger.LOGGER.trace("Calling handler.onMessage");
} }
final ClassLoader originalLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { final ClassLoader originalLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() { public ClassLoader run() {
ClassLoader originalLoader = Thread.currentThread().getContextClassLoader(); ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
@ -934,6 +965,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
finally { finally {
try { try {
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
Thread.currentThread().setContextClassLoader(originalLoader); Thread.currentThread().setContextClassLoader(originalLoader);
return null; return null;
@ -1040,6 +1072,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
private class Runner implements Runnable { private class Runner implements Runnable {
@Override
public void run() { public void run() {
try { try {
callOnMessage(); callOnMessage();

View File

@ -41,6 +41,7 @@ public final class ClientLargeMessageImpl extends ClientMessageImpl implements C
/** /**
* @param largeMessageSize the largeMessageSize to set * @param largeMessageSize the largeMessageSize to set
*/ */
@Override
public void setLargeMessageSize(long largeMessageSize) { public void setLargeMessageSize(long largeMessageSize) {
this.largeMessageSize = largeMessageSize; this.largeMessageSize = largeMessageSize;
} }
@ -74,10 +75,12 @@ public final class ClientLargeMessageImpl extends ClientMessageImpl implements C
return true; return true;
} }
@Override
public void setLargeMessageController(final LargeMessageController controller) { public void setLargeMessageController(final LargeMessageController controller) {
largeMessageController = controller; largeMessageController = controller;
} }
@Override
public void checkCompletion() throws ActiveMQException { public void checkCompletion() throws ActiveMQException {
checkBuffer(); checkBuffer();
} }
@ -100,6 +103,7 @@ public final class ClientLargeMessageImpl extends ClientMessageImpl implements C
return getLongProperty(Message.HDR_LARGE_BODY_SIZE).intValue(); return getLongProperty(Message.HDR_LARGE_BODY_SIZE).intValue();
} }
@Override
public LargeMessageController getLargeMessageController() { public LargeMessageController getLargeMessageController() {
return largeMessageController; return largeMessageController;
} }

View File

@ -41,6 +41,7 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
this.windowSize = windowSize; this.windowSize = windowSize;
} }
@Override
public synchronized ClientProducerCredits getCredits(final SimpleString address, public synchronized ClientProducerCredits getCredits(final SimpleString address,
final boolean anon, final boolean anon,
SessionContext context) { SessionContext context) {
@ -84,6 +85,7 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
} }
} }
@Override
public synchronized void returnCredits(final SimpleString address) { public synchronized void returnCredits(final SimpleString address) {
ClientProducerCredits credits = producerCredits.get(address); ClientProducerCredits credits = producerCredits.get(address);
@ -92,6 +94,7 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
} }
} }
@Override
public synchronized void receiveCredits(final SimpleString address, final int credits) { public synchronized void receiveCredits(final SimpleString address, final int credits) {
ClientProducerCredits cr = producerCredits.get(address); ClientProducerCredits cr = producerCredits.get(address);
@ -100,6 +103,7 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
} }
} }
@Override
public synchronized void receiveFailCredits(final SimpleString address, int credits) { public synchronized void receiveFailCredits(final SimpleString address, int credits) {
ClientProducerCredits cr = producerCredits.get(address); ClientProducerCredits cr = producerCredits.get(address);
@ -108,12 +112,14 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
} }
} }
@Override
public synchronized void reset() { public synchronized void reset() {
for (ClientProducerCredits credits : producerCredits.values()) { for (ClientProducerCredits credits : producerCredits.values()) {
credits.reset(); credits.reset();
} }
} }
@Override
public synchronized void close() { public synchronized void close() {
windowSize = -1; windowSize = -1;
@ -126,10 +132,12 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
unReferencedCredits.clear(); unReferencedCredits.clear();
} }
@Override
public synchronized int creditsMapSize() { public synchronized int creditsMapSize() {
return producerCredits.size(); return producerCredits.size();
} }
@Override
public synchronized int unReferencedCreditsSize() { public synchronized int unReferencedCreditsSize() {
return unReferencedCredits.size(); return unReferencedCredits.size();
} }
@ -162,35 +170,45 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
static ClientProducerCreditsNoFlowControl instance = new ClientProducerCreditsNoFlowControl(); static ClientProducerCreditsNoFlowControl instance = new ClientProducerCreditsNoFlowControl();
@Override
public void acquireCredits(int credits) throws InterruptedException { public void acquireCredits(int credits) throws InterruptedException {
} }
@Override
public void receiveCredits(int credits) { public void receiveCredits(int credits) {
} }
@Override
public void receiveFailCredits(int credits) { public void receiveFailCredits(int credits) {
} }
@Override
public boolean isBlocked() { public boolean isBlocked() {
return false; return false;
} }
@Override
public void init(SessionContext ctx) { public void init(SessionContext ctx) {
} }
@Override
public void reset() { public void reset() {
} }
@Override
public void close() { public void close() {
} }
@Override
public void incrementRefCount() { public void incrementRefCount() {
} }
@Override
public int decrementRefCount() { public int decrementRefCount() {
return 1; return 1;
} }
@Override
public void releaseOutstanding() { public void releaseOutstanding() {
} }

View File

@ -63,6 +63,7 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
semaphore = new Semaphore(0, false); semaphore = new Semaphore(0, false);
} }
@Override
public void init(SessionContext sessionContext) { public void init(SessionContext sessionContext) {
// We initial request twice as many credits as we request in subsequent requests // We initial request twice as many credits as we request in subsequent requests
// This allows the producer to keep sending as more arrive, minimising pauses // This allows the producer to keep sending as more arrive, minimising pauses
@ -73,6 +74,7 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
this.sessionContext.linkFlowControl(address, this); this.sessionContext.linkFlowControl(address, this);
} }
@Override
public void acquireCredits(final int credits) throws InterruptedException, ActiveMQException { public void acquireCredits(final int credits) throws InterruptedException, ActiveMQException {
checkCredits(credits); checkCredits(credits);
@ -117,6 +119,7 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
} }
} }
@Override
public boolean isBlocked() { public boolean isBlocked() {
return blocked; return blocked;
} }
@ -125,6 +128,7 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
return semaphore.availablePermits(); return semaphore.availablePermits();
} }
@Override
public void receiveCredits(final int credits) { public void receiveCredits(final int credits) {
synchronized (this) { synchronized (this) {
arriving -= credits; arriving -= credits;
@ -133,12 +137,14 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
semaphore.release(credits); semaphore.release(credits);
} }
@Override
public void receiveFailCredits(final int credits) { public void receiveFailCredits(final int credits) {
serverRespondedWithFail = true; serverRespondedWithFail = true;
// receive credits like normal to keep the sender from blocking // receive credits like normal to keep the sender from blocking
receiveCredits(credits); receiveCredits(credits);
} }
@Override
public synchronized void reset() { public synchronized void reset() {
// Any pendingCredits credits from before failover won't arrive, so we re-initialise // Any pendingCredits credits from before failover won't arrive, so we re-initialise
@ -154,6 +160,7 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
checkCredits(Math.max(windowSize * 2, beforeFailure)); checkCredits(Math.max(windowSize * 2, beforeFailure));
} }
@Override
public void close() { public void close() {
// Closing a producer that is blocking should make it return // Closing a producer that is blocking should make it return
closed = true; closed = true;
@ -161,14 +168,17 @@ public class ClientProducerCreditsImpl implements ClientProducerCredits {
semaphore.release(Integer.MAX_VALUE / 2); semaphore.release(Integer.MAX_VALUE / 2);
} }
@Override
public synchronized void incrementRefCount() { public synchronized void incrementRefCount() {
refCount++; refCount++;
} }
@Override
public synchronized int decrementRefCount() { public synchronized int decrementRefCount() {
return --refCount; return --refCount;
} }
@Override
public synchronized void releaseOutstanding() { public synchronized void releaseOutstanding() {
semaphore.drainPermits(); semaphore.drainPermits();
} }

View File

@ -108,22 +108,26 @@ public class ClientProducerImpl implements ClientProducerInternal {
// ClientProducer implementation ---------------------------------------------------------------- // ClientProducer implementation ----------------------------------------------------------------
@Override
public SimpleString getAddress() { public SimpleString getAddress() {
return address; return address;
} }
@Override
public void send(final Message msg) throws ActiveMQException { public void send(final Message msg) throws ActiveMQException {
checkClosed(); checkClosed();
doSend(null, msg, null, false); doSend(null, msg, null, false);
} }
@Override
public void send(final SimpleString address1, final Message msg) throws ActiveMQException { public void send(final SimpleString address1, final Message msg) throws ActiveMQException {
checkClosed(); checkClosed();
doSend(address1, msg, null, false); doSend(address1, msg, null, false);
} }
@Override
public void send(final String address1, final Message message) throws ActiveMQException { public void send(final String address1, final Message message) throws ActiveMQException {
send(SimpleString.toSimpleString(address1), message); send(SimpleString.toSimpleString(address1), message);
} }
@ -150,6 +154,7 @@ public class ClientProducerImpl implements ClientProducerInternal {
send(null, message, handler); send(null, message, handler);
} }
@Override
public synchronized void close() throws ActiveMQException { public synchronized void close() throws ActiveMQException {
if (closed) { if (closed) {
return; return;
@ -158,6 +163,7 @@ public class ClientProducerImpl implements ClientProducerInternal {
doCleanup(); doCleanup();
} }
@Override
public void cleanUp() { public void cleanUp() {
if (closed) { if (closed) {
return; return;
@ -166,24 +172,29 @@ public class ClientProducerImpl implements ClientProducerInternal {
doCleanup(); doCleanup();
} }
@Override
public boolean isClosed() { public boolean isClosed() {
return closed; return closed;
} }
@Override
public boolean isBlockOnDurableSend() { public boolean isBlockOnDurableSend() {
return blockOnDurableSend; return blockOnDurableSend;
} }
@Override
public boolean isBlockOnNonDurableSend() { public boolean isBlockOnNonDurableSend() {
return blockOnNonDurableSend; return blockOnNonDurableSend;
} }
@Override
public int getMaxRate() { public int getMaxRate() {
return rateLimiter == null ? -1 : rateLimiter.getRate(); return rateLimiter == null ? -1 : rateLimiter.getRate();
} }
// Public --------------------------------------------------------------------------------------- // Public ---------------------------------------------------------------------------------------
@Override
public ClientProducerCredits getProducerCredits() { public ClientProducerCredits getProducerCredits() {
return producerCredits; return producerCredits;
} }

View File

@ -227,10 +227,12 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
connectionReadyForWrites = true; connectionReadyForWrites = true;
} }
@Override
public void disableFinalizeCheck() { public void disableFinalizeCheck() {
finalizeCheck = false; finalizeCheck = false;
} }
@Override
public Lock lockFailover() { public Lock lockFailover() {
newFailoverLock.lock(); newFailoverLock.lock();
return newFailoverLock; return newFailoverLock;
@ -244,6 +246,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
} }
@Override
public void connect(final int initialConnectAttempts, public void connect(final int initialConnectAttempts,
final boolean failoverOnInitialConnection) throws ActiveMQException { final boolean failoverOnInitialConnection) throws ActiveMQException {
// Get the connection // Get the connection
@ -259,10 +262,12 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
@Override
public TransportConfiguration getConnectorConfiguration() { public TransportConfiguration getConnectorConfiguration() {
return connectorConfig; return connectorConfig;
} }
@Override
public void setBackupConnector(final TransportConfiguration live, final TransportConfiguration backUp) { public void setBackupConnector(final TransportConfiguration live, final TransportConfiguration backUp) {
Connector localConnector = connector; Connector localConnector = connector;
@ -290,10 +295,12 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
} }
@Override
public Object getBackupConnector() { public Object getBackupConnector() {
return backupConfig; return backupConfig;
} }
@Override
public ClientSession createSession(final String username, public ClientSession createSession(final String username,
final String password, final String password,
final boolean xa, final boolean xa,
@ -304,35 +311,42 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
return createSessionInternal(username, password, xa, autoCommitSends, autoCommitAcks, preAcknowledge, ackBatchSize); return createSessionInternal(username, password, xa, autoCommitSends, autoCommitAcks, preAcknowledge, ackBatchSize);
} }
@Override
public ClientSession createSession(final boolean autoCommitSends, public ClientSession createSession(final boolean autoCommitSends,
final boolean autoCommitAcks, final boolean autoCommitAcks,
final int ackBatchSize) throws ActiveMQException { final int ackBatchSize) throws ActiveMQException {
return createSessionInternal(null, null, false, autoCommitSends, autoCommitAcks, serverLocator.isPreAcknowledge(), ackBatchSize); return createSessionInternal(null, null, false, autoCommitSends, autoCommitAcks, serverLocator.isPreAcknowledge(), ackBatchSize);
} }
@Override
public ClientSession createXASession() throws ActiveMQException { public ClientSession createXASession() throws ActiveMQException {
return createSessionInternal(null, null, true, false, false, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize()); return createSessionInternal(null, null, true, false, false, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize());
} }
@Override
public ClientSession createTransactedSession() throws ActiveMQException { public ClientSession createTransactedSession() throws ActiveMQException {
return createSessionInternal(null, null, false, false, false, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize()); return createSessionInternal(null, null, false, false, false, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize());
} }
@Override
public ClientSession createSession() throws ActiveMQException { public ClientSession createSession() throws ActiveMQException {
return createSessionInternal(null, null, false, true, true, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize()); return createSessionInternal(null, null, false, true, true, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize());
} }
@Override
public ClientSession createSession(final boolean autoCommitSends, public ClientSession createSession(final boolean autoCommitSends,
final boolean autoCommitAcks) throws ActiveMQException { final boolean autoCommitAcks) throws ActiveMQException {
return createSessionInternal(null, null, false, autoCommitSends, autoCommitAcks, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize()); return createSessionInternal(null, null, false, autoCommitSends, autoCommitAcks, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize());
} }
@Override
public ClientSession createSession(final boolean xa, public ClientSession createSession(final boolean xa,
final boolean autoCommitSends, final boolean autoCommitSends,
final boolean autoCommitAcks) throws ActiveMQException { final boolean autoCommitAcks) throws ActiveMQException {
return createSessionInternal(null, null, xa, autoCommitSends, autoCommitAcks, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize()); return createSessionInternal(null, null, xa, autoCommitSends, autoCommitAcks, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize());
} }
@Override
public ClientSession createSession(final boolean xa, public ClientSession createSession(final boolean xa,
final boolean autoCommitSends, final boolean autoCommitSends,
final boolean autoCommitAcks, final boolean autoCommitAcks,
@ -342,11 +356,13 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
// ConnectionLifeCycleListener implementation -------------------------------------------------- // ConnectionLifeCycleListener implementation --------------------------------------------------
@Override
public void connectionCreated(final ActiveMQComponent component, public void connectionCreated(final ActiveMQComponent component,
final Connection connection, final Connection connection,
final String protocol) { final String protocol) {
} }
@Override
public void connectionDestroyed(final Object connectionID) { public void connectionDestroyed(final Object connectionID) {
// The exception has to be created in the same thread where it's being called // The exception has to be created in the same thread where it's being called
// as to avoid a different stack trace cause // as to avoid a different stack trace cause
@ -355,6 +371,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
// It has to use the same executor as the disconnect message is being sent through // It has to use the same executor as the disconnect message is being sent through
closeExecutor.execute(new Runnable() { closeExecutor.execute(new Runnable() {
@Override
public void run() { public void run() {
handleConnectionFailure(connectionID, ex); handleConnectionFailure(connectionID, ex);
} }
@ -362,18 +379,21 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
@Override
public void connectionException(final Object connectionID, final ActiveMQException me) { public void connectionException(final Object connectionID, final ActiveMQException me) {
handleConnectionFailure(connectionID, me); handleConnectionFailure(connectionID, me);
} }
// Must be synchronized to prevent it happening concurrently with failover which can lead to // Must be synchronized to prevent it happening concurrently with failover which can lead to
// inconsistencies // inconsistencies
@Override
public void removeSession(final ClientSessionInternal session, final boolean failingOver) { public void removeSession(final ClientSessionInternal session, final boolean failingOver) {
synchronized (sessions) { synchronized (sessions) {
sessions.remove(session); sessions.remove(session);
} }
} }
@Override
public void connectionReadyForWrites(final Object connectionID, final boolean ready) { public void connectionReadyForWrites(final Object connectionID, final boolean ready) {
synchronized (connectionReadyLock) { synchronized (connectionReadyLock) {
if (connectionReadyForWrites != ready) { if (connectionReadyForWrites != ready) {
@ -385,31 +405,38 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
} }
@Override
public synchronized int numConnections() { public synchronized int numConnections() {
return connection != null ? 1 : 0; return connection != null ? 1 : 0;
} }
@Override
public int numSessions() { public int numSessions() {
return sessions.size(); return sessions.size();
} }
@Override
public void addFailureListener(final SessionFailureListener listener) { public void addFailureListener(final SessionFailureListener listener) {
listeners.add(listener); listeners.add(listener);
} }
@Override
public boolean removeFailureListener(final SessionFailureListener listener) { public boolean removeFailureListener(final SessionFailureListener listener) {
return listeners.remove(listener); return listeners.remove(listener);
} }
@Override
public ClientSessionFactoryImpl addFailoverListener(FailoverEventListener listener) { public ClientSessionFactoryImpl addFailoverListener(FailoverEventListener listener) {
failoverListeners.add(listener); failoverListeners.add(listener);
return this; return this;
} }
@Override
public boolean removeFailoverListener(FailoverEventListener listener) { public boolean removeFailoverListener(FailoverEventListener listener) {
return failoverListeners.remove(listener); return failoverListeners.remove(listener);
} }
@Override
public void causeExit() { public void causeExit() {
clientProtocolManager.stop(); clientProtocolManager.stop();
} }
@ -447,6 +474,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
checkCloseConnection(); checkCloseConnection();
} }
@Override
public void close() { public void close() {
if (closed) { if (closed) {
return; return;
@ -456,6 +484,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
serverLocator.factoryClosed(this); serverLocator.factoryClosed(this);
} }
@Override
public void cleanup() { public void cleanup() {
if (closed) { if (closed) {
return; return;
@ -464,6 +493,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
interruptConnectAndCloseAllSessions(false); interruptConnectAndCloseAllSessions(false);
} }
@Override
public boolean isClosed() { public boolean isClosed() {
return closed || serverLocator.isClosed(); return closed || serverLocator.isClosed();
} }
@ -856,6 +886,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
} }
@Override
public RemotingConnection getConnection() { public RemotingConnection getConnection() {
if (closed) if (closed)
throw new IllegalStateException("ClientSessionFactory is closed!"); throw new IllegalStateException("ClientSessionFactory is closed!");
@ -948,6 +979,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
// else... we will try to instantiate a new one // else... we will try to instantiate a new one
return AccessController.doPrivileged(new PrivilegedAction<ConnectorFactory>() { return AccessController.doPrivileged(new PrivilegedAction<ConnectorFactory>() {
@Override
public ConnectorFactory run() { public ConnectorFactory run() {
return (ConnectorFactory) ClassloadingUtil.newInstanceFromClassLoader(connectorFactoryClassName); return (ConnectorFactory) ClassloadingUtil.newInstanceFromClassLoader(connectorFactoryClassName);
} }
@ -966,6 +998,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
// Must be executed on new thread since cannot block the Netty thread for a long time and fail // Must be executed on new thread since cannot block the Netty thread for a long time and fail
// can cause reconnect loop // can cause reconnect loop
@Override
public void run() { public void run() {
try { try {
CLOSE_RUNNABLES.add(this); CLOSE_RUNNABLES.add(this);
@ -990,10 +1023,12 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
@Override
public void setReconnectAttempts(final int attempts) { public void setReconnectAttempts(final int attempts) {
reconnectAttempts = attempts; reconnectAttempts = attempts;
} }
@Override
public Object getConnector() { public Object getConnector() {
return connector; return connector;
} }
@ -1117,6 +1152,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
private class DelegatingBufferHandler implements BufferHandler { private class DelegatingBufferHandler implements BufferHandler {
@Override
public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) {
RemotingConnection theConn = connection; RemotingConnection theConn = connection;
@ -1162,6 +1198,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
pingRunnable = new WeakReference<PingRunnable>(runnable); pingRunnable = new WeakReference<PingRunnable>(runnable);
} }
@Override
public void run() { public void run() {
PingRunnable runnable = pingRunnable.get(); PingRunnable runnable = pingRunnable.get();
@ -1180,6 +1217,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
private long lastCheck = System.currentTimeMillis(); private long lastCheck = System.currentTimeMillis();
@Override
public synchronized void run() { public synchronized void run() {
if (cancelled || stopPingingAfterOne && !first) { if (cancelled || stopPingingAfterOne && !first) {
return; return;
@ -1200,6 +1238,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
threadPool.execute(new Runnable() { threadPool.execute(new Runnable() {
// Must be executed on different thread // Must be executed on different thread
@Override
public void run() { public void run() {
connection.fail(me); connection.fail(me);
} }

View File

@ -234,28 +234,33 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// ClientSession implementation // ClientSession implementation
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@Override
public void createQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { public void createQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException {
internalCreateQueue(address, queueName, null, false, false); internalCreateQueue(address, queueName, null, false, false);
} }
@Override
public void createQueue(final SimpleString address, public void createQueue(final SimpleString address,
final SimpleString queueName, final SimpleString queueName,
final boolean durable) throws ActiveMQException { final boolean durable) throws ActiveMQException {
internalCreateQueue(address, queueName, null, durable, false); internalCreateQueue(address, queueName, null, durable, false);
} }
@Override
public void createQueue(final String address, public void createQueue(final String address,
final String queueName, final String queueName,
final boolean durable) throws ActiveMQException { final boolean durable) throws ActiveMQException {
createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), durable); createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), durable);
} }
@Override
public void createSharedQueue(SimpleString address, public void createSharedQueue(SimpleString address,
SimpleString queueName, SimpleString queueName,
boolean durable) throws ActiveMQException { boolean durable) throws ActiveMQException {
createSharedQueue(address, queueName, null, durable); createSharedQueue(address, queueName, null, durable);
} }
@Override
public void createSharedQueue(SimpleString address, public void createSharedQueue(SimpleString address,
SimpleString queueName, SimpleString queueName,
SimpleString filterString, SimpleString filterString,
@ -273,6 +278,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
@Override
public void createQueue(final SimpleString address, public void createQueue(final SimpleString address,
final SimpleString queueName, final SimpleString queueName,
final SimpleString filterString, final SimpleString filterString,
@ -280,6 +286,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
internalCreateQueue(address, queueName, filterString, durable, false); internalCreateQueue(address, queueName, filterString, durable, false);
} }
@Override
public void createQueue(final String address, public void createQueue(final String address,
final String queueName, final String queueName,
final String filterString, final String filterString,
@ -287,26 +294,31 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable); createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), durable);
} }
@Override
public void createTemporaryQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { public void createTemporaryQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException {
internalCreateQueue(address, queueName, null, false, true); internalCreateQueue(address, queueName, null, false, true);
} }
@Override
public void createTemporaryQueue(final String address, final String queueName) throws ActiveMQException { public void createTemporaryQueue(final String address, final String queueName) throws ActiveMQException {
internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), null, false, true); internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), null, false, true);
} }
@Override
public void createTemporaryQueue(final SimpleString address, public void createTemporaryQueue(final SimpleString address,
final SimpleString queueName, final SimpleString queueName,
final SimpleString filter) throws ActiveMQException { final SimpleString filter) throws ActiveMQException {
internalCreateQueue(address, queueName, filter, false, true); internalCreateQueue(address, queueName, filter, false, true);
} }
@Override
public void createTemporaryQueue(final String address, public void createTemporaryQueue(final String address,
final String queueName, final String queueName,
final String filter) throws ActiveMQException { final String filter) throws ActiveMQException {
internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), false, true); internalCreateQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filter), false, true);
} }
@Override
public void deleteQueue(final SimpleString queueName) throws ActiveMQException { public void deleteQueue(final SimpleString queueName) throws ActiveMQException {
checkClosed(); checkClosed();
@ -319,10 +331,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void deleteQueue(final String queueName) throws ActiveMQException { public void deleteQueue(final String queueName) throws ActiveMQException {
deleteQueue(SimpleString.toSimpleString(queueName)); deleteQueue(SimpleString.toSimpleString(queueName));
} }
@Override
public QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException { public QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException {
checkClosed(); checkClosed();
@ -336,50 +350,60 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
@Override
public AddressQuery addressQuery(final SimpleString address) throws ActiveMQException { public AddressQuery addressQuery(final SimpleString address) throws ActiveMQException {
checkClosed(); checkClosed();
return sessionContext.addressQuery(address); return sessionContext.addressQuery(address);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName) throws ActiveMQException { public ClientConsumer createConsumer(final SimpleString queueName) throws ActiveMQException {
return createConsumer(queueName, null, false); return createConsumer(queueName, null, false);
} }
@Override
public ClientConsumer createConsumer(final String queueName) throws ActiveMQException { public ClientConsumer createConsumer(final String queueName) throws ActiveMQException {
return createConsumer(SimpleString.toSimpleString(queueName)); return createConsumer(SimpleString.toSimpleString(queueName));
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final SimpleString filterString) throws ActiveMQException { final SimpleString filterString) throws ActiveMQException {
return createConsumer(queueName, filterString, consumerWindowSize, consumerMaxRate, false); return createConsumer(queueName, filterString, consumerWindowSize, consumerMaxRate, false);
} }
@Override
public void createQueue(final String address, final String queueName) throws ActiveMQException { public void createQueue(final String address, final String queueName) throws ActiveMQException {
createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName)); createQueue(SimpleString.toSimpleString(address), SimpleString.toSimpleString(queueName));
} }
@Override
public ClientConsumer createConsumer(final String queueName, final String filterString) throws ActiveMQException { public ClientConsumer createConsumer(final String queueName, final String filterString) throws ActiveMQException {
return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString)); return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString));
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final SimpleString filterString, final SimpleString filterString,
final boolean browseOnly) throws ActiveMQException { final boolean browseOnly) throws ActiveMQException {
return createConsumer(queueName, filterString, consumerWindowSize, consumerMaxRate, browseOnly); return createConsumer(queueName, filterString, consumerWindowSize, consumerMaxRate, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final boolean browseOnly) throws ActiveMQException { final boolean browseOnly) throws ActiveMQException {
return createConsumer(queueName, null, consumerWindowSize, consumerMaxRate, browseOnly); return createConsumer(queueName, null, consumerWindowSize, consumerMaxRate, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final String queueName, public ClientConsumer createConsumer(final String queueName,
final String filterString, final String filterString,
final boolean browseOnly) throws ActiveMQException { final boolean browseOnly) throws ActiveMQException {
return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), browseOnly); return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), browseOnly);
} }
@Override
public ClientConsumer createConsumer(final String queueName, final boolean browseOnly) throws ActiveMQException { public ClientConsumer createConsumer(final String queueName, final boolean browseOnly) throws ActiveMQException {
return createConsumer(SimpleString.toSimpleString(queueName), null, browseOnly); return createConsumer(SimpleString.toSimpleString(queueName), null, browseOnly);
} }
@ -394,6 +418,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
* the client during that period, so failover won't occur. If we want direct consumers we need to * the client during that period, so failover won't occur. If we want direct consumers we need to
* rethink how they work. * rethink how they work.
*/ */
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final SimpleString filterString, final SimpleString filterString,
final int windowSize, final int windowSize,
@ -402,6 +427,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return internalCreateConsumer(queueName, filterString, windowSize, maxRate, browseOnly); return internalCreateConsumer(queueName, filterString, windowSize, maxRate, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final String queueName, public ClientConsumer createConsumer(final String queueName,
final String filterString, final String filterString,
final int windowSize, final int windowSize,
@ -410,18 +436,22 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), windowSize, maxRate, browseOnly); return createConsumer(SimpleString.toSimpleString(queueName), SimpleString.toSimpleString(filterString), windowSize, maxRate, browseOnly);
} }
@Override
public ClientProducer createProducer() throws ActiveMQException { public ClientProducer createProducer() throws ActiveMQException {
return createProducer((SimpleString) null); return createProducer((SimpleString) null);
} }
@Override
public ClientProducer createProducer(final SimpleString address) throws ActiveMQException { public ClientProducer createProducer(final SimpleString address) throws ActiveMQException {
return createProducer(address, producerMaxRate); return createProducer(address, producerMaxRate);
} }
@Override
public ClientProducer createProducer(final String address) throws ActiveMQException { public ClientProducer createProducer(final String address) throws ActiveMQException {
return createProducer(SimpleString.toSimpleString(address)); return createProducer(SimpleString.toSimpleString(address));
} }
@Override
public ClientProducer createProducer(final SimpleString address, final int maxRate) throws ActiveMQException { public ClientProducer createProducer(final SimpleString address, final int maxRate) throws ActiveMQException {
return internalCreateProducer(address, maxRate); return internalCreateProducer(address, maxRate);
} }
@ -430,6 +460,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return createProducer(SimpleString.toSimpleString(address), rate); return createProducer(SimpleString.toSimpleString(address), rate);
} }
@Override
public XAResource getXAResource() { public XAResource getXAResource() {
return this; return this;
} }
@ -444,6 +475,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
throw ActiveMQClientMessageBundle.BUNDLE.txOutcomeUnknown(); throw ActiveMQClientMessageBundle.BUNDLE.txOutcomeUnknown();
} }
@Override
public void commit() throws ActiveMQException { public void commit() throws ActiveMQException {
checkClosed(); checkClosed();
@ -490,14 +522,17 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
workDone = false; workDone = false;
} }
@Override
public boolean isRollbackOnly() { public boolean isRollbackOnly() {
return rollbackOnly; return rollbackOnly;
} }
@Override
public void rollback() throws ActiveMQException { public void rollback() throws ActiveMQException {
rollback(false); rollback(false);
} }
@Override
public void rollback(final boolean isLastMessageAsDelivered) throws ActiveMQException { public void rollback(final boolean isLastMessageAsDelivered) throws ActiveMQException {
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
ActiveMQClientLogger.LOGGER.trace("calling rollback(isLastMessageAsDelivered=" + isLastMessageAsDelivered + ")"); ActiveMQClientLogger.LOGGER.trace("calling rollback(isLastMessageAsDelivered=" + isLastMessageAsDelivered + ")");
@ -532,10 +567,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
rollbackOnly = false; rollbackOnly = false;
} }
@Override
public void markRollbackOnly() { public void markRollbackOnly() {
rollbackOnly = true; rollbackOnly = true;
} }
@Override
public ClientMessage createMessage(final byte type, public ClientMessage createMessage(final byte type,
final boolean durable, final boolean durable,
final long expiration, final long expiration,
@ -544,34 +581,42 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return new ClientMessageImpl(type, durable, expiration, timestamp, priority, initialMessagePacketSize); return new ClientMessageImpl(type, durable, expiration, timestamp, priority, initialMessagePacketSize);
} }
@Override
public ClientMessage createMessage(final byte type, final boolean durable) { public ClientMessage createMessage(final byte type, final boolean durable) {
return this.createMessage(type, durable, 0, System.currentTimeMillis(), (byte) 4); return this.createMessage(type, durable, 0, System.currentTimeMillis(), (byte) 4);
} }
@Override
public ClientMessage createMessage(final boolean durable) { public ClientMessage createMessage(final boolean durable) {
return this.createMessage((byte) 0, durable); return this.createMessage((byte) 0, durable);
} }
@Override
public boolean isClosed() { public boolean isClosed() {
return closed; return closed;
} }
@Override
public boolean isAutoCommitSends() { public boolean isAutoCommitSends() {
return autoCommitSends; return autoCommitSends;
} }
@Override
public boolean isAutoCommitAcks() { public boolean isAutoCommitAcks() {
return autoCommitAcks; return autoCommitAcks;
} }
@Override
public boolean isBlockOnAcknowledge() { public boolean isBlockOnAcknowledge() {
return blockOnAcknowledge; return blockOnAcknowledge;
} }
@Override
public boolean isXA() { public boolean isXA() {
return xa; return xa;
} }
@Override
public void resetIfNeeded() throws ActiveMQException { public void resetIfNeeded() throws ActiveMQException {
if (rollbackOnly) { if (rollbackOnly) {
ActiveMQClientLogger.LOGGER.resettingSessionAfterFailure(); ActiveMQClientLogger.LOGGER.resettingSessionAfterFailure();
@ -579,6 +624,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public ClientSessionImpl start() throws ActiveMQException { public ClientSessionImpl start() throws ActiveMQException {
checkClosed(); checkClosed();
@ -595,6 +641,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return this; return this;
} }
@Override
public void stop() throws ActiveMQException { public void stop() throws ActiveMQException {
stop(true); stop(true);
} }
@ -613,26 +660,32 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void addFailureListener(final SessionFailureListener listener) { public void addFailureListener(final SessionFailureListener listener) {
sessionFactory.addFailureListener(listener); sessionFactory.addFailureListener(listener);
} }
@Override
public boolean removeFailureListener(final SessionFailureListener listener) { public boolean removeFailureListener(final SessionFailureListener listener) {
return sessionFactory.removeFailureListener(listener); return sessionFactory.removeFailureListener(listener);
} }
@Override
public void addFailoverListener(FailoverEventListener listener) { public void addFailoverListener(FailoverEventListener listener) {
sessionFactory.addFailoverListener(listener); sessionFactory.addFailoverListener(listener);
} }
@Override
public boolean removeFailoverListener(FailoverEventListener listener) { public boolean removeFailoverListener(FailoverEventListener listener) {
return sessionFactory.removeFailoverListener(listener); return sessionFactory.removeFailoverListener(listener);
} }
@Override
public int getVersion() { public int getVersion() {
return sessionContext.getServerVersion(); return sessionContext.getServerVersion();
} }
@Override
public boolean isClosing() { public boolean isClosing() {
return inClose; return inClose;
} }
@ -650,10 +703,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// ClientSessionInternal implementation // ClientSessionInternal implementation
// ------------------------------------------------------------ // ------------------------------------------------------------
@Override
public int getMinLargeMessageSize() { public int getMinLargeMessageSize() {
return minLargeMessageSize; return minLargeMessageSize;
} }
@Override
public boolean isCompressLargeMessages() { public boolean isCompressLargeMessages() {
return compressLargeMessages; return compressLargeMessages;
} }
@ -661,10 +716,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
/** /**
* @return the cacheLargeMessageClient * @return the cacheLargeMessageClient
*/ */
@Override
public boolean isCacheLargeMessageClient() { public boolean isCacheLargeMessageClient() {
return cacheLargeMessageClient; return cacheLargeMessageClient;
} }
@Override
public String getName() { public String getName() {
return name; return name;
} }
@ -672,6 +729,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
/** /**
* Acknowledges all messages received by the consumer so far. * Acknowledges all messages received by the consumer so far.
*/ */
@Override
public void acknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException { public void acknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException {
// if we're pre-acknowledging then we don't need to do anything // if we're pre-acknowledging then we don't need to do anything
if (preAcknowledge) { if (preAcknowledge) {
@ -692,6 +750,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void individualAcknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException { public void individualAcknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException {
// if we're pre-acknowledging then we don't need to do anything // if we're pre-acknowledging then we don't need to do anything
if (preAcknowledge) { if (preAcknowledge) {
@ -710,6 +769,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void expire(final ClientConsumer consumer, final Message message) throws ActiveMQException { public void expire(final ClientConsumer consumer, final Message message) throws ActiveMQException {
checkClosed(); checkClosed();
@ -719,30 +779,35 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void addConsumer(final ClientConsumerInternal consumer) { public void addConsumer(final ClientConsumerInternal consumer) {
synchronized (consumers) { synchronized (consumers) {
consumers.put(consumer.getConsumerContext(), consumer); consumers.put(consumer.getConsumerContext(), consumer);
} }
} }
@Override
public void addProducer(final ClientProducerInternal producer) { public void addProducer(final ClientProducerInternal producer) {
synchronized (producers) { synchronized (producers) {
producers.add(producer); producers.add(producer);
} }
} }
@Override
public void removeConsumer(final ClientConsumerInternal consumer) throws ActiveMQException { public void removeConsumer(final ClientConsumerInternal consumer) throws ActiveMQException {
synchronized (consumers) { synchronized (consumers) {
consumers.remove(consumer.getConsumerContext()); consumers.remove(consumer.getConsumerContext());
} }
} }
@Override
public void removeProducer(final ClientProducerInternal producer) { public void removeProducer(final ClientProducerInternal producer) {
synchronized (producers) { synchronized (producers) {
producers.remove(producer); producers.remove(producer);
} }
} }
@Override
public void handleReceiveMessage(final ConsumerContext consumerID, public void handleReceiveMessage(final ConsumerContext consumerID,
final ClientMessageInternal message) throws Exception { final ClientMessageInternal message) throws Exception {
ClientConsumerInternal consumer = getConsumer(consumerID); ClientConsumerInternal consumer = getConsumer(consumerID);
@ -752,6 +817,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void handleReceiveLargeMessage(final ConsumerContext consumerID, public void handleReceiveLargeMessage(final ConsumerContext consumerID,
ClientLargeMessageInternal clientLargeMessage, ClientLargeMessageInternal clientLargeMessage,
long largeMessageSize) throws Exception { long largeMessageSize) throws Exception {
@ -762,6 +828,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void handleReceiveContinuation(final ConsumerContext consumerID, public void handleReceiveContinuation(final ConsumerContext consumerID,
byte[] chunk, byte[] chunk,
int flowControlSize, int flowControlSize,
@ -792,6 +859,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void close() throws ActiveMQException { public void close() throws ActiveMQException {
if (closed) { if (closed) {
ActiveMQClientLogger.LOGGER.debug("Session was already closed, giving up now, this=" + this); ActiveMQClientLogger.LOGGER.debug("Session was already closed, giving up now, this=" + this);
@ -821,6 +889,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
doCleanup(false); doCleanup(false);
} }
@Override
public synchronized void cleanUp(boolean failingOver) throws ActiveMQException { public synchronized void cleanUp(boolean failingOver) throws ActiveMQException {
if (closed) { if (closed) {
return; return;
@ -833,11 +902,13 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
doCleanup(failingOver); doCleanup(failingOver);
} }
@Override
public ClientSessionImpl setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) { public ClientSessionImpl setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) {
sessionContext.setSendAcknowledgementHandler(handler); sessionContext.setSendAcknowledgementHandler(handler);
return this; return this;
} }
@Override
public void preHandleFailover(RemotingConnection connection) { public void preHandleFailover(RemotingConnection connection) {
// We lock the channel to prevent any packets to be added to the re-send // We lock the channel to prevent any packets to be added to the re-send
// cache during the failover process // cache during the failover process
@ -847,6 +918,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// Needs to be synchronized to prevent issues with occurring concurrently with close() // Needs to be synchronized to prevent issues with occurring concurrently with close()
@Override
public void handleFailover(final RemotingConnection backupConnection, ActiveMQException cause) { public void handleFailover(final RemotingConnection backupConnection, ActiveMQException cause) {
synchronized (this) { synchronized (this) {
if (closed) { if (closed) {
@ -947,6 +1019,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
@Override
public void addMetaData(String key, String data) throws ActiveMQException { public void addMetaData(String key, String data) throws ActiveMQException {
synchronized (metadata) { synchronized (metadata) {
metadata.put(key, data); metadata.put(key, data);
@ -955,14 +1028,17 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
sessionContext.addSessionMetadata(key, data); sessionContext.addSessionMetadata(key, data);
} }
@Override
public void addUniqueMetaData(String key, String data) throws ActiveMQException { public void addUniqueMetaData(String key, String data) throws ActiveMQException {
sessionContext.addUniqueMetaData(key, data); sessionContext.addUniqueMetaData(key, data);
} }
@Override
public ClientSessionFactory getSessionFactory() { public ClientSessionFactory getSessionFactory() {
return sessionFactory; return sessionFactory;
} }
@Override
public void setAddress(final Message message, final SimpleString address) { public void setAddress(final Message message, final SimpleString address) {
if (defaultAddress == null) { if (defaultAddress == null) {
defaultAddress = address; defaultAddress = address;
@ -979,48 +1055,58 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void setPacketSize(final int packetSize) { public void setPacketSize(final int packetSize) {
if (packetSize > this.initialMessagePacketSize) { if (packetSize > this.initialMessagePacketSize) {
this.initialMessagePacketSize = (int) (packetSize * 1.2); this.initialMessagePacketSize = (int) (packetSize * 1.2);
} }
} }
@Override
public void workDone() { public void workDone() {
workDone = true; workDone = true;
} }
@Override
public void sendProducerCreditsMessage(final int credits, final SimpleString address) { public void sendProducerCreditsMessage(final int credits, final SimpleString address) {
sessionContext.sendProducerCreditsMessage(credits, address); sessionContext.sendProducerCreditsMessage(credits, address);
} }
@Override
public synchronized ClientProducerCredits getCredits(final SimpleString address, final boolean anon) { public synchronized ClientProducerCredits getCredits(final SimpleString address, final boolean anon) {
ClientProducerCredits credits = producerCreditManager.getCredits(address, anon, sessionContext); ClientProducerCredits credits = producerCreditManager.getCredits(address, anon, sessionContext);
return credits; return credits;
} }
@Override
public void returnCredits(final SimpleString address) { public void returnCredits(final SimpleString address) {
producerCreditManager.returnCredits(address); producerCreditManager.returnCredits(address);
} }
@Override
public void handleReceiveProducerCredits(final SimpleString address, final int credits) { public void handleReceiveProducerCredits(final SimpleString address, final int credits) {
producerCreditManager.receiveCredits(address, credits); producerCreditManager.receiveCredits(address, credits);
} }
@Override
public void handleReceiveProducerFailCredits(final SimpleString address, int credits) { public void handleReceiveProducerFailCredits(final SimpleString address, int credits) {
producerCreditManager.receiveFailCredits(address, credits); producerCreditManager.receiveFailCredits(address, credits);
} }
@Override
public ClientProducerCreditManager getProducerCreditManager() { public ClientProducerCreditManager getProducerCreditManager() {
return producerCreditManager; return producerCreditManager;
} }
@Override
public void startCall() { public void startCall() {
if (concurrentCall.incrementAndGet() > 1) { if (concurrentCall.incrementAndGet() > 1) {
ActiveMQClientLogger.LOGGER.invalidConcurrentSessionUsage(new Exception("trace")); ActiveMQClientLogger.LOGGER.invalidConcurrentSessionUsage(new Exception("trace"));
} }
} }
@Override
public void endCall() { public void endCall() {
concurrentCall.decrementAndGet(); concurrentCall.decrementAndGet();
} }
@ -1032,6 +1118,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// XAResource implementation // XAResource implementation
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@Override
public void commit(final Xid xid, final boolean onePhase) throws XAException { public void commit(final Xid xid, final boolean onePhase) throws XAException {
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
ActiveMQClientLogger.LOGGER.trace("call commit(xid=" + convert(xid)); ActiveMQClientLogger.LOGGER.trace("call commit(xid=" + convert(xid));
@ -1073,6 +1160,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void end(final Xid xid, final int flags) throws XAException { public void end(final Xid xid, final int flags) throws XAException {
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
ActiveMQClientLogger.LOGGER.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); ActiveMQClientLogger.LOGGER.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags));
@ -1118,6 +1206,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void forget(final Xid xid) throws XAException { public void forget(final Xid xid) throws XAException {
checkXA(); checkXA();
startCall(); startCall();
@ -1138,6 +1227,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public int getTransactionTimeout() throws XAException { public int getTransactionTimeout() throws XAException {
checkXA(); checkXA();
@ -1152,6 +1242,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public boolean setTransactionTimeout(final int seconds) throws XAException { public boolean setTransactionTimeout(final int seconds) throws XAException {
checkXA(); checkXA();
@ -1166,6 +1257,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public boolean isSameRM(final XAResource xares) throws XAException { public boolean isSameRM(final XAResource xares) throws XAException {
checkXA(); checkXA();
@ -1203,6 +1295,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return null; return null;
} }
@Override
public int prepare(final Xid xid) throws XAException { public int prepare(final Xid xid) throws XAException {
checkXA(); checkXA();
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
@ -1269,6 +1362,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public Xid[] recover(final int flags) throws XAException { public Xid[] recover(final int flags) throws XAException {
checkXA(); checkXA();
@ -1287,6 +1381,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
return new Xid[0]; return new Xid[0];
} }
@Override
public void rollback(final Xid xid) throws XAException { public void rollback(final Xid xid) throws XAException {
checkXA(); checkXA();
@ -1341,6 +1436,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void start(final Xid xid, final int flags) throws XAException { public void start(final Xid xid, final int flags) throws XAException {
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
ActiveMQClientLogger.LOGGER.trace("Calling start:: " + convert(xid) + " clientXID=" + xid + " flags = " + convertTXFlag(flags)); ActiveMQClientLogger.LOGGER.trace("Calling start:: " + convert(xid) + " clientXID=" + xid + " flags = " + convertTXFlag(flags));
@ -1388,6 +1484,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// FailureListener implementation -------------------------------------------- // FailureListener implementation --------------------------------------------
@Override
public void connectionFailed(final ActiveMQException me, boolean failedOver) { public void connectionFailed(final ActiveMQException me, boolean failedOver) {
try { try {
cleanUp(false); cleanUp(false);
@ -1397,6 +1494,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
} }
} }
@Override
public void connectionFailed(final ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) { public void connectionFailed(final ActiveMQException me, boolean failedOver, String scaleDownTargetNodeID) {
connectionFailed(me, failedOver); connectionFailed(me, failedOver);
} }
@ -1404,10 +1502,12 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
// Public // Public
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@Override
public void setForceNotSameRM(final boolean force) { public void setForceNotSameRM(final boolean force) {
forceNotSameRM = force; forceNotSameRM = force;
} }
@Override
public RemotingConnection getConnection() { public RemotingConnection getConnection() {
return sessionContext.getRemotingConnection(); return sessionContext.getRemotingConnection();
} }

View File

@ -47,6 +47,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
/** /**
* *
*/ */
@Override
public void discardUnusedPackets() { public void discardUnusedPackets() {
bufferDelegate.discardUnusedPackets(); bufferDelegate.discardUnusedPackets();
} }
@ -54,22 +55,27 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
/** /**
* Add a buff to the List, or save it to the OutputStream if set * Add a buff to the List, or save it to the OutputStream if set
*/ */
@Override
public void addPacket(byte[] chunk, int flowControlSize, boolean isContinues) { public void addPacket(byte[] chunk, int flowControlSize, boolean isContinues) {
bufferDelegate.addPacket(chunk, flowControlSize, isContinues); bufferDelegate.addPacket(chunk, flowControlSize, isContinues);
} }
@Override
public synchronized void cancel() { public synchronized void cancel() {
bufferDelegate.cancel(); bufferDelegate.cancel();
} }
@Override
public synchronized void close() { public synchronized void close() {
bufferDelegate.cancel(); bufferDelegate.cancel();
} }
@Override
public void setOutputStream(final OutputStream output) throws ActiveMQException { public void setOutputStream(final OutputStream output) throws ActiveMQException {
bufferDelegate.setOutputStream(new InflaterWriter(output)); bufferDelegate.setOutputStream(new InflaterWriter(output));
} }
@Override
public synchronized void saveBuffer(final OutputStream output) throws ActiveMQException { public synchronized void saveBuffer(final OutputStream output) throws ActiveMQException {
setOutputStream(output); setOutputStream(output);
waitCompletion(0); waitCompletion(0);
@ -78,6 +84,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
/** /**
* @param timeWait Milliseconds to Wait. 0 means forever * @param timeWait Milliseconds to Wait. 0 means forever
*/ */
@Override
public synchronized boolean waitCompletion(final long timeWait) throws ActiveMQException { public synchronized boolean waitCompletion(final long timeWait) throws ActiveMQException {
return bufferDelegate.waitCompletion(timeWait); return bufferDelegate.waitCompletion(timeWait);
} }
@ -108,6 +115,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
throw new IllegalStateException("Position not supported over compressed large messages"); throw new IllegalStateException("Position not supported over compressed large messages");
} }
@Override
public byte readByte() { public byte readByte() {
try { try {
return getStream().readByte(); return getStream().readByte();
@ -196,82 +204,102 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public int readerIndex() { public int readerIndex() {
return 0; return 0;
} }
@Override
public void readerIndex(final int readerIndex) { public void readerIndex(final int readerIndex) {
// TODO // TODO
} }
@Override
public int writerIndex() { public int writerIndex() {
// TODO // TODO
return 0; return 0;
} }
@Override
public long getSize() { public long getSize() {
return this.bufferDelegate.getSize(); return this.bufferDelegate.getSize();
} }
@Override
public void writerIndex(final int writerIndex) { public void writerIndex(final int writerIndex) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void setIndex(final int readerIndex, final int writerIndex) { public void setIndex(final int readerIndex, final int writerIndex) {
positioningNotSupported(); positioningNotSupported();
} }
@Override
public void clear() { public void clear() {
} }
@Override
public boolean readable() { public boolean readable() {
return true; return true;
} }
@Override
public boolean writable() { public boolean writable() {
return false; return false;
} }
@Override
public int readableBytes() { public int readableBytes() {
return 1; return 1;
} }
@Override
public int writableBytes() { public int writableBytes() {
return 0; return 0;
} }
@Override
public void markReaderIndex() { public void markReaderIndex() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void resetReaderIndex() { public void resetReaderIndex() {
// TODO: reset positioning if possible // TODO: reset positioning if possible
} }
@Override
public void markWriterIndex() { public void markWriterIndex() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void resetWriterIndex() { public void resetWriterIndex() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void discardReadBytes() { public void discardReadBytes() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public short getUnsignedByte(final int index) { public short getUnsignedByte(final int index) {
return (short) (getByte(index) & 0xFF); return (short) (getByte(index) & 0xFF);
} }
@Override
public int getUnsignedShort(final int index) { public int getUnsignedShort(final int index) {
return getShort(index) & 0xFFFF; return getShort(index) & 0xFFFF;
} }
@Override
public long getUnsignedInt(final int index) { public long getUnsignedInt(final int index) {
return getInt(index) & 0xFFFFFFFFL; return getInt(index) & 0xFFFFFFFFL;
} }
@Override
public void getBytes(int index, final byte[] dst) { public void getBytes(int index, final byte[] dst) {
// TODO: optimize this by using System.arraycopy // TODO: optimize this by using System.arraycopy
for (int i = 0; i < dst.length; i++) { for (int i = 0; i < dst.length; i++) {
@ -279,10 +307,12 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst) { public void getBytes(final int index, final ActiveMQBuffer dst) {
getBytes(index, dst, dst.writableBytes()); getBytes(index, dst, dst.writableBytes());
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst, final int length) { public void getBytes(final int index, final ActiveMQBuffer dst, final int length) {
if (length > dst.writableBytes()) { if (length > dst.writableBytes()) {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();
@ -291,18 +321,22 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
dst.writerIndex(dst.writerIndex() + length); dst.writerIndex(dst.writerIndex() + length);
} }
@Override
public void setBytes(final int index, final byte[] src) { public void setBytes(final int index, final byte[] src) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src) { public void setBytes(final int index, final ActiveMQBuffer src) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src, final int length) { public void setBytes(final int index, final ActiveMQBuffer src, final int length) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public int readUnsignedByte() { public int readUnsignedByte() {
try { try {
return getStream().readUnsignedByte(); return getStream().readUnsignedByte();
@ -312,6 +346,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public short readShort() { public short readShort() {
try { try {
return getStream().readShort(); return getStream().readShort();
@ -321,6 +356,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public int readUnsignedShort() { public int readUnsignedShort() {
try { try {
return getStream().readUnsignedShort(); return getStream().readUnsignedShort();
@ -330,6 +366,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public int readInt() { public int readInt() {
try { try {
return getStream().readInt(); return getStream().readInt();
@ -339,10 +376,12 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public long readUnsignedInt() { public long readUnsignedInt() {
return readInt() & 0xFFFFFFFFL; return readInt() & 0xFFFFFFFFL;
} }
@Override
public long readLong() { public long readLong() {
try { try {
return getStream().readLong(); return getStream().readLong();
@ -352,6 +391,7 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public void readBytes(final byte[] dst, final int dstIndex, final int length) { public void readBytes(final byte[] dst, final int dstIndex, final int length) {
try { try {
int nReadBytes = getStream().read(dst, dstIndex, length); int nReadBytes = getStream().read(dst, dstIndex, length);
@ -364,14 +404,17 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
} }
@Override
public void readBytes(final byte[] dst) { public void readBytes(final byte[] dst) {
readBytes(dst, 0, dst.length); readBytes(dst, 0, dst.length);
} }
@Override
public void readBytes(final ActiveMQBuffer dst) { public void readBytes(final ActiveMQBuffer dst) {
readBytes(dst, dst.writableBytes()); readBytes(dst, dst.writableBytes());
} }
@Override
public void readBytes(final ActiveMQBuffer dst, final int length) { public void readBytes(final ActiveMQBuffer dst, final int length) {
if (length > dst.writableBytes()) { if (length > dst.writableBytes()) {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();
@ -380,18 +423,21 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
dst.writerIndex(dst.writerIndex() + length); dst.writerIndex(dst.writerIndex() + length);
} }
@Override
public void readBytes(final ActiveMQBuffer dst, final int dstIndex, final int length) { public void readBytes(final ActiveMQBuffer dst, final int dstIndex, final int length) {
byte[] destBytes = new byte[length]; byte[] destBytes = new byte[length];
readBytes(destBytes); readBytes(destBytes);
dst.setBytes(dstIndex, destBytes); dst.setBytes(dstIndex, destBytes);
} }
@Override
public void readBytes(final ByteBuffer dst) { public void readBytes(final ByteBuffer dst) {
byte[] bytesToGet = new byte[dst.remaining()]; byte[] bytesToGet = new byte[dst.remaining()];
readBytes(bytesToGet); readBytes(bytesToGet);
dst.put(bytesToGet); dst.put(bytesToGet);
} }
@Override
public int skipBytes(final int length) { public int skipBytes(final int length) {
try { try {
@ -425,38 +471,47 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
} }
@Override
public void writeByte(final byte value) { public void writeByte(final byte value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeShort(final short value) { public void writeShort(final short value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeInt(final int value) { public void writeInt(final int value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeLong(final long value) { public void writeLong(final long value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeBytes(final byte[] src, final int srcIndex, final int length) { public void writeBytes(final byte[] src, final int srcIndex, final int length) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeBytes(final byte[] src) { public void writeBytes(final byte[] src) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeBytes(final ActiveMQBuffer src, final int length) { public void writeBytes(final ActiveMQBuffer src, final int length) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeBytes(final ByteBuffer src) { public void writeBytes(final ByteBuffer src) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public ByteBuffer toByteBuffer() { public ByteBuffer toByteBuffer() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@ -475,18 +530,22 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
return (char) readShort(); return (char) readShort();
} }
@Override
public char getChar(final int index) { public char getChar(final int index) {
return (char) getShort(index); return (char) getShort(index);
} }
@Override
public double getDouble(final int index) { public double getDouble(final int index) {
return Double.longBitsToDouble(getLong(index)); return Double.longBitsToDouble(getLong(index));
} }
@Override
public float getFloat(final int index) { public float getFloat(final int index) {
return Float.intBitsToFloat(getInt(index)); return Float.intBitsToFloat(getInt(index));
} }
@Override
public ActiveMQBuffer readBytes(final int length) { public ActiveMQBuffer readBytes(final int length) {
byte[] bytesToGet = new byte[length]; byte[] bytesToGet = new byte[length];
readBytes(bytesToGet); readBytes(bytesToGet);
@ -604,48 +663,59 @@ final class CompressedLargeMessageControllerImpl implements LargeMessageControll
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public ActiveMQBuffer copy() { public ActiveMQBuffer copy() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public ActiveMQBuffer slice(final int index, final int length) { public ActiveMQBuffer slice(final int index, final int length) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
// Inner classes ------------------------------------------------- // Inner classes -------------------------------------------------
@Override
public ByteBuf byteBuf() { public ByteBuf byteBuf() {
return null; return null;
} }
@Override
public ActiveMQBuffer copy(final int index, final int length) { public ActiveMQBuffer copy(final int index, final int length) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public ActiveMQBuffer duplicate() { public ActiveMQBuffer duplicate() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public ActiveMQBuffer readSlice(final int length) { public ActiveMQBuffer readSlice(final int length) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void setChar(final int index, final char value) { public void setChar(final int index, final char value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void setDouble(final int index, final double value) { public void setDouble(final int index, final double value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void setFloat(final int index, final float value) { public void setFloat(final int index, final float value) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public ActiveMQBuffer slice() { public ActiveMQBuffer slice() {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }
@Override
public void writeBytes(final ActiveMQBuffer src, final int srcIndex, final int length) { public void writeBytes(final ActiveMQBuffer src, final int srcIndex, final int length) {
throw new IllegalAccessError(OPERATION_NOT_SUPPORTED); throw new IllegalAccessError(OPERATION_NOT_SUPPORTED);
} }

View File

@ -90,10 +90,12 @@ public class DelegatingSession implements ClientSessionInternal {
} }
} }
@Override
public boolean isClosing() { public boolean isClosing() {
return session.isClosing(); return session.isClosing();
} }
@Override
public void acknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException { public void acknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException {
session.acknowledge(consumer, message); session.acknowledge(consumer, message);
} }
@ -103,34 +105,42 @@ public class DelegatingSession implements ClientSessionInternal {
session.addLifeCycleListener(lifeCycleListener); session.addLifeCycleListener(lifeCycleListener);
} }
@Override
public void individualAcknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException { public void individualAcknowledge(final ClientConsumer consumer, final Message message) throws ActiveMQException {
session.individualAcknowledge(consumer, message); session.individualAcknowledge(consumer, message);
} }
@Override
public void addConsumer(final ClientConsumerInternal consumer) { public void addConsumer(final ClientConsumerInternal consumer) {
session.addConsumer(consumer); session.addConsumer(consumer);
} }
@Override
public void addFailureListener(final SessionFailureListener listener) { public void addFailureListener(final SessionFailureListener listener) {
session.addFailureListener(listener); session.addFailureListener(listener);
} }
@Override
public void addFailoverListener(FailoverEventListener listener) { public void addFailoverListener(FailoverEventListener listener) {
session.addFailoverListener(listener); session.addFailoverListener(listener);
} }
@Override
public void addProducer(final ClientProducerInternal producer) { public void addProducer(final ClientProducerInternal producer) {
session.addProducer(producer); session.addProducer(producer);
} }
@Override
public AddressQuery addressQuery(final SimpleString address) throws ActiveMQException { public AddressQuery addressQuery(final SimpleString address) throws ActiveMQException {
return session.addressQuery(address); return session.addressQuery(address);
} }
@Override
public void cleanUp(boolean failingOver) throws ActiveMQException { public void cleanUp(boolean failingOver) throws ActiveMQException {
session.cleanUp(failingOver); session.cleanUp(failingOver);
} }
@Override
public void close() throws ActiveMQException { public void close() throws ActiveMQException {
closed = true; closed = true;
@ -141,22 +151,27 @@ public class DelegatingSession implements ClientSessionInternal {
session.close(); session.close();
} }
@Override
public void markRollbackOnly() { public void markRollbackOnly() {
session.markRollbackOnly(); session.markRollbackOnly();
} }
@Override
public void commit() throws ActiveMQException { public void commit() throws ActiveMQException {
session.commit(); session.commit();
} }
@Override
public void commit(final Xid xid, final boolean onePhase) throws XAException { public void commit(final Xid xid, final boolean onePhase) throws XAException {
session.commit(xid, onePhase); session.commit(xid, onePhase);
} }
@Override
public ClientMessage createMessage(final boolean durable) { public ClientMessage createMessage(final boolean durable) {
return session.createMessage(durable); return session.createMessage(durable);
} }
@Override
public ClientMessage createMessage(final byte type, public ClientMessage createMessage(final byte type,
final boolean durable, final boolean durable,
final long expiration, final long expiration,
@ -165,16 +180,19 @@ public class DelegatingSession implements ClientSessionInternal {
return session.createMessage(type, durable, expiration, timestamp, priority); return session.createMessage(type, durable, expiration, timestamp, priority);
} }
@Override
public ClientMessage createMessage(final byte type, final boolean durable) { public ClientMessage createMessage(final byte type, final boolean durable) {
return session.createMessage(type, durable); return session.createMessage(type, durable);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final SimpleString filterString, final SimpleString filterString,
final boolean browseOnly) throws ActiveMQException { final boolean browseOnly) throws ActiveMQException {
return session.createConsumer(queueName, filterString, browseOnly); return session.createConsumer(queueName, filterString, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final SimpleString filterString, final SimpleString filterString,
final int windowSize, final int windowSize,
@ -183,21 +201,25 @@ public class DelegatingSession implements ClientSessionInternal {
return session.createConsumer(queueName, filterString, windowSize, maxRate, browseOnly); return session.createConsumer(queueName, filterString, windowSize, maxRate, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final SimpleString filterString) throws ActiveMQException { final SimpleString filterString) throws ActiveMQException {
return session.createConsumer(queueName, filterString); return session.createConsumer(queueName, filterString);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName) throws ActiveMQException { public ClientConsumer createConsumer(final SimpleString queueName) throws ActiveMQException {
return session.createConsumer(queueName); return session.createConsumer(queueName);
} }
@Override
public ClientConsumer createConsumer(final String queueName, public ClientConsumer createConsumer(final String queueName,
final String filterString, final String filterString,
final boolean browseOnly) throws ActiveMQException { final boolean browseOnly) throws ActiveMQException {
return session.createConsumer(queueName, filterString, browseOnly); return session.createConsumer(queueName, filterString, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final String queueName, public ClientConsumer createConsumer(final String queueName,
final String filterString, final String filterString,
final int windowSize, final int windowSize,
@ -206,47 +228,58 @@ public class DelegatingSession implements ClientSessionInternal {
return session.createConsumer(queueName, filterString, windowSize, maxRate, browseOnly); return session.createConsumer(queueName, filterString, windowSize, maxRate, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final String queueName, final String filterString) throws ActiveMQException { public ClientConsumer createConsumer(final String queueName, final String filterString) throws ActiveMQException {
return session.createConsumer(queueName, filterString); return session.createConsumer(queueName, filterString);
} }
@Override
public ClientConsumer createConsumer(final String queueName) throws ActiveMQException { public ClientConsumer createConsumer(final String queueName) throws ActiveMQException {
return session.createConsumer(queueName); return session.createConsumer(queueName);
} }
@Override
public ClientConsumer createConsumer(final SimpleString queueName, public ClientConsumer createConsumer(final SimpleString queueName,
final boolean browseOnly) throws ActiveMQException { final boolean browseOnly) throws ActiveMQException {
return session.createConsumer(queueName, browseOnly); return session.createConsumer(queueName, browseOnly);
} }
@Override
public ClientConsumer createConsumer(final String queueName, final boolean browseOnly) throws ActiveMQException { public ClientConsumer createConsumer(final String queueName, final boolean browseOnly) throws ActiveMQException {
return session.createConsumer(queueName, browseOnly); return session.createConsumer(queueName, browseOnly);
} }
@Override
public ClientProducer createProducer() throws ActiveMQException { public ClientProducer createProducer() throws ActiveMQException {
return session.createProducer(); return session.createProducer();
} }
@Override
public ClientProducer createProducer(final SimpleString address, final int rate) throws ActiveMQException { public ClientProducer createProducer(final SimpleString address, final int rate) throws ActiveMQException {
return session.createProducer(address, rate); return session.createProducer(address, rate);
} }
@Override
public ClientProducer createProducer(final SimpleString address) throws ActiveMQException { public ClientProducer createProducer(final SimpleString address) throws ActiveMQException {
return session.createProducer(address); return session.createProducer(address);
} }
@Override
public ClientProducer createProducer(final String address) throws ActiveMQException { public ClientProducer createProducer(final String address) throws ActiveMQException {
return session.createProducer(address); return session.createProducer(address);
} }
@Override
public void createQueue(final String address, final String queueName) throws ActiveMQException { public void createQueue(final String address, final String queueName) throws ActiveMQException {
session.createQueue(address, queueName); session.createQueue(address, queueName);
} }
@Override
public void createQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { public void createQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException {
session.createQueue(address, queueName); session.createQueue(address, queueName);
} }
@Override
public void createQueue(final SimpleString address, public void createQueue(final SimpleString address,
final SimpleString queueName, final SimpleString queueName,
final boolean durable) throws ActiveMQException { final boolean durable) throws ActiveMQException {
@ -268,6 +301,7 @@ public class DelegatingSession implements ClientSessionInternal {
session.createSharedQueue(address, queueName, filter, durable); session.createSharedQueue(address, queueName, filter, durable);
} }
@Override
public void createQueue(final SimpleString address, public void createQueue(final SimpleString address,
final SimpleString queueName, final SimpleString queueName,
final SimpleString filterString, final SimpleString filterString,
@ -275,12 +309,14 @@ public class DelegatingSession implements ClientSessionInternal {
session.createQueue(address, queueName, filterString, durable); session.createQueue(address, queueName, filterString, durable);
} }
@Override
public void createQueue(final String address, public void createQueue(final String address,
final String queueName, final String queueName,
final boolean durable) throws ActiveMQException { final boolean durable) throws ActiveMQException {
session.createQueue(address, queueName, durable); session.createQueue(address, queueName, durable);
} }
@Override
public void createQueue(final String address, public void createQueue(final String address,
final String queueName, final String queueName,
final String filterString, final String filterString,
@ -288,74 +324,91 @@ public class DelegatingSession implements ClientSessionInternal {
session.createQueue(address, queueName, filterString, durable); session.createQueue(address, queueName, filterString, durable);
} }
@Override
public void createTemporaryQueue(final SimpleString address, public void createTemporaryQueue(final SimpleString address,
final SimpleString queueName, final SimpleString queueName,
final SimpleString filter) throws ActiveMQException { final SimpleString filter) throws ActiveMQException {
session.createTemporaryQueue(address, queueName, filter); session.createTemporaryQueue(address, queueName, filter);
} }
@Override
public void createTemporaryQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException { public void createTemporaryQueue(final SimpleString address, final SimpleString queueName) throws ActiveMQException {
session.createTemporaryQueue(address, queueName); session.createTemporaryQueue(address, queueName);
} }
@Override
public void createTemporaryQueue(final String address, public void createTemporaryQueue(final String address,
final String queueName, final String queueName,
final String filter) throws ActiveMQException { final String filter) throws ActiveMQException {
session.createTemporaryQueue(address, queueName, filter); session.createTemporaryQueue(address, queueName, filter);
} }
@Override
public void createTemporaryQueue(final String address, final String queueName) throws ActiveMQException { public void createTemporaryQueue(final String address, final String queueName) throws ActiveMQException {
session.createTemporaryQueue(address, queueName); session.createTemporaryQueue(address, queueName);
} }
@Override
public void deleteQueue(final SimpleString queueName) throws ActiveMQException { public void deleteQueue(final SimpleString queueName) throws ActiveMQException {
session.deleteQueue(queueName); session.deleteQueue(queueName);
} }
@Override
public void deleteQueue(final String queueName) throws ActiveMQException { public void deleteQueue(final String queueName) throws ActiveMQException {
session.deleteQueue(queueName); session.deleteQueue(queueName);
} }
@Override
public void end(final Xid xid, final int flags) throws XAException { public void end(final Xid xid, final int flags) throws XAException {
session.end(xid, flags); session.end(xid, flags);
} }
@Override
public void expire(final ClientConsumer consumer, final Message message) throws ActiveMQException { public void expire(final ClientConsumer consumer, final Message message) throws ActiveMQException {
session.expire(consumer, message); session.expire(consumer, message);
} }
@Override
public void forget(final Xid xid) throws XAException { public void forget(final Xid xid) throws XAException {
session.forget(xid); session.forget(xid);
} }
@Override
public RemotingConnection getConnection() { public RemotingConnection getConnection() {
return session.getConnection(); return session.getConnection();
} }
@Override
public int getMinLargeMessageSize() { public int getMinLargeMessageSize() {
return session.getMinLargeMessageSize(); return session.getMinLargeMessageSize();
} }
@Override
public String getName() { public String getName() {
return session.getName(); return session.getName();
} }
@Override
public int getTransactionTimeout() throws XAException { public int getTransactionTimeout() throws XAException {
return session.getTransactionTimeout(); return session.getTransactionTimeout();
} }
@Override
public int getVersion() { public int getVersion() {
return session.getVersion(); return session.getVersion();
} }
@Override
public XAResource getXAResource() { public XAResource getXAResource() {
return session.getXAResource(); return session.getXAResource();
} }
@Override
public void preHandleFailover(RemotingConnection connection) { public void preHandleFailover(RemotingConnection connection) {
session.preHandleFailover(connection); session.preHandleFailover(connection);
} }
@Override
public void handleFailover(final RemotingConnection backupConnection, ActiveMQException cause) { public void handleFailover(final RemotingConnection backupConnection, ActiveMQException cause) {
session.handleFailover(backupConnection, cause); session.handleFailover(backupConnection, cause);
} }
@ -385,152 +438,189 @@ public class DelegatingSession implements ClientSessionInternal {
session.handleConsumerDisconnect(consumerContext); session.handleConsumerDisconnect(consumerContext);
} }
@Override
public boolean isAutoCommitAcks() { public boolean isAutoCommitAcks() {
return session.isAutoCommitAcks(); return session.isAutoCommitAcks();
} }
@Override
public boolean isAutoCommitSends() { public boolean isAutoCommitSends() {
return session.isAutoCommitSends(); return session.isAutoCommitSends();
} }
@Override
public boolean isBlockOnAcknowledge() { public boolean isBlockOnAcknowledge() {
return session.isBlockOnAcknowledge(); return session.isBlockOnAcknowledge();
} }
@Override
public boolean isCacheLargeMessageClient() { public boolean isCacheLargeMessageClient() {
return session.isCacheLargeMessageClient(); return session.isCacheLargeMessageClient();
} }
@Override
public boolean isClosed() { public boolean isClosed() {
return session.isClosed(); return session.isClosed();
} }
@Override
public boolean isSameRM(final XAResource xares) throws XAException { public boolean isSameRM(final XAResource xares) throws XAException {
return session.isSameRM(xares); return session.isSameRM(xares);
} }
@Override
public boolean isXA() { public boolean isXA() {
return session.isXA(); return session.isXA();
} }
@Override
public int prepare(final Xid xid) throws XAException { public int prepare(final Xid xid) throws XAException {
return session.prepare(xid); return session.prepare(xid);
} }
@Override
public QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException { public QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException {
return session.queueQuery(queueName); return session.queueQuery(queueName);
} }
@Override
public Xid[] recover(final int flag) throws XAException { public Xid[] recover(final int flag) throws XAException {
return session.recover(flag); return session.recover(flag);
} }
@Override
public void removeConsumer(final ClientConsumerInternal consumer) throws ActiveMQException { public void removeConsumer(final ClientConsumerInternal consumer) throws ActiveMQException {
session.removeConsumer(consumer); session.removeConsumer(consumer);
} }
@Override
public boolean removeFailureListener(final SessionFailureListener listener) { public boolean removeFailureListener(final SessionFailureListener listener) {
return session.removeFailureListener(listener); return session.removeFailureListener(listener);
} }
@Override
public boolean removeFailoverListener(FailoverEventListener listener) { public boolean removeFailoverListener(FailoverEventListener listener) {
return session.removeFailoverListener(listener); return session.removeFailoverListener(listener);
} }
@Override
public void removeProducer(final ClientProducerInternal producer) { public void removeProducer(final ClientProducerInternal producer) {
session.removeProducer(producer); session.removeProducer(producer);
} }
@Override
public void rollback() throws ActiveMQException { public void rollback() throws ActiveMQException {
session.rollback(); session.rollback();
} }
@Override
public boolean isRollbackOnly() { public boolean isRollbackOnly() {
return session.isRollbackOnly(); return session.isRollbackOnly();
} }
@Override
public void rollback(final boolean considerLastMessageAsDelivered) throws ActiveMQException { public void rollback(final boolean considerLastMessageAsDelivered) throws ActiveMQException {
session.rollback(considerLastMessageAsDelivered); session.rollback(considerLastMessageAsDelivered);
} }
@Override
public void rollback(final Xid xid) throws XAException { public void rollback(final Xid xid) throws XAException {
session.rollback(xid); session.rollback(xid);
} }
@Override
public DelegatingSession setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) { public DelegatingSession setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) {
session.setSendAcknowledgementHandler(handler); session.setSendAcknowledgementHandler(handler);
return this; return this;
} }
@Override
public boolean setTransactionTimeout(final int seconds) throws XAException { public boolean setTransactionTimeout(final int seconds) throws XAException {
return session.setTransactionTimeout(seconds); return session.setTransactionTimeout(seconds);
} }
@Override
public void resetIfNeeded() throws ActiveMQException { public void resetIfNeeded() throws ActiveMQException {
session.resetIfNeeded(); session.resetIfNeeded();
} }
@Override
public DelegatingSession start() throws ActiveMQException { public DelegatingSession start() throws ActiveMQException {
session.start(); session.start();
return this; return this;
} }
@Override
public void start(final Xid xid, final int flags) throws XAException { public void start(final Xid xid, final int flags) throws XAException {
session.start(xid, flags); session.start(xid, flags);
} }
@Override
public void stop() throws ActiveMQException { public void stop() throws ActiveMQException {
session.stop(); session.stop();
} }
@Override
public ClientSessionFactory getSessionFactory() { public ClientSessionFactory getSessionFactory() {
return session.getSessionFactory(); return session.getSessionFactory();
} }
@Override
public void setForceNotSameRM(final boolean force) { public void setForceNotSameRM(final boolean force) {
session.setForceNotSameRM(force); session.setForceNotSameRM(force);
} }
@Override
public void workDone() { public void workDone() {
session.workDone(); session.workDone();
} }
@Override
public void sendProducerCreditsMessage(final int credits, final SimpleString address) { public void sendProducerCreditsMessage(final int credits, final SimpleString address) {
session.sendProducerCreditsMessage(credits, address); session.sendProducerCreditsMessage(credits, address);
} }
@Override
public ClientProducerCredits getCredits(final SimpleString address, final boolean anon) { public ClientProducerCredits getCredits(final SimpleString address, final boolean anon) {
return session.getCredits(address, anon); return session.getCredits(address, anon);
} }
@Override
public void returnCredits(final SimpleString address) { public void returnCredits(final SimpleString address) {
session.returnCredits(address); session.returnCredits(address);
} }
@Override
public void handleReceiveProducerCredits(final SimpleString address, final int credits) { public void handleReceiveProducerCredits(final SimpleString address, final int credits) {
session.handleReceiveProducerCredits(address, credits); session.handleReceiveProducerCredits(address, credits);
} }
@Override
public void handleReceiveProducerFailCredits(final SimpleString address, final int credits) { public void handleReceiveProducerFailCredits(final SimpleString address, final int credits) {
session.handleReceiveProducerFailCredits(address, credits); session.handleReceiveProducerFailCredits(address, credits);
} }
@Override
public ClientProducerCreditManager getProducerCreditManager() { public ClientProducerCreditManager getProducerCreditManager() {
return session.getProducerCreditManager(); return session.getProducerCreditManager();
} }
@Override
public void setAddress(Message message, SimpleString address) { public void setAddress(Message message, SimpleString address) {
session.setAddress(message, address); session.setAddress(message, address);
} }
@Override
public void setPacketSize(int packetSize) { public void setPacketSize(int packetSize) {
session.setPacketSize(packetSize); session.setPacketSize(packetSize);
} }
@Override
public void addMetaData(String key, String data) throws ActiveMQException { public void addMetaData(String key, String data) throws ActiveMQException {
session.addMetaData(key, data); session.addMetaData(key, data);
} }
@Override
public boolean isCompressLargeMessages() { public boolean isCompressLargeMessages() {
return session.isCompressLargeMessages(); return session.isCompressLargeMessages();
} }
@ -546,10 +636,12 @@ public class DelegatingSession implements ClientSessionInternal {
} }
@Override
public void startCall() { public void startCall() {
session.startCall(); session.startCall();
} }
@Override
public void endCall() { public void endCall() {
session.endCall(); session.endCall();
} }

View File

@ -134,6 +134,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
this.local = local; this.local = local;
} }
@Override
public void discardUnusedPackets() { public void discardUnusedPackets() {
if (outStream == null) { if (outStream == null) {
if (local) if (local)
@ -150,6 +151,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
* TODO: move this to ConsumerContext as large message is a protocol specific thing * TODO: move this to ConsumerContext as large message is a protocol specific thing
* Add a buff to the List, or save it to the OutputStream if set * Add a buff to the List, or save it to the OutputStream if set
*/ */
@Override
public void addPacket(byte[] chunk, int flowControlSize, boolean isContinues) { public void addPacket(byte[] chunk, int flowControlSize, boolean isContinues) {
int flowControlCredit = 0; int flowControlCredit = 0;
@ -206,6 +208,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
} }
} }
@Override
public void cancel() { public void cancel() {
this.handledException = ActiveMQClientMessageBundle.BUNDLE.largeMessageInterrupted(); this.handledException = ActiveMQClientMessageBundle.BUNDLE.largeMessageInterrupted();
@ -232,12 +235,14 @@ public class LargeMessageControllerImpl implements LargeMessageController {
} }
} }
@Override
public synchronized void close() { public synchronized void close() {
if (fileCache != null) { if (fileCache != null) {
fileCache.close(); fileCache.close();
} }
} }
@Override
public void setOutputStream(final OutputStream output) throws ActiveMQException { public void setOutputStream(final OutputStream output) throws ActiveMQException {
int totalFlowControl = 0; int totalFlowControl = 0;
@ -268,6 +273,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
} }
} }
@Override
public synchronized void saveBuffer(final OutputStream output) throws ActiveMQException { public synchronized void saveBuffer(final OutputStream output) throws ActiveMQException {
if (streamClosed) { if (streamClosed) {
throw ActiveMQClientMessageBundle.BUNDLE.largeMessageLostSession(); throw ActiveMQClientMessageBundle.BUNDLE.largeMessageLostSession();
@ -280,6 +286,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
* @param timeWait Milliseconds to Wait. 0 means forever * @param timeWait Milliseconds to Wait. 0 means forever
* @throws ActiveMQException * @throws ActiveMQException
*/ */
@Override
public synchronized boolean waitCompletion(final long timeWait) throws ActiveMQException { public synchronized boolean waitCompletion(final long timeWait) throws ActiveMQException {
if (outStream == null) { if (outStream == null) {
// There is no stream.. it will never achieve the end of streaming // There is no stream.. it will never achieve the end of streaming
@ -344,6 +351,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return -1; return -1;
} }
@Override
public byte readByte() { public byte readByte() {
return getByte(readerIndex++); return getByte(readerIndex++);
} }
@ -425,6 +433,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return out.write(ByteBuffer.wrap(bytesToGet)); return out.write(ByteBuffer.wrap(bytesToGet));
} }
@Override
public int getInt(final int index) { public int getInt(final int index) {
return (getByte(index) & 0xff) << 24 | (getByte(index + 1) & 0xff) << 16 | return (getByte(index) & 0xff) << 24 | (getByte(index + 1) & 0xff) << 16 |
(getByte(index + 2) & 0xff) << 8 | (getByte(index + 2) & 0xff) << 8 |
@ -515,10 +524,12 @@ public class LargeMessageControllerImpl implements LargeMessageController {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public int readerIndex() { public int readerIndex() {
return (int) readerIndex; return (int) readerIndex;
} }
@Override
public void readerIndex(final int readerIndex) { public void readerIndex(final int readerIndex) {
try { try {
checkForPacket(readerIndex); checkForPacket(readerIndex);
@ -530,18 +541,22 @@ public class LargeMessageControllerImpl implements LargeMessageController {
this.readerIndex = readerIndex; this.readerIndex = readerIndex;
} }
@Override
public int writerIndex() { public int writerIndex() {
return (int) totalSize; return (int) totalSize;
} }
@Override
public long getSize() { public long getSize() {
return totalSize; return totalSize;
} }
@Override
public void writerIndex(final int writerIndex) { public void writerIndex(final int writerIndex) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void setIndex(final int readerIndex, final int writerIndex) { public void setIndex(final int readerIndex, final int writerIndex) {
try { try {
checkForPacket(readerIndex); checkForPacket(readerIndex);
@ -553,17 +568,21 @@ public class LargeMessageControllerImpl implements LargeMessageController {
this.readerIndex = readerIndex; this.readerIndex = readerIndex;
} }
@Override
public void clear() { public void clear() {
} }
@Override
public boolean readable() { public boolean readable() {
return true; return true;
} }
@Override
public boolean writable() { public boolean writable() {
return false; return false;
} }
@Override
public int readableBytes() { public int readableBytes() {
long readableBytes = totalSize - readerIndex; long readableBytes = totalSize - readerIndex;
@ -575,14 +594,17 @@ public class LargeMessageControllerImpl implements LargeMessageController {
} }
} }
@Override
public int writableBytes() { public int writableBytes() {
return 0; return 0;
} }
@Override
public void markReaderIndex() { public void markReaderIndex() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void resetReaderIndex() { public void resetReaderIndex() {
try { try {
checkForPacket(0); checkForPacket(0);
@ -593,22 +615,27 @@ public class LargeMessageControllerImpl implements LargeMessageController {
} }
} }
@Override
public void markWriterIndex() { public void markWriterIndex() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void resetWriterIndex() { public void resetWriterIndex() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void discardReadBytes() { public void discardReadBytes() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public short getUnsignedByte(final int index) { public short getUnsignedByte(final int index) {
return (short) (getByte(index) & 0xFF); return (short) (getByte(index) & 0xFF);
} }
@Override
public int getUnsignedShort(final int index) { public int getUnsignedShort(final int index) {
return getShort(index) & 0xFFFF; return getShort(index) & 0xFFFF;
} }
@ -621,10 +648,12 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return value; return value;
} }
@Override
public long getUnsignedInt(final int index) { public long getUnsignedInt(final int index) {
return getInt(index) & 0xFFFFFFFFL; return getInt(index) & 0xFFFFFFFFL;
} }
@Override
public void getBytes(int index, final byte[] dst) { public void getBytes(int index, final byte[] dst) {
// TODO: optimize this by using System.arraycopy // TODO: optimize this by using System.arraycopy
for (int i = 0; i < dst.length; i++) { for (int i = 0; i < dst.length; i++) {
@ -639,10 +668,12 @@ public class LargeMessageControllerImpl implements LargeMessageController {
} }
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst) { public void getBytes(final int index, final ActiveMQBuffer dst) {
getBytes(index, dst, dst.writableBytes()); getBytes(index, dst, dst.writableBytes());
} }
@Override
public void getBytes(final int index, final ActiveMQBuffer dst, final int length) { public void getBytes(final int index, final ActiveMQBuffer dst, final int length) {
if (length > dst.writableBytes()) { if (length > dst.writableBytes()) {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();
@ -651,14 +682,17 @@ public class LargeMessageControllerImpl implements LargeMessageController {
dst.writerIndex(dst.writerIndex() + length); dst.writerIndex(dst.writerIndex() + length);
} }
@Override
public void setBytes(final int index, final byte[] src) { public void setBytes(final int index, final byte[] src) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src) { public void setBytes(final int index, final ActiveMQBuffer src) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void setBytes(final int index, final ActiveMQBuffer src, final int length) { public void setBytes(final int index, final ActiveMQBuffer src, final int length) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@ -667,16 +701,19 @@ public class LargeMessageControllerImpl implements LargeMessageController {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public int readUnsignedByte() { public int readUnsignedByte() {
return (short) (readByte() & 0xFF); return (short) (readByte() & 0xFF);
} }
@Override
public short readShort() { public short readShort() {
short v = getShort(readerIndex); short v = getShort(readerIndex);
readerIndex += 2; readerIndex += 2;
return v; return v;
} }
@Override
public int readUnsignedShort() { public int readUnsignedShort() {
return readShort() & 0xFFFF; return readShort() & 0xFFFF;
} }
@ -695,6 +732,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return v; return v;
} }
@Override
public int readInt() { public int readInt() {
int v = getInt(readerIndex); int v = getInt(readerIndex);
readerIndex += 4; readerIndex += 4;
@ -706,29 +744,35 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return v; return v;
} }
@Override
public long readUnsignedInt() { public long readUnsignedInt() {
return readInt() & 0xFFFFFFFFL; return readInt() & 0xFFFFFFFFL;
} }
@Override
public long readLong() { public long readLong() {
long v = getLong(readerIndex); long v = getLong(readerIndex);
readerIndex += 8; readerIndex += 8;
return v; return v;
} }
@Override
public void readBytes(final byte[] dst, final int dstIndex, final int length) { public void readBytes(final byte[] dst, final int dstIndex, final int length) {
getBytes(readerIndex, dst, dstIndex, length); getBytes(readerIndex, dst, dstIndex, length);
readerIndex += length; readerIndex += length;
} }
@Override
public void readBytes(final byte[] dst) { public void readBytes(final byte[] dst) {
readBytes(dst, 0, dst.length); readBytes(dst, 0, dst.length);
} }
@Override
public void readBytes(final ActiveMQBuffer dst) { public void readBytes(final ActiveMQBuffer dst) {
readBytes(dst, dst.writableBytes()); readBytes(dst, dst.writableBytes());
} }
@Override
public void readBytes(final ActiveMQBuffer dst, final int length) { public void readBytes(final ActiveMQBuffer dst, final int length) {
if (length > dst.writableBytes()) { if (length > dst.writableBytes()) {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();
@ -737,11 +781,13 @@ public class LargeMessageControllerImpl implements LargeMessageController {
dst.writerIndex(dst.writerIndex() + length); dst.writerIndex(dst.writerIndex() + length);
} }
@Override
public void readBytes(final ActiveMQBuffer dst, final int dstIndex, final int length) { public void readBytes(final ActiveMQBuffer dst, final int dstIndex, final int length) {
getBytes(readerIndex, dst, dstIndex, length); getBytes(readerIndex, dst, dstIndex, length);
readerIndex += length; readerIndex += length;
} }
@Override
public void readBytes(final ByteBuffer dst) { public void readBytes(final ByteBuffer dst) {
int length = dst.remaining(); int length = dst.remaining();
getBytes(readerIndex, dst); getBytes(readerIndex, dst);
@ -759,6 +805,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
readerIndex += length; readerIndex += length;
} }
@Override
public int skipBytes(final int length) { public int skipBytes(final int length) {
long newReaderIndex = readerIndex + length; long newReaderIndex = readerIndex + length;
@ -767,10 +814,12 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return length; return length;
} }
@Override
public void writeByte(final byte value) { public void writeByte(final byte value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeShort(final short value) { public void writeShort(final short value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@ -779,18 +828,22 @@ public class LargeMessageControllerImpl implements LargeMessageController {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeInt(final int value) { public void writeInt(final int value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeLong(final long value) { public void writeLong(final long value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeBytes(final byte[] src, final int srcIndex, final int length) { public void writeBytes(final byte[] src, final int srcIndex, final int length) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeBytes(final byte[] src) { public void writeBytes(final byte[] src) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@ -799,10 +852,12 @@ public class LargeMessageControllerImpl implements LargeMessageController {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeBytes(final ActiveMQBuffer src, final int length) { public void writeBytes(final ActiveMQBuffer src, final int length) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeBytes(final ByteBuffer src) { public void writeBytes(final ByteBuffer src) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@ -819,6 +874,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public ByteBuffer toByteBuffer() { public ByteBuffer toByteBuffer() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@ -849,18 +905,22 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return (char) readShort(); return (char) readShort();
} }
@Override
public char getChar(final int index) { public char getChar(final int index) {
return (char) getShort(index); return (char) getShort(index);
} }
@Override
public double getDouble(final int index) { public double getDouble(final int index) {
return Double.longBitsToDouble(getLong(index)); return Double.longBitsToDouble(getLong(index));
} }
@Override
public float getFloat(final int index) { public float getFloat(final int index) {
return Float.intBitsToFloat(getInt(index)); return Float.intBitsToFloat(getInt(index));
} }
@Override
public ActiveMQBuffer readBytes(final int length) { public ActiveMQBuffer readBytes(final int length) {
byte[] bytesToGet = new byte[length]; byte[] bytesToGet = new byte[length];
getBytes(readerIndex, bytesToGet); getBytes(readerIndex, bytesToGet);
@ -979,10 +1039,12 @@ public class LargeMessageControllerImpl implements LargeMessageController {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public ActiveMQBuffer copy() { public ActiveMQBuffer copy() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public ActiveMQBuffer slice(final int index, final int length) { public ActiveMQBuffer slice(final int index, final int length) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -1198,38 +1260,47 @@ public class LargeMessageControllerImpl implements LargeMessageController {
return ByteUtil.readLine(this); return ByteUtil.readLine(this);
} }
@Override
public ByteBuf byteBuf() { public ByteBuf byteBuf() {
return null; return null;
} }
@Override
public ActiveMQBuffer copy(final int index, final int length) { public ActiveMQBuffer copy(final int index, final int length) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public ActiveMQBuffer duplicate() { public ActiveMQBuffer duplicate() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public ActiveMQBuffer readSlice(final int length) { public ActiveMQBuffer readSlice(final int length) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void setChar(final int index, final char value) { public void setChar(final int index, final char value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void setDouble(final int index, final double value) { public void setDouble(final int index, final double value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void setFloat(final int index, final float value) { public void setFloat(final int index, final float value) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public ActiveMQBuffer slice() { public ActiveMQBuffer slice() {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }
@Override
public void writeBytes(final ActiveMQBuffer src, final int srcIndex, final int length) { public void writeBytes(final ActiveMQBuffer src, final int srcIndex, final int length) {
throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE); throw new IllegalAccessError(LargeMessageControllerImpl.READ_ONLY_ERROR_MESSAGE);
} }

View File

@ -70,38 +70,47 @@ public class QueueQueryImpl implements ClientSession.QueueQuery {
this.autoCreateJmsQueues = autoCreateJmsQueues; this.autoCreateJmsQueues = autoCreateJmsQueues;
} }
@Override
public SimpleString getName() { public SimpleString getName() {
return name; return name;
} }
@Override
public SimpleString getAddress() { public SimpleString getAddress() {
return address; return address;
} }
@Override
public int getConsumerCount() { public int getConsumerCount() {
return consumerCount; return consumerCount;
} }
@Override
public SimpleString getFilterString() { public SimpleString getFilterString() {
return filterString; return filterString;
} }
@Override
public long getMessageCount() { public long getMessageCount() {
return messageCount; return messageCount;
} }
@Override
public boolean isDurable() { public boolean isDurable() {
return durable; return durable;
} }
@Override
public boolean isAutoCreateJmsQueues() { public boolean isAutoCreateJmsQueues() {
return autoCreateJmsQueues; return autoCreateJmsQueues;
} }
@Override
public boolean isTemporary() { public boolean isTemporary() {
return temporary; return temporary;
} }
@Override
public boolean isExists() { public boolean isExists() {
return exists; return exists;
} }

View File

@ -314,6 +314,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
throw new IllegalStateException("Please specify a load balancing policy class name on the session factory"); throw new IllegalStateException("Please specify a load balancing policy class name on the session factory");
} }
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
loadBalancingPolicy = (ConnectionLoadBalancingPolicy) ClassloadingUtil.newInstanceFromClassLoader(connectionLoadBalancingPolicyClassName); loadBalancingPolicy = (ConnectionLoadBalancingPolicy) ClassloadingUtil.newInstanceFromClassLoader(connectionLoadBalancingPolicyClassName);
return null; return null;
@ -500,6 +501,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
this(topology, useHA, null, transportConfigs); this(topology, useHA, null, transportConfigs);
} }
@Override
public void resetToInitialConnectors() { public void resetToInitialConnectors() {
synchronized (topologyArrayGuard) { synchronized (topologyArrayGuard) {
receivedTopology = false; receivedTopology = false;
@ -511,6 +513,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
/* /*
* I'm not using isAllInVM here otherwsie BeanProperties would translate this as a property for the URL * I'm not using isAllInVM here otherwsie BeanProperties would translate this as a property for the URL
*/ */
@Override
public boolean allInVM() { public boolean allInVM() {
for (TransportConfiguration config : getStaticTransportConfigurations()) { for (TransportConfiguration config : getStaticTransportConfigurations()) {
if (!config.getFactoryClassName().contains("InVMConnectorFactory")) { if (!config.getFactoryClassName().contains("InVMConnectorFactory")) {
@ -597,6 +600,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public void start(Executor executor) throws Exception { public void start(Executor executor) throws Exception {
initialise(); initialise();
@ -604,6 +608,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
if (executor != null) { if (executor != null) {
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override
public void run() { public void run() {
try { try {
connect(); connect();
@ -618,10 +623,12 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public ClientProtocolManager newProtocolManager() { public ClientProtocolManager newProtocolManager() {
return getProtocolManagerFactory().newProtocolManager(); return getProtocolManagerFactory().newProtocolManager();
} }
@Override
public ClientProtocolManagerFactory getProtocolManagerFactory() { public ClientProtocolManagerFactory getProtocolManagerFactory() {
if (protocolManagerFactory == null) { if (protocolManagerFactory == null) {
// Default one in case it's null // Default one in case it's null
@ -630,12 +637,14 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return protocolManagerFactory; return protocolManagerFactory;
} }
@Override
public ServerLocator setProtocolManagerFactory(ClientProtocolManagerFactory protocolManagerFactory) { public ServerLocator setProtocolManagerFactory(ClientProtocolManagerFactory protocolManagerFactory) {
this.protocolManagerFactory = protocolManagerFactory; this.protocolManagerFactory = protocolManagerFactory;
protocolManagerFactory.setLocator(this); protocolManagerFactory.setLocator(this);
return this; return this;
} }
@Override
public void disableFinalizeCheck() { public void disableFinalizeCheck() {
finalizeCheck = false; finalizeCheck = false;
} }
@ -670,15 +679,18 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return connect(true); return connect(true);
} }
@Override
public ServerLocatorImpl setAfterConnectionInternalListener(AfterConnectInternalListener listener) { public ServerLocatorImpl setAfterConnectionInternalListener(AfterConnectInternalListener listener) {
this.afterConnectListener = listener; this.afterConnectListener = listener;
return this; return this;
} }
@Override
public AfterConnectInternalListener getAfterConnectInternalListener() { public AfterConnectInternalListener getAfterConnectInternalListener() {
return afterConnectListener; return afterConnectListener;
} }
@Override
public ClientSessionFactory createSessionFactory(String nodeID) throws Exception { public ClientSessionFactory createSessionFactory(String nodeID) throws Exception {
TopologyMember topologyMember = topology.getMember(nodeID); TopologyMember topologyMember = topology.getMember(nodeID);
@ -705,6 +717,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return null; return null;
} }
@Override
public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception { public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception {
assertOpen(); assertOpen();
@ -730,6 +743,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration, public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration,
int reconnectAttempts, int reconnectAttempts,
boolean failoverOnInitialConnection) throws Exception { boolean failoverOnInitialConnection) throws Exception {
@ -770,6 +784,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public ClientSessionFactory createSessionFactory() throws ActiveMQException { public ClientSessionFactory createSessionFactory() throws ActiveMQException {
assertOpen(); assertOpen();
@ -902,327 +917,393 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return fromInterceptors(outgoingInterceptors); return fromInterceptors(outgoingInterceptors);
} }
@Override
public boolean isCacheLargeMessagesClient() { public boolean isCacheLargeMessagesClient() {
return cacheLargeMessagesClient; return cacheLargeMessagesClient;
} }
@Override
public ServerLocatorImpl setCacheLargeMessagesClient(final boolean cached) { public ServerLocatorImpl setCacheLargeMessagesClient(final boolean cached) {
cacheLargeMessagesClient = cached; cacheLargeMessagesClient = cached;
return this; return this;
} }
@Override
public long getClientFailureCheckPeriod() { public long getClientFailureCheckPeriod() {
return clientFailureCheckPeriod; return clientFailureCheckPeriod;
} }
@Override
public ServerLocatorImpl setClientFailureCheckPeriod(final long clientFailureCheckPeriod) { public ServerLocatorImpl setClientFailureCheckPeriod(final long clientFailureCheckPeriod) {
checkWrite(); checkWrite();
this.clientFailureCheckPeriod = clientFailureCheckPeriod; this.clientFailureCheckPeriod = clientFailureCheckPeriod;
return this; return this;
} }
@Override
public long getConnectionTTL() { public long getConnectionTTL() {
return connectionTTL; return connectionTTL;
} }
@Override
public ServerLocatorImpl setConnectionTTL(final long connectionTTL) { public ServerLocatorImpl setConnectionTTL(final long connectionTTL) {
checkWrite(); checkWrite();
this.connectionTTL = connectionTTL; this.connectionTTL = connectionTTL;
return this; return this;
} }
@Override
public long getCallTimeout() { public long getCallTimeout() {
return callTimeout; return callTimeout;
} }
@Override
public ServerLocatorImpl setCallTimeout(final long callTimeout) { public ServerLocatorImpl setCallTimeout(final long callTimeout) {
checkWrite(); checkWrite();
this.callTimeout = callTimeout; this.callTimeout = callTimeout;
return this; return this;
} }
@Override
public long getCallFailoverTimeout() { public long getCallFailoverTimeout() {
return callFailoverTimeout; return callFailoverTimeout;
} }
@Override
public ServerLocatorImpl setCallFailoverTimeout(long callFailoverTimeout) { public ServerLocatorImpl setCallFailoverTimeout(long callFailoverTimeout) {
checkWrite(); checkWrite();
this.callFailoverTimeout = callFailoverTimeout; this.callFailoverTimeout = callFailoverTimeout;
return this; return this;
} }
@Override
public int getMinLargeMessageSize() { public int getMinLargeMessageSize() {
return minLargeMessageSize; return minLargeMessageSize;
} }
@Override
public ServerLocatorImpl setMinLargeMessageSize(final int minLargeMessageSize) { public ServerLocatorImpl setMinLargeMessageSize(final int minLargeMessageSize) {
checkWrite(); checkWrite();
this.minLargeMessageSize = minLargeMessageSize; this.minLargeMessageSize = minLargeMessageSize;
return this; return this;
} }
@Override
public int getConsumerWindowSize() { public int getConsumerWindowSize() {
return consumerWindowSize; return consumerWindowSize;
} }
@Override
public ServerLocatorImpl setConsumerWindowSize(final int consumerWindowSize) { public ServerLocatorImpl setConsumerWindowSize(final int consumerWindowSize) {
checkWrite(); checkWrite();
this.consumerWindowSize = consumerWindowSize; this.consumerWindowSize = consumerWindowSize;
return this; return this;
} }
@Override
public int getConsumerMaxRate() { public int getConsumerMaxRate() {
return consumerMaxRate; return consumerMaxRate;
} }
@Override
public ServerLocatorImpl setConsumerMaxRate(final int consumerMaxRate) { public ServerLocatorImpl setConsumerMaxRate(final int consumerMaxRate) {
checkWrite(); checkWrite();
this.consumerMaxRate = consumerMaxRate; this.consumerMaxRate = consumerMaxRate;
return this; return this;
} }
@Override
public int getConfirmationWindowSize() { public int getConfirmationWindowSize() {
return confirmationWindowSize; return confirmationWindowSize;
} }
@Override
public ServerLocatorImpl setConfirmationWindowSize(final int confirmationWindowSize) { public ServerLocatorImpl setConfirmationWindowSize(final int confirmationWindowSize) {
checkWrite(); checkWrite();
this.confirmationWindowSize = confirmationWindowSize; this.confirmationWindowSize = confirmationWindowSize;
return this; return this;
} }
@Override
public int getProducerWindowSize() { public int getProducerWindowSize() {
return producerWindowSize; return producerWindowSize;
} }
@Override
public ServerLocatorImpl setProducerWindowSize(final int producerWindowSize) { public ServerLocatorImpl setProducerWindowSize(final int producerWindowSize) {
checkWrite(); checkWrite();
this.producerWindowSize = producerWindowSize; this.producerWindowSize = producerWindowSize;
return this; return this;
} }
@Override
public int getProducerMaxRate() { public int getProducerMaxRate() {
return producerMaxRate; return producerMaxRate;
} }
@Override
public ServerLocatorImpl setProducerMaxRate(final int producerMaxRate) { public ServerLocatorImpl setProducerMaxRate(final int producerMaxRate) {
checkWrite(); checkWrite();
this.producerMaxRate = producerMaxRate; this.producerMaxRate = producerMaxRate;
return this; return this;
} }
@Override
public boolean isBlockOnAcknowledge() { public boolean isBlockOnAcknowledge() {
return blockOnAcknowledge; return blockOnAcknowledge;
} }
@Override
public ServerLocatorImpl setBlockOnAcknowledge(final boolean blockOnAcknowledge) { public ServerLocatorImpl setBlockOnAcknowledge(final boolean blockOnAcknowledge) {
checkWrite(); checkWrite();
this.blockOnAcknowledge = blockOnAcknowledge; this.blockOnAcknowledge = blockOnAcknowledge;
return this; return this;
} }
@Override
public boolean isBlockOnDurableSend() { public boolean isBlockOnDurableSend() {
return blockOnDurableSend; return blockOnDurableSend;
} }
@Override
public ServerLocatorImpl setBlockOnDurableSend(final boolean blockOnDurableSend) { public ServerLocatorImpl setBlockOnDurableSend(final boolean blockOnDurableSend) {
checkWrite(); checkWrite();
this.blockOnDurableSend = blockOnDurableSend; this.blockOnDurableSend = blockOnDurableSend;
return this; return this;
} }
@Override
public boolean isBlockOnNonDurableSend() { public boolean isBlockOnNonDurableSend() {
return blockOnNonDurableSend; return blockOnNonDurableSend;
} }
@Override
public ServerLocatorImpl setBlockOnNonDurableSend(final boolean blockOnNonDurableSend) { public ServerLocatorImpl setBlockOnNonDurableSend(final boolean blockOnNonDurableSend) {
checkWrite(); checkWrite();
this.blockOnNonDurableSend = blockOnNonDurableSend; this.blockOnNonDurableSend = blockOnNonDurableSend;
return this; return this;
} }
@Override
public boolean isAutoGroup() { public boolean isAutoGroup() {
return autoGroup; return autoGroup;
} }
@Override
public ServerLocatorImpl setAutoGroup(final boolean autoGroup) { public ServerLocatorImpl setAutoGroup(final boolean autoGroup) {
checkWrite(); checkWrite();
this.autoGroup = autoGroup; this.autoGroup = autoGroup;
return this; return this;
} }
@Override
public boolean isPreAcknowledge() { public boolean isPreAcknowledge() {
return preAcknowledge; return preAcknowledge;
} }
@Override
public ServerLocatorImpl setPreAcknowledge(final boolean preAcknowledge) { public ServerLocatorImpl setPreAcknowledge(final boolean preAcknowledge) {
checkWrite(); checkWrite();
this.preAcknowledge = preAcknowledge; this.preAcknowledge = preAcknowledge;
return this; return this;
} }
@Override
public int getAckBatchSize() { public int getAckBatchSize() {
return ackBatchSize; return ackBatchSize;
} }
@Override
public ServerLocatorImpl setAckBatchSize(final int ackBatchSize) { public ServerLocatorImpl setAckBatchSize(final int ackBatchSize) {
checkWrite(); checkWrite();
this.ackBatchSize = ackBatchSize; this.ackBatchSize = ackBatchSize;
return this; return this;
} }
@Override
public boolean isUseGlobalPools() { public boolean isUseGlobalPools() {
return useGlobalPools; return useGlobalPools;
} }
@Override
public ServerLocatorImpl setUseGlobalPools(final boolean useGlobalPools) { public ServerLocatorImpl setUseGlobalPools(final boolean useGlobalPools) {
checkWrite(); checkWrite();
this.useGlobalPools = useGlobalPools; this.useGlobalPools = useGlobalPools;
return this; return this;
} }
@Override
public int getScheduledThreadPoolMaxSize() { public int getScheduledThreadPoolMaxSize() {
return scheduledThreadPoolMaxSize; return scheduledThreadPoolMaxSize;
} }
@Override
public ServerLocatorImpl setScheduledThreadPoolMaxSize(final int scheduledThreadPoolMaxSize) { public ServerLocatorImpl setScheduledThreadPoolMaxSize(final int scheduledThreadPoolMaxSize) {
checkWrite(); checkWrite();
this.scheduledThreadPoolMaxSize = scheduledThreadPoolMaxSize; this.scheduledThreadPoolMaxSize = scheduledThreadPoolMaxSize;
return this; return this;
} }
@Override
public int getThreadPoolMaxSize() { public int getThreadPoolMaxSize() {
return threadPoolMaxSize; return threadPoolMaxSize;
} }
@Override
public ServerLocatorImpl setThreadPoolMaxSize(final int threadPoolMaxSize) { public ServerLocatorImpl setThreadPoolMaxSize(final int threadPoolMaxSize) {
checkWrite(); checkWrite();
this.threadPoolMaxSize = threadPoolMaxSize; this.threadPoolMaxSize = threadPoolMaxSize;
return this; return this;
} }
@Override
public long getRetryInterval() { public long getRetryInterval() {
return retryInterval; return retryInterval;
} }
@Override
public ServerLocatorImpl setRetryInterval(final long retryInterval) { public ServerLocatorImpl setRetryInterval(final long retryInterval) {
checkWrite(); checkWrite();
this.retryInterval = retryInterval; this.retryInterval = retryInterval;
return this; return this;
} }
@Override
public long getMaxRetryInterval() { public long getMaxRetryInterval() {
return maxRetryInterval; return maxRetryInterval;
} }
@Override
public ServerLocatorImpl setMaxRetryInterval(final long retryInterval) { public ServerLocatorImpl setMaxRetryInterval(final long retryInterval) {
checkWrite(); checkWrite();
maxRetryInterval = retryInterval; maxRetryInterval = retryInterval;
return this; return this;
} }
@Override
public double getRetryIntervalMultiplier() { public double getRetryIntervalMultiplier() {
return retryIntervalMultiplier; return retryIntervalMultiplier;
} }
@Override
public ServerLocatorImpl setRetryIntervalMultiplier(final double retryIntervalMultiplier) { public ServerLocatorImpl setRetryIntervalMultiplier(final double retryIntervalMultiplier) {
checkWrite(); checkWrite();
this.retryIntervalMultiplier = retryIntervalMultiplier; this.retryIntervalMultiplier = retryIntervalMultiplier;
return this; return this;
} }
@Override
public int getReconnectAttempts() { public int getReconnectAttempts() {
return reconnectAttempts; return reconnectAttempts;
} }
@Override
public ServerLocatorImpl setReconnectAttempts(final int reconnectAttempts) { public ServerLocatorImpl setReconnectAttempts(final int reconnectAttempts) {
checkWrite(); checkWrite();
this.reconnectAttempts = reconnectAttempts; this.reconnectAttempts = reconnectAttempts;
return this; return this;
} }
@Override
public ServerLocatorImpl setInitialConnectAttempts(int initialConnectAttempts) { public ServerLocatorImpl setInitialConnectAttempts(int initialConnectAttempts) {
checkWrite(); checkWrite();
this.initialConnectAttempts = initialConnectAttempts; this.initialConnectAttempts = initialConnectAttempts;
return this; return this;
} }
@Override
public int getInitialConnectAttempts() { public int getInitialConnectAttempts() {
return initialConnectAttempts; return initialConnectAttempts;
} }
@Override
public boolean isFailoverOnInitialConnection() { public boolean isFailoverOnInitialConnection() {
return this.failoverOnInitialConnection; return this.failoverOnInitialConnection;
} }
@Override
public ServerLocatorImpl setFailoverOnInitialConnection(final boolean failover) { public ServerLocatorImpl setFailoverOnInitialConnection(final boolean failover) {
checkWrite(); checkWrite();
this.failoverOnInitialConnection = failover; this.failoverOnInitialConnection = failover;
return this; return this;
} }
@Override
public String getConnectionLoadBalancingPolicyClassName() { public String getConnectionLoadBalancingPolicyClassName() {
return connectionLoadBalancingPolicyClassName; return connectionLoadBalancingPolicyClassName;
} }
@Override
public ServerLocatorImpl setConnectionLoadBalancingPolicyClassName(final String loadBalancingPolicyClassName) { public ServerLocatorImpl setConnectionLoadBalancingPolicyClassName(final String loadBalancingPolicyClassName) {
checkWrite(); checkWrite();
connectionLoadBalancingPolicyClassName = loadBalancingPolicyClassName; connectionLoadBalancingPolicyClassName = loadBalancingPolicyClassName;
return this; return this;
} }
@Override
public TransportConfiguration[] getStaticTransportConfigurations() { public TransportConfiguration[] getStaticTransportConfigurations() {
if (initialConnectors == null) if (initialConnectors == null)
return new TransportConfiguration[]{}; return new TransportConfiguration[]{};
return Arrays.copyOf(initialConnectors, initialConnectors.length); return Arrays.copyOf(initialConnectors, initialConnectors.length);
} }
@Override
public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration() { public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration() {
return discoveryGroupConfiguration; return discoveryGroupConfiguration;
} }
@Override
public ServerLocatorImpl addIncomingInterceptor(final Interceptor interceptor) { public ServerLocatorImpl addIncomingInterceptor(final Interceptor interceptor) {
incomingInterceptors.add(interceptor); incomingInterceptors.add(interceptor);
return this; return this;
} }
@Override
public ServerLocatorImpl addOutgoingInterceptor(final Interceptor interceptor) { public ServerLocatorImpl addOutgoingInterceptor(final Interceptor interceptor) {
outgoingInterceptors.add(interceptor); outgoingInterceptors.add(interceptor);
return this; return this;
} }
@Override
public boolean removeIncomingInterceptor(final Interceptor interceptor) { public boolean removeIncomingInterceptor(final Interceptor interceptor) {
return incomingInterceptors.remove(interceptor); return incomingInterceptors.remove(interceptor);
} }
@Override
public boolean removeOutgoingInterceptor(final Interceptor interceptor) { public boolean removeOutgoingInterceptor(final Interceptor interceptor) {
return outgoingInterceptors.remove(interceptor); return outgoingInterceptors.remove(interceptor);
} }
@Override
public int getInitialMessagePacketSize() { public int getInitialMessagePacketSize() {
return initialMessagePacketSize; return initialMessagePacketSize;
} }
@Override
public ServerLocatorImpl setInitialMessagePacketSize(final int size) { public ServerLocatorImpl setInitialMessagePacketSize(final int size) {
checkWrite(); checkWrite();
initialMessagePacketSize = size; initialMessagePacketSize = size;
return this; return this;
} }
@Override
public ServerLocatorImpl setGroupID(final String groupID) { public ServerLocatorImpl setGroupID(final String groupID) {
checkWrite(); checkWrite();
this.groupID = groupID; this.groupID = groupID;
return this; return this;
} }
@Override
public String getGroupID() { public String getGroupID() {
return groupID; return groupID;
} }
@Override
public boolean isCompressLargeMessage() { public boolean isCompressLargeMessage() {
return compressLargeMessage; return compressLargeMessage;
} }
@Override
public ServerLocatorImpl setCompressLargeMessage(boolean avoid) { public ServerLocatorImpl setCompressLargeMessage(boolean avoid) {
this.compressLargeMessage = avoid; this.compressLargeMessage = avoid;
return this; return this;
@ -1242,33 +1323,40 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return initialConnectors.length; return initialConnectors.length;
} }
@Override
public ServerLocatorImpl setIdentity(String identity) { public ServerLocatorImpl setIdentity(String identity) {
this.identity = identity; this.identity = identity;
return this; return this;
} }
@Override
public ServerLocatorImpl setNodeID(String nodeID) { public ServerLocatorImpl setNodeID(String nodeID) {
this.nodeID = nodeID; this.nodeID = nodeID;
return this; return this;
} }
@Override
public String getNodeID() { public String getNodeID() {
return nodeID; return nodeID;
} }
@Override
public ServerLocatorImpl setClusterConnection(boolean clusterConnection) { public ServerLocatorImpl setClusterConnection(boolean clusterConnection) {
this.clusterConnection = clusterConnection; this.clusterConnection = clusterConnection;
return this; return this;
} }
@Override
public boolean isClusterConnection() { public boolean isClusterConnection() {
return clusterConnection; return clusterConnection;
} }
@Override
public TransportConfiguration getClusterTransportConfiguration() { public TransportConfiguration getClusterTransportConfiguration() {
return clusterTransportConfiguration; return clusterTransportConfiguration;
} }
@Override
public ServerLocatorImpl setClusterTransportConfiguration(TransportConfiguration tc) { public ServerLocatorImpl setClusterTransportConfiguration(TransportConfiguration tc) {
this.clusterTransportConfiguration = tc; this.clusterTransportConfiguration = tc;
return this; return this;
@ -1283,10 +1371,12 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
super.finalize(); super.finalize();
} }
@Override
public void cleanup() { public void cleanup() {
doClose(false); doClose(false);
} }
@Override
public void close() { public void close() {
doClose(true); doClose(true);
} }
@ -1428,6 +1518,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
@Override
public void notifyNodeUp(long uniqueEventID, public void notifyNodeUp(long uniqueEventID,
final String nodeID, final String nodeID,
final String backupGroupName, final String backupGroupName,
@ -1498,6 +1589,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public synchronized void connectorsChanged(List<DiscoveryEntry> newConnectors) { public synchronized void connectorsChanged(List<DiscoveryEntry> newConnectors) {
if (receivedTopology) { if (receivedTopology) {
return; return;
@ -1522,6 +1614,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
// to trigger the node notification to form the cluster. // to trigger the node notification to form the cluster.
Runnable connectRunnable = new Runnable() { Runnable connectRunnable = new Runnable() {
@Override
public void run() { public void run() {
try { try {
connect(); connect();
@ -1540,6 +1633,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public void factoryClosed(final ClientSessionFactory factory) { public void factoryClosed(final ClientSessionFactory factory) {
boolean isEmpty; boolean isEmpty;
synchronized (factories) { synchronized (factories) {
@ -1557,6 +1651,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public Topology getTopology() { public Topology getTopology() {
return topology; return topology;
} }
@ -1566,11 +1661,13 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return getNumInitialConnectors() > 0 || getDiscoveryGroupConfiguration() != null; return getNumInitialConnectors() > 0 || getDiscoveryGroupConfiguration() != null;
} }
@Override
public ServerLocatorImpl addClusterTopologyListener(final ClusterTopologyListener listener) { public ServerLocatorImpl addClusterTopologyListener(final ClusterTopologyListener listener) {
topology.addClusterTopologyListener(listener); topology.addClusterTopologyListener(listener);
return this; return this;
} }
@Override
public void removeClusterTopologyListener(final ClusterTopologyListener listener) { public void removeClusterTopologyListener(final ClusterTopologyListener listener) {
topology.removeClusterTopologyListener(listener); topology.removeClusterTopologyListener(listener);
} }
@ -1799,6 +1896,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Override
public boolean isClosed() { public boolean isClosed() {
synchronized (stateGuard) { synchronized (stateGuard) {
return state != STATE.INITIALIZED; return state != STATE.INITIALIZED;
@ -1835,6 +1933,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return; return;
} }
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
String[] arrayInterceptor = interceptorList.split(","); String[] arrayInterceptor = interceptorList.split(",");

View File

@ -81,6 +81,7 @@ public interface ServerLocatorInternal extends ServerLocator {
ServerLocatorInternal setClusterTransportConfiguration(TransportConfiguration tc); ServerLocatorInternal setClusterTransportConfiguration(TransportConfiguration tc);
@Override
Topology getTopology(); Topology getTopology();
ClientProtocolManager newProtocolManager(); ClientProtocolManager newProtocolManager();

View File

@ -58,6 +58,7 @@ public final class Topology {
private static final class DirectExecutor implements Executor { private static final class DirectExecutor implements Executor {
@Override
public void execute(final Runnable runnable) { public void execute(final Runnable runnable) {
runnable.run(); runnable.run();
} }
@ -246,6 +247,7 @@ public final class Topology {
if (copy.size() > 0) { if (copy.size() > 0) {
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override
public void run() { public void run() {
for (ClusterTopologyListener listener : copy) { for (ClusterTopologyListener listener : copy) {
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
@ -311,6 +313,7 @@ public final class Topology {
final ArrayList<ClusterTopologyListener> copy = copyListeners(); final ArrayList<ClusterTopologyListener> copy = copyListeners();
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override
public void run() { public void run() {
for (ClusterTopologyListener listener : copy) { for (ClusterTopologyListener listener : copy) {
if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) { if (ActiveMQClientLogger.LOGGER.isTraceEnabled()) {
@ -335,6 +338,7 @@ public final class Topology {
} }
executor.execute(new Runnable() { executor.execute(new Runnable() {
@Override
public void run() { public void run() {
int count = 0; int count = 0;

View File

@ -99,6 +99,7 @@ public final class TopologyMemberImpl implements TopologyMember {
return connector; return connector;
} }
@Override
public boolean isMember(RemotingConnection connection) { public boolean isMember(RemotingConnection connection) {
TransportConfiguration connectorConfig = connection.getTransportConnection() != null ? connection.getTransportConnection().getConnectorConfig() : null; TransportConfiguration connectorConfig = connection.getTransportConnection() != null ? connection.getTransportConnection().getConnectorConfig() : null;
@ -106,6 +107,7 @@ public final class TopologyMemberImpl implements TopologyMember {
} }
@Override
public boolean isMember(TransportConfiguration configuration) { public boolean isMember(TransportConfiguration configuration) {
if (getConnector().getA() != null && getConnector().getA().isSameParams(configuration) || getConnector().getB() != null && getConnector().getB().isSameParams(configuration)) { if (getConnector().getA() != null && getConnector().getA().isSameParams(configuration) || getConnector().getB() != null && getConnector().getB().isSameParams(configuration)) {
return true; return true;

View File

@ -95,6 +95,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
this.notificationService = service; this.notificationService = service;
} }
@Override
public synchronized void start() throws Exception { public synchronized void start() throws Exception {
if (started) { if (started) {
return; return;
@ -132,6 +133,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
runnable.run(); runnable.run();
} }
@Override
public void stop() { public void stop() {
synchronized (this) { synchronized (this) {
if (!started) { if (!started) {
@ -180,6 +182,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
} }
} }
@Override
public boolean isStarted() { public boolean isStarted() {
return started; return started;
} }
@ -245,6 +248,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
class DiscoveryRunnable implements Runnable { class DiscoveryRunnable implements Runnable {
@Override
public void run() { public void run() {
byte[] data = null; byte[] data = null;

View File

@ -170,6 +170,7 @@ public abstract class MessageImpl implements MessageInternal {
// Message implementation ---------------------------------------- // Message implementation ----------------------------------------
@Override
public int getEncodeSize() { public int getEncodeSize() {
int headersPropsSize = getHeadersAndPropertiesEncodeSize(); int headersPropsSize = getHeadersAndPropertiesEncodeSize();
@ -180,6 +181,7 @@ public abstract class MessageImpl implements MessageInternal {
return DataConstants.SIZE_INT + bodySize + DataConstants.SIZE_INT + headersPropsSize; return DataConstants.SIZE_INT + bodySize + DataConstants.SIZE_INT + headersPropsSize;
} }
@Override
public int getHeadersAndPropertiesEncodeSize() { public int getHeadersAndPropertiesEncodeSize() {
return DataConstants.SIZE_LONG + // Message ID return DataConstants.SIZE_LONG + // Message ID
DataConstants.SIZE_BYTE + // user id null? DataConstants.SIZE_BYTE + // user id null?
@ -193,6 +195,7 @@ public abstract class MessageImpl implements MessageInternal {
/* PropertySize and Properties */properties.getEncodeSize(); /* PropertySize and Properties */properties.getEncodeSize();
} }
@Override
public void encodeHeadersAndProperties(final ActiveMQBuffer buffer) { public void encodeHeadersAndProperties(final ActiveMQBuffer buffer) {
buffer.writeLong(messageID); buffer.writeLong(messageID);
buffer.writeNullableSimpleString(address); buffer.writeNullableSimpleString(address);
@ -211,6 +214,7 @@ public abstract class MessageImpl implements MessageInternal {
properties.encode(buffer); properties.encode(buffer);
} }
@Override
public void decodeHeadersAndProperties(final ActiveMQBuffer buffer) { public void decodeHeadersAndProperties(final ActiveMQBuffer buffer) {
messageID = buffer.readLong(); messageID = buffer.readLong();
address = buffer.readNullableSimpleString(); address = buffer.readNullableSimpleString();
@ -242,6 +246,7 @@ public abstract class MessageImpl implements MessageInternal {
properties = msg.getTypedProperties(); properties = msg.getTypedProperties();
} }
@Override
public ActiveMQBuffer getBodyBuffer() { public ActiveMQBuffer getBodyBuffer() {
if (bodyBuffer == null) { if (bodyBuffer == null) {
bodyBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer, this); bodyBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer, this);
@ -250,12 +255,14 @@ public abstract class MessageImpl implements MessageInternal {
return bodyBuffer; return bodyBuffer;
} }
@Override
public Message writeBodyBufferBytes(byte[] bytes) { public Message writeBodyBufferBytes(byte[] bytes) {
getBodyBuffer().writeBytes(bytes); getBodyBuffer().writeBytes(bytes);
return this; return this;
} }
@Override
public Message writeBodyBufferString(String string) { public Message writeBodyBufferString(String string) {
getBodyBuffer().writeString(string); getBodyBuffer().writeString(string);
@ -266,6 +273,7 @@ public abstract class MessageImpl implements MessageInternal {
// no op on regular messages // no op on regular messages
} }
@Override
public synchronized ActiveMQBuffer getBodyBufferCopy() { public synchronized ActiveMQBuffer getBodyBufferCopy() {
// Must copy buffer before sending it // Must copy buffer before sending it
@ -276,14 +284,17 @@ public abstract class MessageImpl implements MessageInternal {
return new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, newBuffer, null); return new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, newBuffer, null);
} }
@Override
public long getMessageID() { public long getMessageID() {
return messageID; return messageID;
} }
@Override
public UUID getUserID() { public UUID getUserID() {
return userID; return userID;
} }
@Override
public MessageImpl setUserID(final UUID userID) { public MessageImpl setUserID(final UUID userID) {
this.userID = userID; this.userID = userID;
return this; return this;
@ -293,6 +304,7 @@ public abstract class MessageImpl implements MessageInternal {
* this doesn't need to be synchronized as setAddress is protecting the buffer, * this doesn't need to be synchronized as setAddress is protecting the buffer,
* not the address * not the address
*/ */
@Override
public SimpleString getAddress() { public SimpleString getAddress() {
return address; return address;
} }
@ -302,6 +314,7 @@ public abstract class MessageImpl implements MessageInternal {
* This synchronization can probably be removed since setAddress is always called from a single thread. * This synchronization can probably be removed since setAddress is always called from a single thread.
* However I will keep it as it's harmless and it's been well tested * However I will keep it as it's harmless and it's been well tested
*/ */
@Override
public Message setAddress(final SimpleString address) { public Message setAddress(final SimpleString address) {
// This is protecting the buffer // This is protecting the buffer
synchronized (this) { synchronized (this) {
@ -315,6 +328,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public byte getType() { public byte getType() {
return type; return type;
} }
@ -323,10 +337,12 @@ public abstract class MessageImpl implements MessageInternal {
this.type = type; this.type = type;
} }
@Override
public boolean isDurable() { public boolean isDurable() {
return durable; return durable;
} }
@Override
public MessageImpl setDurable(final boolean durable) { public MessageImpl setDurable(final boolean durable) {
if (this.durable != durable) { if (this.durable != durable) {
this.durable = durable; this.durable = durable;
@ -336,10 +352,12 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public long getExpiration() { public long getExpiration() {
return expiration; return expiration;
} }
@Override
public MessageImpl setExpiration(final long expiration) { public MessageImpl setExpiration(final long expiration) {
if (this.expiration != expiration) { if (this.expiration != expiration) {
this.expiration = expiration; this.expiration = expiration;
@ -349,10 +367,12 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public long getTimestamp() { public long getTimestamp() {
return timestamp; return timestamp;
} }
@Override
public MessageImpl setTimestamp(final long timestamp) { public MessageImpl setTimestamp(final long timestamp) {
if (this.timestamp != timestamp) { if (this.timestamp != timestamp) {
this.timestamp = timestamp; this.timestamp = timestamp;
@ -362,10 +382,12 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public byte getPriority() { public byte getPriority() {
return priority; return priority;
} }
@Override
public MessageImpl setPriority(final byte priority) { public MessageImpl setPriority(final byte priority) {
if (this.priority != priority) { if (this.priority != priority) {
this.priority = priority; this.priority = priority;
@ -375,6 +397,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public boolean isExpired() { public boolean isExpired() {
if (expiration == 0) { if (expiration == 0) {
return false; return false;
@ -383,6 +406,7 @@ public abstract class MessageImpl implements MessageInternal {
return System.currentTimeMillis() - expiration >= 0; return System.currentTimeMillis() - expiration >= 0;
} }
@Override
public Map<String, Object> toMap() { public Map<String, Object> toMap() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
@ -402,12 +426,14 @@ public abstract class MessageImpl implements MessageInternal {
return map; return map;
} }
@Override
public void decodeFromBuffer(final ActiveMQBuffer buffer) { public void decodeFromBuffer(final ActiveMQBuffer buffer) {
this.buffer = buffer; this.buffer = buffer;
decode(); decode();
} }
@Override
public void bodyChanged() { public void bodyChanged() {
// If the body is changed we must copy the buffer otherwise can affect the previously sent message // If the body is changed we must copy the buffer otherwise can affect the previously sent message
// which might be in the Netty write queue // which might be in the Netty write queue
@ -418,6 +444,7 @@ public abstract class MessageImpl implements MessageInternal {
endOfBodyPosition = -1; endOfBodyPosition = -1;
} }
@Override
public synchronized void checkCopy() { public synchronized void checkCopy() {
if (!copied) { if (!copied) {
forceCopy(); forceCopy();
@ -426,14 +453,17 @@ public abstract class MessageImpl implements MessageInternal {
} }
} }
@Override
public synchronized void resetCopied() { public synchronized void resetCopied() {
copied = false; copied = false;
} }
@Override
public int getEndOfMessagePosition() { public int getEndOfMessagePosition() {
return endOfMessagePosition; return endOfMessagePosition;
} }
@Override
public int getEndOfBodyPosition() { public int getEndOfBodyPosition() {
if (endOfBodyPosition < 0) { if (endOfBodyPosition < 0) {
endOfBodyPosition = buffer.writerIndex(); endOfBodyPosition = buffer.writerIndex();
@ -467,6 +497,7 @@ public abstract class MessageImpl implements MessageInternal {
buff.readerIndex(start + length); buff.readerIndex(start + length);
} }
@Override
public synchronized ActiveMQBuffer getEncodedBuffer() { public synchronized ActiveMQBuffer getEncodedBuffer() {
ActiveMQBuffer buff = encodeToBuffer(); ActiveMQBuffer buff = encodeToBuffer();
@ -486,6 +517,7 @@ public abstract class MessageImpl implements MessageInternal {
} }
} }
@Override
public void setAddressTransient(final SimpleString address) { public void setAddressTransient(final SimpleString address) {
this.address = address; this.address = address;
} }
@ -493,6 +525,7 @@ public abstract class MessageImpl implements MessageInternal {
// Properties // Properties
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@Override
public Message putBooleanProperty(final SimpleString key, final boolean value) { public Message putBooleanProperty(final SimpleString key, final boolean value) {
properties.putBooleanProperty(key, value); properties.putBooleanProperty(key, value);
@ -501,6 +534,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putByteProperty(final SimpleString key, final byte value) { public Message putByteProperty(final SimpleString key, final byte value) {
properties.putByteProperty(key, value); properties.putByteProperty(key, value);
@ -509,6 +543,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putBytesProperty(final SimpleString key, final byte[] value) { public Message putBytesProperty(final SimpleString key, final byte[] value) {
properties.putBytesProperty(key, value); properties.putBytesProperty(key, value);
@ -533,6 +568,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putShortProperty(final SimpleString key, final short value) { public Message putShortProperty(final SimpleString key, final short value) {
properties.putShortProperty(key, value); properties.putShortProperty(key, value);
bufferValid = false; bufferValid = false;
@ -540,6 +576,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putIntProperty(final SimpleString key, final int value) { public Message putIntProperty(final SimpleString key, final int value) {
properties.putIntProperty(key, value); properties.putIntProperty(key, value);
bufferValid = false; bufferValid = false;
@ -547,6 +584,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putLongProperty(final SimpleString key, final long value) { public Message putLongProperty(final SimpleString key, final long value) {
properties.putLongProperty(key, value); properties.putLongProperty(key, value);
bufferValid = false; bufferValid = false;
@ -554,6 +592,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putFloatProperty(final SimpleString key, final float value) { public Message putFloatProperty(final SimpleString key, final float value) {
properties.putFloatProperty(key, value); properties.putFloatProperty(key, value);
@ -562,6 +601,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putDoubleProperty(final SimpleString key, final double value) { public Message putDoubleProperty(final SimpleString key, final double value) {
properties.putDoubleProperty(key, value); properties.putDoubleProperty(key, value);
@ -570,6 +610,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putStringProperty(final SimpleString key, final SimpleString value) { public Message putStringProperty(final SimpleString key, final SimpleString value) {
properties.putSimpleStringProperty(key, value); properties.putSimpleStringProperty(key, value);
@ -578,6 +619,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putObjectProperty(final SimpleString key, public Message putObjectProperty(final SimpleString key,
final Object value) throws ActiveMQPropertyConversionException { final Object value) throws ActiveMQPropertyConversionException {
TypedProperties.setObjectProperty(key, value, properties); TypedProperties.setObjectProperty(key, value, properties);
@ -586,6 +628,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putObjectProperty(final String key, final Object value) throws ActiveMQPropertyConversionException { public Message putObjectProperty(final String key, final Object value) throws ActiveMQPropertyConversionException {
putObjectProperty(new SimpleString(key), value); putObjectProperty(new SimpleString(key), value);
@ -594,6 +637,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putBooleanProperty(final String key, final boolean value) { public Message putBooleanProperty(final String key, final boolean value) {
properties.putBooleanProperty(new SimpleString(key), value); properties.putBooleanProperty(new SimpleString(key), value);
@ -602,6 +646,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putByteProperty(final String key, final byte value) { public Message putByteProperty(final String key, final byte value) {
properties.putByteProperty(new SimpleString(key), value); properties.putByteProperty(new SimpleString(key), value);
@ -610,6 +655,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putBytesProperty(final String key, final byte[] value) { public Message putBytesProperty(final String key, final byte[] value) {
properties.putBytesProperty(new SimpleString(key), value); properties.putBytesProperty(new SimpleString(key), value);
@ -618,6 +664,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putShortProperty(final String key, final short value) { public Message putShortProperty(final String key, final short value) {
properties.putShortProperty(new SimpleString(key), value); properties.putShortProperty(new SimpleString(key), value);
@ -626,6 +673,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putIntProperty(final String key, final int value) { public Message putIntProperty(final String key, final int value) {
properties.putIntProperty(new SimpleString(key), value); properties.putIntProperty(new SimpleString(key), value);
@ -634,6 +682,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putLongProperty(final String key, final long value) { public Message putLongProperty(final String key, final long value) {
properties.putLongProperty(new SimpleString(key), value); properties.putLongProperty(new SimpleString(key), value);
@ -642,6 +691,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putFloatProperty(final String key, final float value) { public Message putFloatProperty(final String key, final float value) {
properties.putFloatProperty(new SimpleString(key), value); properties.putFloatProperty(new SimpleString(key), value);
@ -650,6 +700,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putDoubleProperty(final String key, final double value) { public Message putDoubleProperty(final String key, final double value) {
properties.putDoubleProperty(new SimpleString(key), value); properties.putDoubleProperty(new SimpleString(key), value);
@ -658,6 +709,7 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Message putStringProperty(final String key, final String value) { public Message putStringProperty(final String key, final String value) {
properties.putSimpleStringProperty(new SimpleString(key), SimpleString.toSimpleString(value)); properties.putSimpleStringProperty(new SimpleString(key), SimpleString.toSimpleString(value));
@ -674,74 +726,92 @@ public abstract class MessageImpl implements MessageInternal {
return this; return this;
} }
@Override
public Object getObjectProperty(final SimpleString key) { public Object getObjectProperty(final SimpleString key) {
return properties.getProperty(key); return properties.getProperty(key);
} }
@Override
public Boolean getBooleanProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Boolean getBooleanProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getBooleanProperty(key); return properties.getBooleanProperty(key);
} }
@Override
public Boolean getBooleanProperty(final String key) throws ActiveMQPropertyConversionException { public Boolean getBooleanProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getBooleanProperty(new SimpleString(key)); return properties.getBooleanProperty(new SimpleString(key));
} }
@Override
public Byte getByteProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Byte getByteProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getByteProperty(key); return properties.getByteProperty(key);
} }
@Override
public Byte getByteProperty(final String key) throws ActiveMQPropertyConversionException { public Byte getByteProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getByteProperty(new SimpleString(key)); return properties.getByteProperty(new SimpleString(key));
} }
@Override
public byte[] getBytesProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public byte[] getBytesProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getBytesProperty(key); return properties.getBytesProperty(key);
} }
@Override
public byte[] getBytesProperty(final String key) throws ActiveMQPropertyConversionException { public byte[] getBytesProperty(final String key) throws ActiveMQPropertyConversionException {
return getBytesProperty(new SimpleString(key)); return getBytesProperty(new SimpleString(key));
} }
@Override
public Double getDoubleProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Double getDoubleProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getDoubleProperty(key); return properties.getDoubleProperty(key);
} }
@Override
public Double getDoubleProperty(final String key) throws ActiveMQPropertyConversionException { public Double getDoubleProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getDoubleProperty(new SimpleString(key)); return properties.getDoubleProperty(new SimpleString(key));
} }
@Override
public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Integer getIntProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getIntProperty(key); return properties.getIntProperty(key);
} }
@Override
public Integer getIntProperty(final String key) throws ActiveMQPropertyConversionException { public Integer getIntProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getIntProperty(new SimpleString(key)); return properties.getIntProperty(new SimpleString(key));
} }
@Override
public Long getLongProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Long getLongProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getLongProperty(key); return properties.getLongProperty(key);
} }
@Override
public Long getLongProperty(final String key) throws ActiveMQPropertyConversionException { public Long getLongProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getLongProperty(new SimpleString(key)); return properties.getLongProperty(new SimpleString(key));
} }
@Override
public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Short getShortProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getShortProperty(key); return properties.getShortProperty(key);
} }
@Override
public Short getShortProperty(final String key) throws ActiveMQPropertyConversionException { public Short getShortProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getShortProperty(new SimpleString(key)); return properties.getShortProperty(new SimpleString(key));
} }
@Override
public Float getFloatProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public Float getFloatProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getFloatProperty(key); return properties.getFloatProperty(key);
} }
@Override
public Float getFloatProperty(final String key) throws ActiveMQPropertyConversionException { public Float getFloatProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getFloatProperty(new SimpleString(key)); return properties.getFloatProperty(new SimpleString(key));
} }
@Override
public String getStringProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public String getStringProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
SimpleString str = getSimpleStringProperty(key); SimpleString str = getSimpleStringProperty(key);
@ -753,54 +823,66 @@ public abstract class MessageImpl implements MessageInternal {
} }
} }
@Override
public String getStringProperty(final String key) throws ActiveMQPropertyConversionException { public String getStringProperty(final String key) throws ActiveMQPropertyConversionException {
return getStringProperty(new SimpleString(key)); return getStringProperty(new SimpleString(key));
} }
@Override
public SimpleString getSimpleStringProperty(final SimpleString key) throws ActiveMQPropertyConversionException { public SimpleString getSimpleStringProperty(final SimpleString key) throws ActiveMQPropertyConversionException {
return properties.getSimpleStringProperty(key); return properties.getSimpleStringProperty(key);
} }
@Override
public SimpleString getSimpleStringProperty(final String key) throws ActiveMQPropertyConversionException { public SimpleString getSimpleStringProperty(final String key) throws ActiveMQPropertyConversionException {
return properties.getSimpleStringProperty(new SimpleString(key)); return properties.getSimpleStringProperty(new SimpleString(key));
} }
@Override
public Object getObjectProperty(final String key) { public Object getObjectProperty(final String key) {
return properties.getProperty(new SimpleString(key)); return properties.getProperty(new SimpleString(key));
} }
@Override
public Object removeProperty(final SimpleString key) { public Object removeProperty(final SimpleString key) {
bufferValid = false; bufferValid = false;
return properties.removeProperty(key); return properties.removeProperty(key);
} }
@Override
public Object removeProperty(final String key) { public Object removeProperty(final String key) {
bufferValid = false; bufferValid = false;
return properties.removeProperty(new SimpleString(key)); return properties.removeProperty(new SimpleString(key));
} }
@Override
public boolean containsProperty(final SimpleString key) { public boolean containsProperty(final SimpleString key) {
return properties.containsProperty(key); return properties.containsProperty(key);
} }
@Override
public boolean containsProperty(final String key) { public boolean containsProperty(final String key) {
return properties.containsProperty(new SimpleString(key)); return properties.containsProperty(new SimpleString(key));
} }
@Override
public Set<SimpleString> getPropertyNames() { public Set<SimpleString> getPropertyNames() {
return properties.getPropertyNames(); return properties.getPropertyNames();
} }
@Override
public ActiveMQBuffer getWholeBuffer() { public ActiveMQBuffer getWholeBuffer() {
return buffer; return buffer;
} }
@Override
public BodyEncoder getBodyEncoder() throws ActiveMQException { public BodyEncoder getBodyEncoder() throws ActiveMQException {
return new DecodingContext(); return new DecodingContext();
} }
@Override
public TypedProperties getTypedProperties() { public TypedProperties getTypedProperties() {
return this.properties; return this.properties;
} }
@ -956,21 +1038,26 @@ public abstract class MessageImpl implements MessageInternal {
public DecodingContext() { public DecodingContext() {
} }
@Override
public void open() { public void open() {
} }
@Override
public void close() { public void close() {
} }
@Override
public long getLargeBodySize() { public long getLargeBodySize() {
return buffer.writerIndex(); return buffer.writerIndex();
} }
@Override
public int encode(final ByteBuffer bufferRead) throws ActiveMQException { public int encode(final ByteBuffer bufferRead) throws ActiveMQException {
ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer(bufferRead); ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer(bufferRead);
return encode(buffer, bufferRead.capacity()); return encode(buffer, bufferRead.capacity());
} }
@Override
public int encode(final ActiveMQBuffer bufferOut, final int size) { public int encode(final ActiveMQBuffer bufferOut, final int size) {
bufferOut.writeBytes(getWholeBuffer(), lastPos, size); bufferOut.writeBytes(getWholeBuffer(), lastPos, size);
lastPos += size; lastPos += size;

View File

@ -109,14 +109,17 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
public ActiveMQClientProtocolManager() { public ActiveMQClientProtocolManager() {
} }
@Override
public String getName() { public String getName() {
return ActiveMQClient.DEFAULT_CORE_PROTOCOL; return ActiveMQClient.DEFAULT_CORE_PROTOCOL;
} }
@Override
public void setSessionFactory(ClientSessionFactory factory) { public void setSessionFactory(ClientSessionFactory factory) {
this.factoryInternal = (ClientSessionFactoryInternal) factory; this.factoryInternal = (ClientSessionFactoryInternal) factory;
} }
@Override
public ClientSessionFactory getSessionFactory() { public ClientSessionFactory getSessionFactory() {
return this.factoryInternal; return this.factoryInternal;
} }
@ -126,6 +129,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
pipeline.addLast("activemq-decoder", new ActiveMQFrameDecoder2()); pipeline.addLast("activemq-decoder", new ActiveMQFrameDecoder2());
} }
@Override
public boolean waitOnLatch(long milliseconds) throws InterruptedException { public boolean waitOnLatch(long milliseconds) throws InterruptedException {
return waitLatch.await(milliseconds, TimeUnit.MILLISECONDS); return waitLatch.await(milliseconds, TimeUnit.MILLISECONDS);
} }
@ -139,6 +143,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
} }
} }
@Override
public RemotingConnection getCurrentConnection() { public RemotingConnection getCurrentConnection() {
return connection; return connection;
} }
@ -152,6 +157,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
} }
} }
@Override
public Lock lockSessionCreation() { public Lock lockSessionCreation() {
try { try {
Lock localFailoverLock = factoryInternal.lockFailover(); Lock localFailoverLock = factoryInternal.lockFailover();
@ -179,6 +185,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
} }
} }
@Override
public void stop() { public void stop() {
alive = false; alive = false;
@ -196,6 +203,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
} }
@Override
public boolean isAlive() { public boolean isAlive() {
return alive; return alive;
} }
@ -351,6 +359,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
return new ActiveMQSessionContext(name, connection, sessionChannel, response.getServerVersion(), confirmationWindowSize); return new ActiveMQSessionContext(name, connection, sessionChannel, response.getServerVersion(), confirmationWindowSize);
} }
@Override
public boolean cleanupBeforeFailover(ActiveMQException cause) { public boolean cleanupBeforeFailover(ActiveMQException cause) {
boolean needToInterrupt; boolean needToInterrupt;
@ -401,6 +410,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
return message.isOkToFailover(); return message.isOkToFailover();
} }
@Override
public RemotingConnection connect(Connection transportConnection, public RemotingConnection connect(Connection transportConnection,
long callTimeout, long callTimeout,
long callFailoverTimeout, long callFailoverTimeout,
@ -435,6 +445,7 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
this.conn = conn; this.conn = conn;
} }
@Override
public void handlePacket(final Packet packet) { public void handlePacket(final Packet packet) {
final byte type = packet.getType(); final byte type = packet.getType();

View File

@ -45,6 +45,7 @@ public class ActiveMQClientProtocolManagerFactory implements ClientProtocolManag
return factory; return factory;
} }
@Override
public ClientProtocolManager newProtocolManager() { public ClientProtocolManager newProtocolManager() {
return new ActiveMQClientProtocolManager(); return new ActiveMQClientProtocolManager();
} }

View File

@ -122,6 +122,7 @@ public class ActiveMQSessionContext extends SessionContext {
return name; return name;
} }
@Override
public void resetName(String name) { public void resetName(String name) {
this.name = name; this.name = name;
} }
@ -153,6 +154,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
private final CommandConfirmationHandler confirmationHandler = new CommandConfirmationHandler() { private final CommandConfirmationHandler confirmationHandler = new CommandConfirmationHandler() {
@Override
public void commandConfirmed(final Packet packet) { public void commandConfirmed(final Packet packet) {
if (packet.getType() == PacketImpl.SESS_SEND) { if (packet.getType() == PacketImpl.SESS_SEND) {
SessionSendMessage ssm = (SessionSendMessage) packet; SessionSendMessage ssm = (SessionSendMessage) packet;
@ -195,6 +197,7 @@ public class ActiveMQSessionContext extends SessionContext {
sessionChannel.unlock(); sessionChannel.unlock();
} }
@Override
public void cleanup() { public void cleanup() {
sessionChannel.close(); sessionChannel.close();
@ -208,11 +211,13 @@ public class ActiveMQSessionContext extends SessionContext {
// nothing to be done here... Flow control here is done on the core side // nothing to be done here... Flow control here is done on the core side
} }
@Override
public void setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) { public void setSendAcknowledgementHandler(final SendAcknowledgementHandler handler) {
sessionChannel.setCommandConfirmationHandler(confirmationHandler); sessionChannel.setCommandConfirmationHandler(confirmationHandler);
this.sendAckHandler = handler; this.sendAckHandler = handler;
} }
@Override
public void createSharedQueue(SimpleString address, public void createSharedQueue(SimpleString address,
SimpleString queueName, SimpleString queueName,
SimpleString filterString, SimpleString filterString,
@ -220,10 +225,12 @@ public class ActiveMQSessionContext extends SessionContext {
sessionChannel.sendBlocking(new CreateSharedQueueMessage(address, queueName, filterString, durable, true), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new CreateSharedQueueMessage(address, queueName, filterString, durable, true), PacketImpl.NULL_RESPONSE);
} }
@Override
public void deleteQueue(final SimpleString queueName) throws ActiveMQException { public void deleteQueue(final SimpleString queueName) throws ActiveMQException {
sessionChannel.sendBlocking(new SessionDeleteQueueMessage(queueName), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new SessionDeleteQueueMessage(queueName), PacketImpl.NULL_RESPONSE);
} }
@Override
public ClientSession.QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException { public ClientSession.QueueQuery queueQuery(final SimpleString queueName) throws ActiveMQException {
SessionQueueQueryMessage request = new SessionQueueQueryMessage(queueName); SessionQueueQueryMessage request = new SessionQueueQueryMessage(queueName);
SessionQueueQueryResponseMessage_V2 response = (SessionQueueQueryResponseMessage_V2) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V2); SessionQueueQueryResponseMessage_V2 response = (SessionQueueQueryResponseMessage_V2) sessionChannel.sendBlocking(request, PacketImpl.SESS_QUEUEQUERY_RESP_V2);
@ -231,6 +238,7 @@ public class ActiveMQSessionContext extends SessionContext {
return response.toQueueQuery(); return response.toQueueQuery();
} }
@Override
public ClientConsumerInternal createConsumer(SimpleString queueName, public ClientConsumerInternal createConsumer(SimpleString queueName,
SimpleString filterString, SimpleString filterString,
int windowSize, int windowSize,
@ -254,10 +262,12 @@ public class ActiveMQSessionContext extends SessionContext {
return new ClientConsumerImpl(session, consumerContext, queueName, filterString, browseOnly, calcWindowSize(windowSize), ackBatchSize, maxRate > 0 ? new TokenBucketLimiterImpl(maxRate, false) : null, executor, flowControlExecutor, this, queueInfo.toQueueQuery(), lookupTCCL()); return new ClientConsumerImpl(session, consumerContext, queueName, filterString, browseOnly, calcWindowSize(windowSize), ackBatchSize, maxRate > 0 ? new TokenBucketLimiterImpl(maxRate, false) : null, executor, flowControlExecutor, this, queueInfo.toQueueQuery(), lookupTCCL());
} }
@Override
public int getServerVersion() { public int getServerVersion() {
return serverVersion; return serverVersion;
} }
@Override
public ClientSession.AddressQuery addressQuery(final SimpleString address) throws ActiveMQException { public ClientSession.AddressQuery addressQuery(final SimpleString address) throws ActiveMQException {
SessionBindingQueryResponseMessage_V2 response = (SessionBindingQueryResponseMessage_V2) sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V2); SessionBindingQueryResponseMessage_V2 response = (SessionBindingQueryResponseMessage_V2) sessionChannel.sendBlocking(new SessionBindingQueryMessage(address), PacketImpl.SESS_BINDINGQUERY_RESP_V2);
@ -269,39 +279,48 @@ public class ActiveMQSessionContext extends SessionContext {
sessionChannel.sendBlocking(new SessionConsumerCloseMessage(getConsumerID(consumer)), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new SessionConsumerCloseMessage(getConsumerID(consumer)), PacketImpl.NULL_RESPONSE);
} }
@Override
public void sendConsumerCredits(final ClientConsumer consumer, final int credits) { public void sendConsumerCredits(final ClientConsumer consumer, final int credits) {
sessionChannel.send(new SessionConsumerFlowCreditMessage(getConsumerID(consumer), credits)); sessionChannel.send(new SessionConsumerFlowCreditMessage(getConsumerID(consumer), credits));
} }
@Override
public void forceDelivery(final ClientConsumer consumer, final long sequence) throws ActiveMQException { public void forceDelivery(final ClientConsumer consumer, final long sequence) throws ActiveMQException {
SessionForceConsumerDelivery request = new SessionForceConsumerDelivery(getConsumerID(consumer), sequence); SessionForceConsumerDelivery request = new SessionForceConsumerDelivery(getConsumerID(consumer), sequence);
sessionChannel.send(request); sessionChannel.send(request);
} }
@Override
public void simpleCommit() throws ActiveMQException { public void simpleCommit() throws ActiveMQException {
sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_COMMIT), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_COMMIT), PacketImpl.NULL_RESPONSE);
} }
@Override
public void simpleRollback(boolean lastMessageAsDelivered) throws ActiveMQException { public void simpleRollback(boolean lastMessageAsDelivered) throws ActiveMQException {
sessionChannel.sendBlocking(new RollbackMessage(lastMessageAsDelivered), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new RollbackMessage(lastMessageAsDelivered), PacketImpl.NULL_RESPONSE);
} }
@Override
public void sessionStart() throws ActiveMQException { public void sessionStart() throws ActiveMQException {
sessionChannel.send(new PacketImpl(PacketImpl.SESS_START)); sessionChannel.send(new PacketImpl(PacketImpl.SESS_START));
} }
@Override
public void sessionStop() throws ActiveMQException { public void sessionStop() throws ActiveMQException {
sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_STOP), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_STOP), PacketImpl.NULL_RESPONSE);
} }
@Override
public void addSessionMetadata(String key, String data) throws ActiveMQException { public void addSessionMetadata(String key, String data) throws ActiveMQException {
sessionChannel.sendBlocking(new SessionAddMetaDataMessageV2(key, data), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new SessionAddMetaDataMessageV2(key, data), PacketImpl.NULL_RESPONSE);
} }
@Override
public void addUniqueMetaData(String key, String data) throws ActiveMQException { public void addUniqueMetaData(String key, String data) throws ActiveMQException {
sessionChannel.sendBlocking(new SessionUniqueAddMetaDataMessage(key, data), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new SessionUniqueAddMetaDataMessage(key, data), PacketImpl.NULL_RESPONSE);
} }
@Override
public void xaCommit(Xid xid, boolean onePhase) throws XAException, ActiveMQException { public void xaCommit(Xid xid, boolean onePhase) throws XAException, ActiveMQException {
SessionXACommitMessage packet = new SessionXACommitMessage(xid, onePhase); SessionXACommitMessage packet = new SessionXACommitMessage(xid, onePhase);
SessionXAResponseMessage response = (SessionXAResponseMessage) sessionChannel.sendBlocking(packet, PacketImpl.SESS_XA_RESP); SessionXAResponseMessage response = (SessionXAResponseMessage) sessionChannel.sendBlocking(packet, PacketImpl.SESS_XA_RESP);
@ -315,6 +334,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public void xaEnd(Xid xid, int flags) throws XAException, ActiveMQException { public void xaEnd(Xid xid, int flags) throws XAException, ActiveMQException {
Packet packet; Packet packet;
if (flags == XAResource.TMSUSPEND) { if (flags == XAResource.TMSUSPEND) {
@ -337,6 +357,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public void sendProducerCreditsMessage(final int credits, final SimpleString address) { public void sendProducerCreditsMessage(final int credits, final SimpleString address) {
sessionChannel.send(new SessionRequestProducerCreditsMessage(credits, address)); sessionChannel.send(new SessionRequestProducerCreditsMessage(credits, address));
} }
@ -346,6 +367,7 @@ public class ActiveMQSessionContext extends SessionContext {
* *
* @return * @return
*/ */
@Override
public boolean supportsLargeMessage() { public boolean supportsLargeMessage() {
return true; return true;
} }
@ -355,6 +377,7 @@ public class ActiveMQSessionContext extends SessionContext {
return msgI.getEncodeSize(); return msgI.getEncodeSize();
} }
@Override
public void sendFullMessage(MessageInternal msgI, public void sendFullMessage(MessageInternal msgI,
boolean sendBlocking, boolean sendBlocking,
SendAcknowledgementHandler handler, SendAcknowledgementHandler handler,
@ -399,6 +422,7 @@ public class ActiveMQSessionContext extends SessionContext {
return chunkPacket.getPacketSize(); return chunkPacket.getPacketSize();
} }
@Override
public void sendACK(boolean individual, public void sendACK(boolean individual,
boolean block, boolean block,
final ClientConsumer consumer, final ClientConsumer consumer,
@ -419,16 +443,19 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public void expireMessage(final ClientConsumer consumer, Message message) throws ActiveMQException { public void expireMessage(final ClientConsumer consumer, Message message) throws ActiveMQException {
SessionExpireMessage messagePacket = new SessionExpireMessage(getConsumerID(consumer), message.getMessageID()); SessionExpireMessage messagePacket = new SessionExpireMessage(getConsumerID(consumer), message.getMessageID());
sessionChannel.send(messagePacket); sessionChannel.send(messagePacket);
} }
@Override
public void sessionClose() throws ActiveMQException { public void sessionClose() throws ActiveMQException {
sessionChannel.sendBlocking(new SessionCloseMessage(), PacketImpl.NULL_RESPONSE); sessionChannel.sendBlocking(new SessionCloseMessage(), PacketImpl.NULL_RESPONSE);
} }
@Override
public void xaForget(Xid xid) throws XAException, ActiveMQException { public void xaForget(Xid xid) throws XAException, ActiveMQException {
SessionXAResponseMessage response = (SessionXAResponseMessage) sessionChannel.sendBlocking(new SessionXAForgetMessage(xid), PacketImpl.SESS_XA_RESP); SessionXAResponseMessage response = (SessionXAResponseMessage) sessionChannel.sendBlocking(new SessionXAForgetMessage(xid), PacketImpl.SESS_XA_RESP);
@ -437,6 +464,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public int xaPrepare(Xid xid) throws XAException, ActiveMQException { public int xaPrepare(Xid xid) throws XAException, ActiveMQException {
SessionXAPrepareMessage packet = new SessionXAPrepareMessage(xid); SessionXAPrepareMessage packet = new SessionXAPrepareMessage(xid);
@ -450,6 +478,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public Xid[] xaScan() throws ActiveMQException { public Xid[] xaScan() throws ActiveMQException {
SessionXAGetInDoubtXidsResponseMessage response = (SessionXAGetInDoubtXidsResponseMessage) sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS), PacketImpl.SESS_XA_INDOUBT_XIDS_RESP); SessionXAGetInDoubtXidsResponseMessage response = (SessionXAGetInDoubtXidsResponseMessage) sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_XA_INDOUBT_XIDS), PacketImpl.SESS_XA_INDOUBT_XIDS_RESP);
@ -460,6 +489,7 @@ public class ActiveMQSessionContext extends SessionContext {
return xidArray; return xidArray;
} }
@Override
public void xaRollback(Xid xid, boolean wasStarted) throws ActiveMQException, XAException { public void xaRollback(Xid xid, boolean wasStarted) throws ActiveMQException, XAException {
SessionXARollbackMessage packet = new SessionXARollbackMessage(xid); SessionXARollbackMessage packet = new SessionXARollbackMessage(xid);
@ -470,6 +500,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public void xaStart(Xid xid, int flags) throws XAException, ActiveMQException { public void xaStart(Xid xid, int flags) throws XAException, ActiveMQException {
Packet packet; Packet packet;
if (flags == XAResource.TMJOIN) { if (flags == XAResource.TMJOIN) {
@ -494,18 +525,21 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public boolean configureTransactionTimeout(int seconds) throws ActiveMQException { public boolean configureTransactionTimeout(int seconds) throws ActiveMQException {
SessionXASetTimeoutResponseMessage response = (SessionXASetTimeoutResponseMessage) sessionChannel.sendBlocking(new SessionXASetTimeoutMessage(seconds), PacketImpl.SESS_XA_SET_TIMEOUT_RESP); SessionXASetTimeoutResponseMessage response = (SessionXASetTimeoutResponseMessage) sessionChannel.sendBlocking(new SessionXASetTimeoutMessage(seconds), PacketImpl.SESS_XA_SET_TIMEOUT_RESP);
return response.isOK(); return response.isOK();
} }
@Override
public int recoverSessionTimeout() throws ActiveMQException { public int recoverSessionTimeout() throws ActiveMQException {
SessionXAGetTimeoutResponseMessage response = (SessionXAGetTimeoutResponseMessage) sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT), PacketImpl.SESS_XA_GET_TIMEOUT_RESP); SessionXAGetTimeoutResponseMessage response = (SessionXAGetTimeoutResponseMessage) sessionChannel.sendBlocking(new PacketImpl(PacketImpl.SESS_XA_GET_TIMEOUT), PacketImpl.SESS_XA_GET_TIMEOUT_RESP);
return response.getTimeoutSeconds(); return response.getTimeoutSeconds();
} }
@Override
public void createQueue(SimpleString address, public void createQueue(SimpleString address,
SimpleString queueName, SimpleString queueName,
SimpleString filterString, SimpleString filterString,
@ -546,6 +580,7 @@ public class ActiveMQSessionContext extends SessionContext {
} }
@Override
public void recreateSession(final String username, public void recreateSession(final String username,
final String password, final String password,
final int minLargeMessageSize, final int minLargeMessageSize,
@ -624,10 +659,12 @@ public class ActiveMQSessionContext extends SessionContext {
} }
} }
@Override
public void xaFailed(Xid xid) throws ActiveMQException { public void xaFailed(Xid xid) throws ActiveMQException {
sendPacketWithoutLock(sessionChannel, new SessionXAAfterFailedMessage(xid)); sendPacketWithoutLock(sessionChannel, new SessionXAAfterFailedMessage(xid));
} }
@Override
public void restartSession() throws ActiveMQException { public void restartSession() throws ActiveMQException {
sendPacketWithoutLock(sessionChannel, new PacketImpl(PacketImpl.SESS_START)); sendPacketWithoutLock(sessionChannel, new PacketImpl(PacketImpl.SESS_START));
} }
@ -693,6 +730,7 @@ public class ActiveMQSessionContext extends SessionContext {
class ClientSessionPacketHandler implements ChannelHandler { class ClientSessionPacketHandler implements ChannelHandler {
@Override
public void handlePacket(final Packet packet) { public void handlePacket(final Packet packet) {
byte type = packet.getType(); byte type = packet.getType();
@ -755,6 +793,7 @@ public class ActiveMQSessionContext extends SessionContext {
protected ClassLoader lookupTCCL() { protected ClassLoader lookupTCCL() {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() { public ClassLoader run() {
return Thread.currentThread().getContextClassLoader(); return Thread.currentThread().getContextClassLoader();
} }

View File

@ -139,6 +139,7 @@ public final class ChannelImpl implements Channel {
this.interceptors = interceptors; this.interceptors = interceptors;
} }
@Override
public boolean supports(final byte packetType) { public boolean supports(final byte packetType) {
int version = connection.getClientVersion(); int version = connection.getClientVersion();
@ -160,26 +161,32 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public long getID() { public long getID() {
return id; return id;
} }
@Override
public int getLastConfirmedCommandID() { public int getLastConfirmedCommandID() {
return lastConfirmedCommandID.get(); return lastConfirmedCommandID.get();
} }
@Override
public Lock getLock() { public Lock getLock() {
return lock; return lock;
} }
@Override
public int getConfirmationWindowSize() { public int getConfirmationWindowSize() {
return confWindowSize; return confWindowSize;
} }
@Override
public void returnBlocking() { public void returnBlocking() {
returnBlocking(null); returnBlocking(null);
} }
@Override
public void returnBlocking(Throwable cause) { public void returnBlocking(Throwable cause) {
lock.lock(); lock.lock();
@ -193,18 +200,22 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public boolean sendAndFlush(final Packet packet) { public boolean sendAndFlush(final Packet packet) {
return send(packet, true, false); return send(packet, true, false);
} }
@Override
public boolean send(final Packet packet) { public boolean send(final Packet packet) {
return send(packet, false, false); return send(packet, false, false);
} }
@Override
public boolean sendBatched(final Packet packet) { public boolean sendBatched(final Packet packet) {
return send(packet, false, true); return send(packet, false, true);
} }
@Override
public void setTransferring(boolean transferring) { public void setTransferring(boolean transferring) {
this.transferring = transferring; this.transferring = transferring;
} }
@ -273,6 +284,7 @@ public final class ChannelImpl implements Channel {
* and the client could eventually retry another call, but the server could then answer a previous command issuing a class-cast-exception. * and the client could eventually retry another call, but the server could then answer a previous command issuing a class-cast-exception.
* The expectedPacket will be used to filter out undesirable packets that would belong to previous calls. * The expectedPacket will be used to filter out undesirable packets that would belong to previous calls.
*/ */
@Override
public Packet sendBlocking(final Packet packet, byte expectedPacket) throws ActiveMQException { public Packet sendBlocking(final Packet packet, byte expectedPacket) throws ActiveMQException {
String interceptionResult = invokeInterceptors(packet, interceptors, connection); String interceptionResult = invokeInterceptors(packet, interceptors, connection);
@ -408,6 +420,7 @@ public final class ChannelImpl implements Channel {
return null; return null;
} }
@Override
public void setCommandConfirmationHandler(final CommandConfirmationHandler handler) { public void setCommandConfirmationHandler(final CommandConfirmationHandler handler) {
if (confWindowSize < 0) { if (confWindowSize < 0) {
final String msg = "You can't set confirmationHandler on a connection with confirmation-window-size < 0." + " Look at the documentation for more information."; final String msg = "You can't set confirmationHandler on a connection with confirmation-window-size < 0." + " Look at the documentation for more information.";
@ -416,14 +429,17 @@ public final class ChannelImpl implements Channel {
commandConfirmationHandler = handler; commandConfirmationHandler = handler;
} }
@Override
public void setHandler(final ChannelHandler handler) { public void setHandler(final ChannelHandler handler) {
this.handler = handler; this.handler = handler;
} }
@Override
public ChannelHandler getHandler() { public ChannelHandler getHandler() {
return handler; return handler;
} }
@Override
public void close() { public void close() {
if (closed) { if (closed) {
return; return;
@ -439,6 +455,7 @@ public final class ChannelImpl implements Channel {
closed = true; closed = true;
} }
@Override
public void transferConnection(final CoreRemotingConnection newConnection) { public void transferConnection(final CoreRemotingConnection newConnection) {
// Needs to synchronize on the connection to make sure no packets from // Needs to synchronize on the connection to make sure no packets from
// the old connection get processed after transfer has occurred // the old connection get processed after transfer has occurred
@ -457,6 +474,7 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public void replayCommands(final int otherLastConfirmedCommandID) { public void replayCommands(final int otherLastConfirmedCommandID) {
if (resendCache != null) { if (resendCache != null) {
if (isTrace) { if (isTrace) {
@ -470,6 +488,7 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public void lock() { public void lock() {
lock.lock(); lock.lock();
@ -478,6 +497,7 @@ public final class ChannelImpl implements Channel {
lock.unlock(); lock.unlock();
} }
@Override
public void unlock() { public void unlock() {
lock.lock(); lock.lock();
@ -488,11 +508,13 @@ public final class ChannelImpl implements Channel {
lock.unlock(); lock.unlock();
} }
@Override
public CoreRemotingConnection getConnection() { public CoreRemotingConnection getConnection() {
return connection; return connection;
} }
// Needs to be synchronized since can be called by remoting service timer thread too for timeout flush // Needs to be synchronized since can be called by remoting service timer thread too for timeout flush
@Override
public synchronized void flushConfirmations() { public synchronized void flushConfirmations() {
if (resendCache != null && receivedBytes != 0) { if (resendCache != null && receivedBytes != 0) {
receivedBytes = 0; receivedBytes = 0;
@ -505,6 +527,7 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public void confirm(final Packet packet) { public void confirm(final Packet packet) {
if (resendCache != null && packet.isRequiresConfirmations()) { if (resendCache != null && packet.isRequiresConfirmations()) {
lastConfirmedCommandID.incrementAndGet(); lastConfirmedCommandID.incrementAndGet();
@ -523,6 +546,7 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public void clearCommands() { public void clearCommands() {
if (resendCache != null) { if (resendCache != null) {
lastConfirmedCommandID.set(-1); lastConfirmedCommandID.set(-1);
@ -533,6 +557,7 @@ public final class ChannelImpl implements Channel {
} }
} }
@Override
public void handlePacket(final Packet packet) { public void handlePacket(final Packet packet) {
if (packet.getType() == PacketImpl.PACKETS_CONFIRMED) { if (packet.getType() == PacketImpl.PACKETS_CONFIRMED) {
if (resendCache != null) { if (resendCache != null) {

View File

@ -253,18 +253,22 @@ public class PacketImpl implements Packet {
// Public -------------------------------------------------------- // Public --------------------------------------------------------
@Override
public byte getType() { public byte getType() {
return type; return type;
} }
@Override
public long getChannelID() { public long getChannelID() {
return channelID; return channelID;
} }
@Override
public void setChannelID(final long channelID) { public void setChannelID(final long channelID) {
this.channelID = channelID; this.channelID = channelID;
} }
@Override
public ActiveMQBuffer encode(final RemotingConnection connection) { public ActiveMQBuffer encode(final RemotingConnection connection) {
ActiveMQBuffer buffer = connection.createTransportBuffer(PacketImpl.INITIAL_PACKET_SIZE); ActiveMQBuffer buffer = connection.createTransportBuffer(PacketImpl.INITIAL_PACKET_SIZE);
@ -286,6 +290,7 @@ public class PacketImpl implements Packet {
return buffer; return buffer;
} }
@Override
public void decode(final ActiveMQBuffer buffer) { public void decode(final ActiveMQBuffer buffer) {
channelID = buffer.readLong(); channelID = buffer.readLong();
@ -294,6 +299,7 @@ public class PacketImpl implements Packet {
size = buffer.readerIndex(); size = buffer.readerIndex();
} }
@Override
public int getPacketSize() { public int getPacketSize() {
if (size == -1) { if (size == -1) {
throw new IllegalStateException("Packet hasn't been encoded/decoded yet"); throw new IllegalStateException("Packet hasn't been encoded/decoded yet");
@ -302,6 +308,7 @@ public class PacketImpl implements Packet {
return size; return size;
} }
@Override
public boolean isResponse() { public boolean isResponse() {
return false; return false;
} }
@ -312,6 +319,7 @@ public class PacketImpl implements Packet {
public void decodeRest(final ActiveMQBuffer buffer) { public void decodeRest(final ActiveMQBuffer buffer) {
} }
@Override
public boolean isRequiresConfirmations() { public boolean isRequiresConfirmations() {
return true; return true;
} }

View File

@ -151,6 +151,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
/** /**
* @return the clientVersion * @return the clientVersion
*/ */
@Override
public int getClientVersion() { public int getClientVersion() {
return clientVersion; return clientVersion;
} }
@ -158,10 +159,12 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
/** /**
* @param clientVersion the clientVersion to set * @param clientVersion the clientVersion to set
*/ */
@Override
public void setClientVersion(int clientVersion) { public void setClientVersion(int clientVersion) {
this.clientVersion = clientVersion; this.clientVersion = clientVersion;
} }
@Override
public synchronized Channel getChannel(final long channelID, final int confWindowSize) { public synchronized Channel getChannel(final long channelID, final int confWindowSize) {
Channel channel = channels.get(channelID); Channel channel = channels.get(channelID);
@ -174,14 +177,17 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
return channel; return channel;
} }
@Override
public synchronized boolean removeChannel(final long channelID) { public synchronized boolean removeChannel(final long channelID) {
return channels.remove(channelID) != null; return channels.remove(channelID) != null;
} }
@Override
public synchronized void putChannel(final long channelID, final Channel channel) { public synchronized void putChannel(final long channelID, final Channel channel) {
channels.put(channelID, channel); channels.put(channelID, channel);
} }
@Override
public void fail(final ActiveMQException me, String scaleDownTargetNodeID) { public void fail(final ActiveMQException me, String scaleDownTargetNodeID) {
synchronized (failLock) { synchronized (failLock) {
if (destroyed) { if (destroyed) {
@ -212,6 +218,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
} }
} }
@Override
public void destroy() { public void destroy() {
synchronized (failLock) { synchronized (failLock) {
if (destroyed) { if (destroyed) {
@ -226,10 +233,12 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
callClosingListeners(); callClosingListeners();
} }
@Override
public void disconnect(final boolean criticalError) { public void disconnect(final boolean criticalError) {
disconnect(null, criticalError); disconnect(null, criticalError);
} }
@Override
public void disconnect(String scaleDownNodeID, final boolean criticalError) { public void disconnect(String scaleDownNodeID, final boolean criticalError) {
Channel channel0 = getChannel(ChannelImpl.CHANNEL_ID.PING.id, -1); Channel channel0 = getChannel(ChannelImpl.CHANNEL_ID.PING.id, -1);
@ -266,10 +275,12 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
channel0.sendAndFlush(disconnect); channel0.sendAndFlush(disconnect);
} }
@Override
public long generateChannelID() { public long generateChannelID() {
return idGenerator.generateID(); return idGenerator.generateID();
} }
@Override
public synchronized void syncIDGeneratorSequence(final long id) { public synchronized void syncIDGeneratorSequence(final long id) {
if (!idGeneratorSynced) { if (!idGeneratorSynced) {
idGenerator = new SimpleIDGenerator(id); idGenerator = new SimpleIDGenerator(id);
@ -278,22 +289,27 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
} }
} }
@Override
public long getIDGeneratorSequence() { public long getIDGeneratorSequence() {
return idGenerator.getCurrentID(); return idGenerator.getCurrentID();
} }
@Override
public Object getTransferLock() { public Object getTransferLock() {
return transferLock; return transferLock;
} }
@Override
public boolean isClient() { public boolean isClient() {
return client; return client;
} }
@Override
public boolean isDestroyed() { public boolean isDestroyed() {
return destroyed; return destroyed;
} }
@Override
public long getBlockingCallTimeout() { public long getBlockingCallTimeout() {
return blockingCallTimeout; return blockingCallTimeout;
} }
@ -305,6 +321,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
//We flush any confirmations on the connection - this prevents idle bridges for example //We flush any confirmations on the connection - this prevents idle bridges for example
//sitting there with many unacked messages //sitting there with many unacked messages
@Override
public void flush() { public void flush() {
synchronized (transferLock) { synchronized (transferLock) {
for (Channel channel : channels.values()) { for (Channel channel : channels.values()) {
@ -313,12 +330,14 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
} }
} }
@Override
public ActiveMQPrincipal getDefaultActiveMQPrincipal() { public ActiveMQPrincipal getDefaultActiveMQPrincipal() {
return getTransportConnection().getDefaultActiveMQPrincipal(); return getTransportConnection().getDefaultActiveMQPrincipal();
} }
// Buffer Handler implementation // Buffer Handler implementation
// ---------------------------------------------------- // ----------------------------------------------------
@Override
public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) {
try { try {
final Packet packet = packetDecoder.decode(buffer); final Packet packet = packetDecoder.decode(buffer);

View File

@ -30,10 +30,12 @@ public abstract class MessagePacket extends PacketImpl implements MessagePacketI
this.message = message; this.message = message;
} }
@Override
public Message getMessage() { public Message getMessage() {
return message; return message;
} }
@Override
public String toString() { public String toString() {
return this.getParentString() + ",message=" + message + "]"; return this.getParentString() + ",message=" + message + "]";

View File

@ -88,6 +88,7 @@ public class SessionQueueQueryResponseMessage_V2 extends SessionQueueQueryRespon
return result; return result;
} }
@Override
public ClientSession.QueueQuery toQueueQuery() { public ClientSession.QueueQuery toQueueQuery() {
return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreationEnabled()); return new QueueQueryImpl(isDurable(), isTemporary(), getConsumerCount(), getMessageCount(), getFilterString(), getAddress(), getName(), isExists(), isAutoCreationEnabled());
} }

View File

@ -63,6 +63,7 @@ public class TransportConfigurationUtil {
private static Object instantiateObject(final String className) { private static Object instantiateObject(final String className) {
return AccessController.doPrivileged(new PrivilegedAction<Object>() { return AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
try { try {
return ClassloadingUtil.newInstanceFromClassLoader(className); return ClassloadingUtil.newInstanceFromClassLoader(className);

View File

@ -96,6 +96,7 @@ public class NettyConnection implements Connection {
} }
// Connection implementation ---------------------------- // Connection implementation ----------------------------
@Override
public void forceClose() { public void forceClose() {
if (channel != null) { if (channel != null) {
try { try {
@ -116,14 +117,17 @@ public class NettyConnection implements Connection {
return channel; return channel;
} }
@Override
public RemotingConnection getProtocolConnection() { public RemotingConnection getProtocolConnection() {
return protocolConnection; return protocolConnection;
} }
@Override
public void setProtocolConnection(RemotingConnection protocolConnection) { public void setProtocolConnection(RemotingConnection protocolConnection) {
this.protocolConnection = protocolConnection; this.protocolConnection = protocolConnection;
} }
@Override
public void close() { public void close() {
if (closed) { if (closed) {
return; return;
@ -150,16 +154,19 @@ public class NettyConnection implements Connection {
listener.connectionDestroyed(getID()); listener.connectionDestroyed(getID());
} }
@Override
public ActiveMQBuffer createTransportBuffer(final int size) { public ActiveMQBuffer createTransportBuffer(final int size) {
return new ChannelBufferWrapper(PartialPooledByteBufAllocator.INSTANCE.directBuffer(size), true); return new ChannelBufferWrapper(PartialPooledByteBufAllocator.INSTANCE.directBuffer(size), true);
} }
@Override
public Object getID() { public Object getID() {
// TODO: Think of it // TODO: Think of it
return channel.hashCode(); return channel.hashCode();
} }
// This is called periodically to flush the batch buffer // This is called periodically to flush the batch buffer
@Override
public void checkFlushBatchBuffer() { public void checkFlushBatchBuffer() {
if (!batchingEnabled) { if (!batchingEnabled) {
return; return;
@ -179,14 +186,17 @@ public class NettyConnection implements Connection {
} }
} }
@Override
public void write(final ActiveMQBuffer buffer) { public void write(final ActiveMQBuffer buffer) {
write(buffer, false, false); write(buffer, false, false);
} }
@Override
public void write(ActiveMQBuffer buffer, final boolean flush, final boolean batched) { public void write(ActiveMQBuffer buffer, final boolean flush, final boolean batched) {
write(buffer, flush, batched, null); write(buffer, flush, batched, null);
} }
@Override
public void write(ActiveMQBuffer buffer, public void write(ActiveMQBuffer buffer,
final boolean flush, final boolean flush,
final boolean batched, final boolean batched,
@ -291,6 +301,7 @@ public class NettyConnection implements Connection {
} }
} }
@Override
public String getRemoteAddress() { public String getRemoteAddress() {
SocketAddress address = channel.remoteAddress(); SocketAddress address = channel.remoteAddress();
if (address == null) { if (address == null) {
@ -299,6 +310,7 @@ public class NettyConnection implements Connection {
return address.toString(); return address.toString();
} }
@Override
public String getLocalAddress() { public String getLocalAddress() {
SocketAddress address = channel.localAddress(); SocketAddress address = channel.localAddress();
if (address == null) { if (address == null) {
@ -311,15 +323,18 @@ public class NettyConnection implements Connection {
return directDeliver; return directDeliver;
} }
@Override
public void addReadyListener(final ReadyListener listener) { public void addReadyListener(final ReadyListener listener) {
readyListeners.add(listener); readyListeners.add(listener);
} }
@Override
public void removeReadyListener(final ReadyListener listener) { public void removeReadyListener(final ReadyListener listener) {
readyListeners.remove(listener); readyListeners.remove(listener);
} }
//never allow this //never allow this
@Override
public ActiveMQPrincipal getDefaultActiveMQPrincipal() { public ActiveMQPrincipal getDefaultActiveMQPrincipal() {
return null; return null;
} }

View File

@ -346,6 +346,7 @@ public class NettyConnector extends AbstractConnector {
"]"; "]";
} }
@Override
public synchronized void start() { public synchronized void start() {
if (channelClazz != null) { if (channelClazz != null) {
return; return;
@ -454,6 +455,7 @@ public class NettyConnector extends AbstractConnector {
} }
bootstrap.handler(new ChannelInitializer<Channel>() { bootstrap.handler(new ChannelInitializer<Channel>() {
@Override
public void initChannel(Channel channel) throws Exception { public void initChannel(Channel channel) throws Exception {
final ChannelPipeline pipeline = channel.pipeline(); final ChannelPipeline pipeline = channel.pipeline();
if (sslEnabled && !useServlet) { if (sslEnabled && !useServlet) {
@ -528,6 +530,7 @@ public class NettyConnector extends AbstractConnector {
ActiveMQClientLogger.LOGGER.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION); ActiveMQClientLogger.LOGGER.debug("Started Netty Connector version " + TransportConstants.NETTY_VERSION);
} }
@Override
public synchronized void close() { public synchronized void close() {
if (channelClazz == null) { if (channelClazz == null) {
return; return;
@ -559,10 +562,12 @@ public class NettyConnector extends AbstractConnector {
connections.clear(); connections.clear();
} }
@Override
public boolean isStarted() { public boolean isStarted() {
return channelClazz != null; return channelClazz != null;
} }
@Override
public Connection createConnection() { public Connection createConnection() {
if (channelClazz == null) { if (channelClazz == null) {
return null; return null;
@ -866,6 +871,7 @@ public class NettyConnector extends AbstractConnector {
private java.util.concurrent.Future<?> future; private java.util.concurrent.Future<?> future;
@Override
public synchronized void run() { public synchronized void run() {
if (closed) { if (closed) {
return; return;
@ -895,6 +901,7 @@ public class NettyConnector extends AbstractConnector {
private class Listener implements ConnectionLifeCycleListener { private class Listener implements ConnectionLifeCycleListener {
@Override
public void connectionCreated(final ActiveMQComponent component, public void connectionCreated(final ActiveMQComponent component,
final Connection connection, final Connection connection,
final String protocol) { final String protocol) {
@ -903,10 +910,12 @@ public class NettyConnector extends AbstractConnector {
} }
} }
@Override
public void connectionDestroyed(final Object connectionID) { public void connectionDestroyed(final Object connectionID) {
if (connections.remove(connectionID) != null) { if (connections.remove(connectionID) != null) {
// Execute on different thread to avoid deadlocks // Execute on different thread to avoid deadlocks
closeExecutor.execute(new Runnable() { closeExecutor.execute(new Runnable() {
@Override
public void run() { public void run() {
listener.connectionDestroyed(connectionID); listener.connectionDestroyed(connectionID);
} }
@ -914,15 +923,18 @@ public class NettyConnector extends AbstractConnector {
} }
} }
@Override
public void connectionException(final Object connectionID, final ActiveMQException me) { public void connectionException(final Object connectionID, final ActiveMQException me) {
// Execute on different thread to avoid deadlocks // Execute on different thread to avoid deadlocks
closeExecutor.execute(new Runnable() { closeExecutor.execute(new Runnable() {
@Override
public void run() { public void run() {
listener.connectionException(connectionID, me); listener.connectionException(connectionID, me);
} }
}); });
} }
@Override
public void connectionReadyForWrites(Object connectionID, boolean ready) { public void connectionReadyForWrites(Object connectionID, boolean ready) {
listener.connectionReadyForWrites(connectionID, ready); listener.connectionReadyForWrites(connectionID, ready);
} }
@ -933,6 +945,7 @@ public class NettyConnector extends AbstractConnector {
private boolean cancelled; private boolean cancelled;
@Override
public synchronized void run() { public synchronized void run() {
if (!cancelled) { if (!cancelled) {
for (Connection connection : connections.values()) { for (Connection connection : connections.values()) {
@ -946,6 +959,7 @@ public class NettyConnector extends AbstractConnector {
} }
} }
@Override
public boolean isEquivalent(Map<String, Object> configuration) { public boolean isEquivalent(Map<String, Object> configuration) {
//here we only check host and port because these two parameters //here we only check host and port because these two parameters
//is sufficient to determine the target host //is sufficient to determine the target host
@ -976,6 +990,7 @@ public class NettyConnector extends AbstractConnector {
return result; return result;
} }
@Override
public void finalize() throws Throwable { public void finalize() throws Throwable {
close(); close();
super.finalize(); super.finalize();
@ -992,6 +1007,7 @@ public class NettyConnector extends AbstractConnector {
private static ClassLoader getThisClassLoader() { private static ClassLoader getThisClassLoader() {
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public ClassLoader run() { public ClassLoader run() {
return ClientSessionFactoryImpl.class.getClassLoader(); return ClientSessionFactoryImpl.class.getClassLoader();
} }

View File

@ -28,6 +28,7 @@ import org.apache.activemq.artemis.spi.core.remoting.ConnectorFactory;
public class NettyConnectorFactory implements ConnectorFactory { public class NettyConnectorFactory implements ConnectorFactory {
@Override
public Connector createConnector(final Map<String, Object> configuration, public Connector createConnector(final Map<String, Object> configuration,
final BufferHandler handler, final BufferHandler handler,
final ConnectionLifeCycleListener listener, final ConnectionLifeCycleListener listener,

View File

@ -162,6 +162,7 @@ public class SSLSupport {
*/ */
private static URL findResource(final String resourceName) { private static URL findResource(final String resourceName) {
return AccessController.doPrivileged(new PrivilegedAction<URL>() { return AccessController.doPrivileged(new PrivilegedAction<URL>() {
@Override
public URL run() { public URL run() {
return ClassloadingUtil.findResource(resourceName); return ClassloadingUtil.findResource(resourceName);
} }

View File

@ -91,14 +91,17 @@ public class XidImpl implements Xid, Serializable {
// Xid implementation ------------------------------------------------------------------ // Xid implementation ------------------------------------------------------------------
@Override
public byte[] getBranchQualifier() { public byte[] getBranchQualifier() {
return branchQualifier; return branchQualifier;
} }
@Override
public int getFormatId() { public int getFormatId() {
return formatId; return formatId;
} }
@Override
public byte[] getGlobalTransactionId() { public byte[] getGlobalTransactionId() {
return globalTransactionId; return globalTransactionId;
} }

View File

@ -60,30 +60,37 @@ public class VersionImpl implements Version, Serializable {
// Version implementation ------------------------------------------ // Version implementation ------------------------------------------
@Override
public String getFullVersion() { public String getFullVersion() {
return versionName; return versionName;
} }
@Override
public String getVersionName() { public String getVersionName() {
return versionName; return versionName;
} }
@Override
public int getMajorVersion() { public int getMajorVersion() {
return majorVersion; return majorVersion;
} }
@Override
public int getMinorVersion() { public int getMinorVersion() {
return minorVersion; return minorVersion;
} }
@Override
public int getMicroVersion() { public int getMicroVersion() {
return microVersion; return microVersion;
} }
@Override
public int getIncrementingVersion() { public int getIncrementingVersion() {
return incrementingVersion; return incrementingVersion;
} }
@Override
public boolean isCompatible(int version) { public boolean isCompatible(int version) {
for (int element : compatibleVersionList) { for (int element : compatibleVersionList) {
if (element == version) { if (element == version) {

View File

@ -45,6 +45,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
this.creationTime = System.currentTimeMillis(); this.creationTime = System.currentTimeMillis();
} }
@Override
public List<FailureListener> getFailureListeners() { public List<FailureListener> getFailureListeners() {
return new ArrayList<FailureListener>(failureListeners); return new ArrayList<FailureListener>(failureListeners);
} }
@ -85,20 +86,24 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
} }
} }
@Override
public void setFailureListeners(final List<FailureListener> listeners) { public void setFailureListeners(final List<FailureListener> listeners) {
failureListeners.clear(); failureListeners.clear();
failureListeners.addAll(listeners); failureListeners.addAll(listeners);
} }
@Override
public Object getID() { public Object getID() {
return transportConnection.getID(); return transportConnection.getID();
} }
@Override
public String getRemoteAddress() { public String getRemoteAddress() {
return transportConnection.getRemoteAddress(); return transportConnection.getRemoteAddress();
} }
@Override
public void addFailureListener(final FailureListener listener) { public void addFailureListener(final FailureListener listener) {
if (listener == null) { if (listener == null) {
throw ActiveMQClientMessageBundle.BUNDLE.failListenerCannotBeNull(); throw ActiveMQClientMessageBundle.BUNDLE.failListenerCannotBeNull();
@ -106,6 +111,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
failureListeners.add(listener); failureListeners.add(listener);
} }
@Override
public boolean removeFailureListener(final FailureListener listener) { public boolean removeFailureListener(final FailureListener listener) {
if (listener == null) { if (listener == null) {
throw ActiveMQClientMessageBundle.BUNDLE.failListenerCannotBeNull(); throw ActiveMQClientMessageBundle.BUNDLE.failListenerCannotBeNull();
@ -114,6 +120,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
return failureListeners.remove(listener); return failureListeners.remove(listener);
} }
@Override
public void addCloseListener(final CloseListener listener) { public void addCloseListener(final CloseListener listener) {
if (listener == null) { if (listener == null) {
throw ActiveMQClientMessageBundle.BUNDLE.closeListenerCannotBeNull(); throw ActiveMQClientMessageBundle.BUNDLE.closeListenerCannotBeNull();
@ -122,6 +129,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
closeListeners.add(listener); closeListeners.add(listener);
} }
@Override
public boolean removeCloseListener(final CloseListener listener) { public boolean removeCloseListener(final CloseListener listener) {
if (listener == null) { if (listener == null) {
throw ActiveMQClientMessageBundle.BUNDLE.closeListenerCannotBeNull(); throw ActiveMQClientMessageBundle.BUNDLE.closeListenerCannotBeNull();
@ -130,6 +138,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
return closeListeners.remove(listener); return closeListeners.remove(listener);
} }
@Override
public List<CloseListener> removeCloseListeners() { public List<CloseListener> removeCloseListeners() {
List<CloseListener> ret = new ArrayList<CloseListener>(closeListeners); List<CloseListener> ret = new ArrayList<CloseListener>(closeListeners);
@ -138,6 +147,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
return ret; return ret;
} }
@Override
public List<FailureListener> removeFailureListeners() { public List<FailureListener> removeFailureListeners() {
List<FailureListener> ret = getFailureListeners(); List<FailureListener> ret = getFailureListeners();
@ -146,24 +156,29 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
return ret; return ret;
} }
@Override
public void setCloseListeners(List<CloseListener> listeners) { public void setCloseListeners(List<CloseListener> listeners) {
closeListeners.clear(); closeListeners.clear();
closeListeners.addAll(listeners); closeListeners.addAll(listeners);
} }
@Override
public ActiveMQBuffer createTransportBuffer(final int size) { public ActiveMQBuffer createTransportBuffer(final int size) {
return transportConnection.createTransportBuffer(size); return transportConnection.createTransportBuffer(size);
} }
@Override
public Connection getTransportConnection() { public Connection getTransportConnection() {
return transportConnection; return transportConnection;
} }
@Override
public long getCreationTime() { public long getCreationTime() {
return creationTime; return creationTime;
} }
@Override
public boolean checkDataReceived() { public boolean checkDataReceived() {
boolean res = dataReceived; boolean res = dataReceived;
@ -175,10 +190,12 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
/* /*
* This can be called concurrently by more than one thread so needs to be locked * This can be called concurrently by more than one thread so needs to be locked
*/ */
@Override
public void fail(final ActiveMQException me) { public void fail(final ActiveMQException me) {
fail(me, null); fail(me, null);
} }
@Override
public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) {
dataReceived = true; dataReceived = true;
} }

View File

@ -42,6 +42,7 @@ public class FutureLatch implements Runnable {
} }
} }
@Override
public void run() { public void run() {
latch.countDown(); latch.countDown();
} }

View File

@ -46,6 +46,7 @@ public class InflaterReader extends InputStream {
this.pointer = -1; this.pointer = -1;
} }
@Override
public int read() throws IOException { public int read() throws IOException {
if (pointer == -1) { if (pointer == -1) {
try { try {

View File

@ -46,6 +46,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
iters = createIteratorArray(INITIAL_ITERATOR_ARRAY_SIZE); iters = createIteratorArray(INITIAL_ITERATOR_ARRAY_SIZE);
} }
@Override
public void addHead(E e) { public void addHead(E e) {
Node<E> node = new Node<E>(e); Node<E> node = new Node<E>(e);
@ -66,6 +67,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
size++; size++;
} }
@Override
public void addTail(E e) { public void addTail(E e) {
if (size == 0) { if (size == 0) {
addHead(e); addHead(e);
@ -83,6 +85,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
} }
} }
@Override
public E poll() { public E poll() {
Node<E> ret = head.next; Node<E> ret = head.next;
@ -96,20 +99,24 @@ public class LinkedListImpl<E> implements LinkedList<E> {
} }
} }
@Override
public void clear() { public void clear() {
tail = head.next = null; tail = head.next = null;
size = 0; size = 0;
} }
@Override
public int size() { public int size() {
return size; return size;
} }
@Override
public LinkedListIterator<E> iterator() { public LinkedListIterator<E> iterator() {
return new Iterator(); return new Iterator();
} }
@Override
public String toString() { public String toString() {
StringBuilder str = new StringBuilder("LinkedListImpl [ "); StringBuilder str = new StringBuilder("LinkedListImpl [ ");
@ -227,6 +234,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
val = e; val = e;
} }
@Override
public String toString() { public String toString() {
return "Node, value = " + val; return "Node, value = " + val;
} }
@ -248,10 +256,12 @@ public class LinkedListImpl<E> implements LinkedList<E> {
addIter(this); addIter(this);
} }
@Override
public void repeat() { public void repeat() {
repeat = true; repeat = true;
} }
@Override
public boolean hasNext() { public boolean hasNext() {
Node<E> e = getNode(); Node<E> e = getNode();
@ -262,6 +272,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
return canAdvance(); return canAdvance();
} }
@Override
public E next() { public E next() {
Node<E> e = getNode(); Node<E> e = getNode();
@ -303,6 +314,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
return e.val; return e.val;
} }
@Override
public void remove() { public void remove() {
if (last == null) { if (last == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();
@ -317,6 +329,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
last = null; last = null;
} }
@Override
public void close() { public void close() {
removeIter(this); removeIter(this);
} }

View File

@ -27,5 +27,6 @@ public interface LinkedListIterator<E> extends Iterator<E>, AutoCloseable {
void repeat(); void repeat();
@Override
void close(); void close();
} }

View File

@ -43,6 +43,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory {
* *
* @return an ordered executor * @return an ordered executor
*/ */
@Override
public Executor getExecutor() { public Executor getExecutor() {
return new OrderedExecutor(parent); return new OrderedExecutor(parent);
} }
@ -72,6 +73,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory {
public OrderedExecutor(final Executor parent) { public OrderedExecutor(final Executor parent) {
this.parent = parent; this.parent = parent;
runner = new Runnable() { runner = new Runnable() {
@Override
public void run() { public void run() {
for (;;) { for (;;) {
// Optimization, first try without any locks // Optimization, first try without any locks
@ -110,6 +112,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory {
* *
* @param command the task to run. * @param command the task to run.
*/ */
@Override
public void execute(final Runnable command) { public void execute(final Runnable command) {
synchronized (tasks) { synchronized (tasks) {
tasks.add(command); tasks.add(command);
@ -120,6 +123,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory {
} }
} }
@Override
public String toString() { public String toString() {
return "OrderedExecutor(running=" + running + ", tasks=" + tasks + ")"; return "OrderedExecutor(running=" + running + ", tasks=" + tasks + ")";
} }

View File

@ -60,6 +60,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
} }
} }
@Override
public void addHead(final T t, final int priority) { public void addHead(final T t, final int priority) {
checkHighest(priority); checkHighest(priority);
@ -68,6 +69,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
size++; size++;
} }
@Override
public void addTail(final T t, final int priority) { public void addTail(final T t, final int priority) {
checkHighest(priority); checkHighest(priority);
@ -76,6 +78,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
size++; size++;
} }
@Override
public T poll() { public T poll() {
T t = null; T t = null;
@ -108,6 +111,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
return t; return t;
} }
@Override
public void clear() { public void clear() {
for (LinkedListImpl<T> list : levels) { for (LinkedListImpl<T> list : levels) {
list.clear(); list.clear();
@ -116,14 +120,17 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
size = 0; size = 0;
} }
@Override
public int size() { public int size() {
return size; return size;
} }
@Override
public boolean isEmpty() { public boolean isEmpty() {
return size == 0; return size == 0;
} }
@Override
public LinkedListIterator<T> iterator() { public LinkedListIterator<T> iterator() {
return new PriorityLinkedListIterator(); return new PriorityLinkedListIterator();
} }
@ -149,6 +156,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
close(); close();
} }
@Override
public void repeat() { public void repeat() {
if (lastIter == null) { if (lastIter == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();
@ -157,6 +165,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
lastIter.repeat(); lastIter.repeat();
} }
@Override
public void close() { public void close() {
if (!closed) { if (!closed) {
closed = true; closed = true;
@ -178,6 +187,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
} }
} }
@Override
public boolean hasNext() { public boolean hasNext() {
checkReset(); checkReset();
@ -205,6 +215,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
return false; return false;
} }
@Override
public T next() { public T next() {
if (lastIter == null) { if (lastIter == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();
@ -213,6 +224,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
return lastIter.next(); return lastIter.next();
} }
@Override
public void remove() { public void remove() {
if (lastIter == null) { if (lastIter == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();

View File

@ -26,6 +26,7 @@ public class SimpleIDGenerator implements IDGenerator {
idSequence = startID; idSequence = startID;
} }
@Override
public synchronized long generateID() { public synchronized long generateID() {
long id = idSequence++; long id = idSequence++;
@ -41,6 +42,7 @@ public class SimpleIDGenerator implements IDGenerator {
return id; return id;
} }
@Override
public synchronized long getCurrentID() { public synchronized long getCurrentID() {
return idSequence; return idSequence;
} }

View File

@ -75,6 +75,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/** /**
* @see java.util.Map#size() * @see java.util.Map#size()
*/ */
@Override
public int size() { public int size() {
processQueue(); processQueue();
return mapDelegate.size(); return mapDelegate.size();
@ -83,6 +84,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/** /**
* @see java.util.Map#isEmpty() * @see java.util.Map#isEmpty()
*/ */
@Override
public boolean isEmpty() { public boolean isEmpty() {
processQueue(); processQueue();
return mapDelegate.isEmpty(); return mapDelegate.isEmpty();
@ -92,6 +94,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
* @param key * @param key
* @see java.util.Map#containsKey(java.lang.Object) * @see java.util.Map#containsKey(java.lang.Object)
*/ */
@Override
public boolean containsKey(final Object key) { public boolean containsKey(final Object key) {
processQueue(); processQueue();
return mapDelegate.containsKey(key); return mapDelegate.containsKey(key);
@ -101,6 +104,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
* @param value * @param value
* @see java.util.Map#containsValue(java.lang.Object) * @see java.util.Map#containsValue(java.lang.Object)
*/ */
@Override
public boolean containsValue(final Object value) { public boolean containsValue(final Object value) {
processQueue(); processQueue();
for (AggregatedSoftReference valueIter : mapDelegate.values()) { for (AggregatedSoftReference valueIter : mapDelegate.values()) {
@ -117,6 +121,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
* @param key * @param key
* @see java.util.Map#get(java.lang.Object) * @see java.util.Map#get(java.lang.Object)
*/ */
@Override
public V get(final Object key) { public V get(final Object key) {
processQueue(); processQueue();
AggregatedSoftReference value = mapDelegate.get(key); AggregatedSoftReference value = mapDelegate.get(key);
@ -134,6 +139,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
* @param value * @param value
* @see java.util.Map#put(java.lang.Object, java.lang.Object) * @see java.util.Map#put(java.lang.Object, java.lang.Object)
*/ */
@Override
public V put(final K key, final V value) { public V put(final K key, final V value) {
processQueue(); processQueue();
AggregatedSoftReference newRef = createReference(key, value); AggregatedSoftReference newRef = createReference(key, value);
@ -178,6 +184,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
class ComparatorAgregated implements Comparator<AggregatedSoftReference> { class ComparatorAgregated implements Comparator<AggregatedSoftReference> {
@Override
public int compare(AggregatedSoftReference o1, AggregatedSoftReference o2) { public int compare(AggregatedSoftReference o1, AggregatedSoftReference o2) {
long k = o1.used - o2.used; long k = o1.used - o2.used;
@ -206,6 +213,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
* @param key * @param key
* @see java.util.Map#remove(java.lang.Object) * @see java.util.Map#remove(java.lang.Object)
*/ */
@Override
public V remove(final Object key) { public V remove(final Object key) {
processQueue(); processQueue();
AggregatedSoftReference ref = mapDelegate.remove(key); AggregatedSoftReference ref = mapDelegate.remove(key);
@ -221,6 +229,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
* @param m * @param m
* @see java.util.Map#putAll(java.util.Map) * @see java.util.Map#putAll(java.util.Map)
*/ */
@Override
public void putAll(final Map<? extends K, ? extends V> m) { public void putAll(final Map<? extends K, ? extends V> m) {
processQueue(); processQueue();
for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) { for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
@ -231,6 +240,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/** /**
* @see java.util.Map#clear() * @see java.util.Map#clear()
*/ */
@Override
public void clear() { public void clear() {
mapDelegate.clear(); mapDelegate.clear();
} }
@ -238,6 +248,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/** /**
* @see java.util.Map#keySet() * @see java.util.Map#keySet()
*/ */
@Override
public Set<K> keySet() { public Set<K> keySet() {
processQueue(); processQueue();
return mapDelegate.keySet(); return mapDelegate.keySet();
@ -246,6 +257,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/** /**
* @see java.util.Map#values() * @see java.util.Map#values()
*/ */
@Override
public Collection<V> values() { public Collection<V> values() {
processQueue(); processQueue();
ArrayList<V> list = new ArrayList<V>(); ArrayList<V> list = new ArrayList<V>();
@ -263,6 +275,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/** /**
* @see java.util.Map#entrySet() * @see java.util.Map#entrySet()
*/ */
@Override
public Set<java.util.Map.Entry<K, V>> entrySet() { public Set<java.util.Map.Entry<K, V>> entrySet() {
processQueue(); processQueue();
HashSet<Map.Entry<K, V>> set = new HashSet<Map.Entry<K, V>>(); HashSet<Map.Entry<K, V>> set = new HashSet<Map.Entry<K, V>>();
@ -353,6 +366,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see java.util.Map.Entry#getKey() * @see java.util.Map.Entry#getKey()
*/ */
@Override
public K getKey() { public K getKey() {
return key; return key;
} }
@ -360,6 +374,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see java.util.Map.Entry#getValue() * @see java.util.Map.Entry#getValue()
*/ */
@Override
public V getValue() { public V getValue() {
return value; return value;
} }
@ -367,6 +382,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
/* (non-Javadoc) /* (non-Javadoc)
* @see java.util.Map.Entry#setValue(java.lang.Object) * @see java.util.Map.Entry#setValue(java.lang.Object)
*/ */
@Override
public V setValue(final V value) { public V setValue(final V value) {
this.value = value; this.value = value;
return value; return value;

View File

@ -60,6 +60,7 @@ public class TimeAndCounterIDGenerator implements IDGenerator {
// Public -------------------------------------------------------- // Public --------------------------------------------------------
@Override
public long generateID() { public long generateID() {
long idReturn = counter.incrementAndGet(); long idReturn = counter.incrementAndGet();
@ -93,6 +94,7 @@ public class TimeAndCounterIDGenerator implements IDGenerator {
return idReturn; return idReturn;
} }
@Override
public long getCurrentID() { public long getCurrentID() {
return counter.get(); return counter.get();
} }

View File

@ -50,14 +50,17 @@ public class TokenBucketLimiterImpl implements TokenBucketLimiter {
this.window = unit.toMillis(unitAmount); this.window = unit.toMillis(unitAmount);
} }
@Override
public int getRate() { public int getRate() {
return rate; return rate;
} }
@Override
public boolean isSpin() { public boolean isSpin() {
return spin; return spin;
} }
@Override
public void limit() { public void limit() {
while (!check()) { while (!check()) {
if (spin) { if (spin) {

View File

@ -51,6 +51,7 @@ public final class VersionLoader {
try { try {
PROP_FILE_NAME = AccessController.doPrivileged(new PrivilegedAction<String>() { PROP_FILE_NAME = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() { public String run() {
return System.getProperty(VersionLoader.VERSION_PROP_FILE_KEY); return System.getProperty(VersionLoader.VERSION_PROP_FILE_KEY);
} }

View File

@ -431,6 +431,7 @@ public final class XMLUtil {
private static URL findResource(final String resourceName) { private static URL findResource(final String resourceName) {
return AccessController.doPrivileged(new PrivilegedAction<URL>() { return AccessController.doPrivileged(new PrivilegedAction<URL>() {
@Override
public URL run() { public URL run() {
return ClassloadingUtil.findResource(resourceName); return ClassloadingUtil.findResource(resourceName);
} }

View File

@ -124,6 +124,7 @@ public interface JMSQueueControl extends DestinationControl {
* *
* @return the number of removed messages * @return the number of removed messages
*/ */
@Override
@Operation(desc = "Remove the messages corresponding to the given filter (and returns the number of removed messages)", impact = MBeanOperationInfo.ACTION) @Operation(desc = "Remove the messages corresponding to the given filter (and returns the number of removed messages)", impact = MBeanOperationInfo.ACTION)
int removeMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception; int removeMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;

View File

@ -99,6 +99,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
// BytesMessage implementation ----------------------------------- // BytesMessage implementation -----------------------------------
@Override
public boolean readBoolean() throws JMSException { public boolean readBoolean() throws JMSException {
checkRead(); checkRead();
try { try {
@ -109,6 +110,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public byte readByte() throws JMSException { public byte readByte() throws JMSException {
checkRead(); checkRead();
try { try {
@ -119,6 +121,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public int readUnsignedByte() throws JMSException { public int readUnsignedByte() throws JMSException {
checkRead(); checkRead();
try { try {
@ -129,6 +132,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public short readShort() throws JMSException { public short readShort() throws JMSException {
checkRead(); checkRead();
try { try {
@ -139,6 +143,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public int readUnsignedShort() throws JMSException { public int readUnsignedShort() throws JMSException {
checkRead(); checkRead();
try { try {
@ -149,6 +154,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public char readChar() throws JMSException { public char readChar() throws JMSException {
checkRead(); checkRead();
try { try {
@ -159,6 +165,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public int readInt() throws JMSException { public int readInt() throws JMSException {
checkRead(); checkRead();
try { try {
@ -169,6 +176,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public long readLong() throws JMSException { public long readLong() throws JMSException {
checkRead(); checkRead();
try { try {
@ -179,6 +187,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public float readFloat() throws JMSException { public float readFloat() throws JMSException {
checkRead(); checkRead();
try { try {
@ -189,6 +198,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public double readDouble() throws JMSException { public double readDouble() throws JMSException {
checkRead(); checkRead();
try { try {
@ -199,6 +209,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public String readUTF() throws JMSException { public String readUTF() throws JMSException {
checkRead(); checkRead();
try { try {
@ -215,57 +226,68 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public int readBytes(final byte[] value) throws JMSException { public int readBytes(final byte[] value) throws JMSException {
checkRead(); checkRead();
return bytesReadBytes(message.getBodyBuffer(), value); return bytesReadBytes(message.getBodyBuffer(), value);
} }
@Override
public int readBytes(final byte[] value, final int length) throws JMSException { public int readBytes(final byte[] value, final int length) throws JMSException {
checkRead(); checkRead();
return bytesReadBytes(message.getBodyBuffer(), value, length); return bytesReadBytes(message.getBodyBuffer(), value, length);
} }
@Override
public void writeBoolean(final boolean value) throws JMSException { public void writeBoolean(final boolean value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteBoolean(message.getBodyBuffer(), value); bytesWriteBoolean(message.getBodyBuffer(), value);
} }
@Override
public void writeByte(final byte value) throws JMSException { public void writeByte(final byte value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteByte(message.getBodyBuffer(), value); bytesWriteByte(message.getBodyBuffer(), value);
} }
@Override
public void writeShort(final short value) throws JMSException { public void writeShort(final short value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteShort(message.getBodyBuffer(), value); bytesWriteShort(message.getBodyBuffer(), value);
} }
@Override
public void writeChar(final char value) throws JMSException { public void writeChar(final char value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteChar(message.getBodyBuffer(), value); bytesWriteChar(message.getBodyBuffer(), value);
} }
@Override
public void writeInt(final int value) throws JMSException { public void writeInt(final int value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteInt(message.getBodyBuffer(), value); bytesWriteInt(message.getBodyBuffer(), value);
} }
@Override
public void writeLong(final long value) throws JMSException { public void writeLong(final long value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteLong(message.getBodyBuffer(), value); bytesWriteLong(message.getBodyBuffer(), value);
} }
@Override
public void writeFloat(final float value) throws JMSException { public void writeFloat(final float value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteFloat(message.getBodyBuffer(), value); bytesWriteFloat(message.getBodyBuffer(), value);
} }
@Override
public void writeDouble(final double value) throws JMSException { public void writeDouble(final double value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteDouble(message.getBodyBuffer(), value); bytesWriteDouble(message.getBodyBuffer(), value);
} }
@Override
public void writeUTF(final String value) throws JMSException { public void writeUTF(final String value) throws JMSException {
checkWrite(); checkWrite();
try { try {
@ -280,16 +302,19 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
@Override
public void writeBytes(final byte[] value) throws JMSException { public void writeBytes(final byte[] value) throws JMSException {
checkWrite(); checkWrite();
bytesWriteBytes(message.getBodyBuffer(), value); bytesWriteBytes(message.getBodyBuffer(), value);
} }
@Override
public void writeBytes(final byte[] value, final int offset, final int length) throws JMSException { public void writeBytes(final byte[] value, final int offset, final int length) throws JMSException {
checkWrite(); checkWrite();
bytesWriteBytes(message.getBodyBuffer(), value, offset, length); bytesWriteBytes(message.getBodyBuffer(), value, offset, length);
} }
@Override
public void writeObject(final Object value) throws JMSException { public void writeObject(final Object value) throws JMSException {
checkWrite(); checkWrite();
if (!bytesWriteObject(message.getBodyBuffer(), value)) { if (!bytesWriteObject(message.getBodyBuffer(), value)) {
@ -297,6 +322,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public void reset() throws JMSException { public void reset() throws JMSException {
if (!readOnly) { if (!readOnly) {
readOnly = true; readOnly = true;
@ -328,6 +354,7 @@ public class ActiveMQBytesMessage extends ActiveMQMessage implements BytesMessag
} }
} }
@Override
public long getBodyLength() throws JMSException { public long getBodyLength() throws JMSException {
checkRead(); checkRead();

View File

@ -199,18 +199,21 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
// Connection implementation -------------------------------------------------------------------- // Connection implementation --------------------------------------------------------------------
@Override
public synchronized Session createSession(final boolean transacted, final int acknowledgeMode) throws JMSException { public synchronized Session createSession(final boolean transacted, final int acknowledgeMode) throws JMSException {
checkClosed(); checkClosed();
return createSessionInternal(false, transacted, checkAck(transacted, acknowledgeMode), ActiveMQConnection.TYPE_GENERIC_CONNECTION); return createSessionInternal(false, transacted, checkAck(transacted, acknowledgeMode), ActiveMQConnection.TYPE_GENERIC_CONNECTION);
} }
@Override
public String getClientID() throws JMSException { public String getClientID() throws JMSException {
checkClosed(); checkClosed();
return clientID; return clientID;
} }
@Override
public void setClientID(final String clientID) throws JMSException { public void setClientID(final String clientID) throws JMSException {
checkClosed(); checkClosed();
@ -245,6 +248,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
justCreated = false; justCreated = false;
} }
@Override
public ConnectionMetaData getMetaData() throws JMSException { public ConnectionMetaData getMetaData() throws JMSException {
checkClosed(); checkClosed();
@ -257,6 +261,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
return metaData; return metaData;
} }
@Override
public ExceptionListener getExceptionListener() throws JMSException { public ExceptionListener getExceptionListener() throws JMSException {
checkClosed(); checkClosed();
@ -265,6 +270,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
return exceptionListener; return exceptionListener;
} }
@Override
public void setExceptionListener(final ExceptionListener listener) throws JMSException { public void setExceptionListener(final ExceptionListener listener) throws JMSException {
checkClosed(); checkClosed();
@ -272,6 +278,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
justCreated = false; justCreated = false;
} }
@Override
public synchronized void start() throws JMSException { public synchronized void start() throws JMSException {
checkClosed(); checkClosed();
@ -294,6 +301,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
} }
@Override
public synchronized void stop() throws JMSException { public synchronized void stop() throws JMSException {
threadAwareContext.assertNotMessageListenerThread(); threadAwareContext.assertNotMessageListenerThread();
@ -307,6 +315,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
started = false; started = false;
} }
@Override
public final synchronized void close() throws JMSException { public final synchronized void close() throws JMSException {
threadAwareContext.assertNotCompletionListenerThread(); threadAwareContext.assertNotCompletionListenerThread();
threadAwareContext.assertNotMessageListenerThread(); threadAwareContext.assertNotMessageListenerThread();
@ -351,6 +360,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
} }
} }
@Override
public ConnectionConsumer createConnectionConsumer(final Destination destination, public ConnectionConsumer createConnectionConsumer(final Destination destination,
final String messageSelector, final String messageSelector,
final ServerSessionPool sessionPool, final ServerSessionPool sessionPool,
@ -372,6 +382,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
} }
} }
@Override
public ConnectionConsumer createDurableConnectionConsumer(final Topic topic, public ConnectionConsumer createDurableConnectionConsumer(final Topic topic,
final String subscriptionName, final String subscriptionName,
final String messageSelector, final String messageSelector,
@ -403,6 +414,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
// QueueConnection implementation --------------------------------------------------------------- // QueueConnection implementation ---------------------------------------------------------------
@Override
public QueueSession createQueueSession(final boolean transacted, int acknowledgeMode) throws JMSException { public QueueSession createQueueSession(final boolean transacted, int acknowledgeMode) throws JMSException {
checkClosed(); checkClosed();
return createSessionInternal(false, transacted, checkAck(transacted, acknowledgeMode), ActiveMQSession.TYPE_QUEUE_SESSION); return createSessionInternal(false, transacted, checkAck(transacted, acknowledgeMode), ActiveMQSession.TYPE_QUEUE_SESSION);
@ -420,6 +432,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
return acknowledgeMode; return acknowledgeMode;
} }
@Override
public ConnectionConsumer createConnectionConsumer(final Queue queue, public ConnectionConsumer createConnectionConsumer(final Queue queue,
final String messageSelector, final String messageSelector,
final ServerSessionPool sessionPool, final ServerSessionPool sessionPool,
@ -431,11 +444,13 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
// TopicConnection implementation --------------------------------------------------------------- // TopicConnection implementation ---------------------------------------------------------------
@Override
public TopicSession createTopicSession(final boolean transacted, final int acknowledgeMode) throws JMSException { public TopicSession createTopicSession(final boolean transacted, final int acknowledgeMode) throws JMSException {
checkClosed(); checkClosed();
return createSessionInternal(false, transacted, checkAck(transacted, acknowledgeMode), ActiveMQSession.TYPE_TOPIC_SESSION); return createSessionInternal(false, transacted, checkAck(transacted, acknowledgeMode), ActiveMQSession.TYPE_TOPIC_SESSION);
} }
@Override
public ConnectionConsumer createConnectionConsumer(final Topic topic, public ConnectionConsumer createConnectionConsumer(final Topic topic,
final String messageSelector, final String messageSelector,
final ServerSessionPool sessionPool, final ServerSessionPool sessionPool,
@ -695,6 +710,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
je.initCause(me); je.initCause(me);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override
public void run() { public void run() {
exceptionListener.onException(je); exceptionListener.onException(je);
} }
@ -714,6 +730,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
connectionFailed(me, failedOver); connectionFailed(me, failedOver);
} }
@Override
public void beforeReconnect(final ActiveMQException me) { public void beforeReconnect(final ActiveMQException me) {
} }
@ -739,6 +756,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
if (failoverListener != null) { if (failoverListener != null) {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override
public void run() { public void run() {
failoverListener.failoverEvent(eventType); failoverListener.failoverEvent(eventType);
} }

View File

@ -79,6 +79,7 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
private String protocolManagerFactoryStr; private String protocolManagerFactoryStr;
@Override
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
URI uri = toURI(); URI uri = toURI();
@ -135,6 +136,7 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
if (protocolManagerFactoryStr != null && !protocolManagerFactoryStr.trim().isEmpty()) { if (protocolManagerFactoryStr != null && !protocolManagerFactoryStr.trim().isEmpty()) {
AccessController.doPrivileged(new PrivilegedAction<Object>() { AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() { public Object run() {
ClientProtocolManagerFactory protocolManagerFactory = ClientProtocolManagerFactory protocolManagerFactory =
@ -148,6 +150,7 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
} }
} }
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
String url = in.readUTF(); String url = in.readUTF();
ConnectionFactoryParser parser = new ConnectionFactoryParser(); ConnectionFactoryParser parser = new ConnectionFactoryParser();
@ -225,10 +228,12 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
serverLocator.disableFinalizeCheck(); serverLocator.disableFinalizeCheck();
} }
@Override
public Connection createConnection() throws JMSException { public Connection createConnection() throws JMSException {
return createConnection(user, password); return createConnection(user, password);
} }
@Override
public Connection createConnection(final String username, final String password) throws JMSException { public Connection createConnection(final String username, final String password) throws JMSException {
return createConnectionInternal(username, password, false, ActiveMQConnection.TYPE_GENERIC_CONNECTION); return createConnectionInternal(username, password, false, ActiveMQConnection.TYPE_GENERIC_CONNECTION);
} }
@ -296,10 +301,12 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
// XAConnectionFactory implementation ----------------------------------------------------------- // XAConnectionFactory implementation -----------------------------------------------------------
@Override
public XAConnection createXAConnection() throws JMSException { public XAConnection createXAConnection() throws JMSException {
return createXAConnection(null, null); return createXAConnection(null, null);
} }
@Override
public XAConnection createXAConnection(final String username, final String password) throws JMSException { public XAConnection createXAConnection(final String username, final String password) throws JMSException {
return (XAConnection) createConnectionInternal(username, password, true, ActiveMQConnection.TYPE_GENERIC_CONNECTION); return (XAConnection) createConnectionInternal(username, password, true, ActiveMQConnection.TYPE_GENERIC_CONNECTION);
} }
@ -694,6 +701,7 @@ public class ActiveMQConnectionFactory implements Externalizable, Referenceable,
serverLocator.setCompressLargeMessage(avoidLargeMessages); serverLocator.setCompressLargeMessage(avoidLargeMessages);
} }
@Override
public void close() { public void close() {
ServerLocator locator0 = serverLocator; ServerLocator locator0 = serverLocator;
if (locator0 != null) if (locator0 != null)

View File

@ -29,6 +29,7 @@ import org.apache.activemq.artemis.utils.ReferenceCounterUtil;
public abstract class ActiveMQConnectionForContextImpl implements ActiveMQConnectionForContext { public abstract class ActiveMQConnectionForContextImpl implements ActiveMQConnectionForContext {
final Runnable closeRunnable = new Runnable() { final Runnable closeRunnable = new Runnable() {
@Override
public void run() { public void run() {
try { try {
close(); close();
@ -43,6 +44,7 @@ public abstract class ActiveMQConnectionForContextImpl implements ActiveMQConnec
protected final ThreadAwareContext threadAwareContext = new ThreadAwareContext(); protected final ThreadAwareContext threadAwareContext = new ThreadAwareContext();
@Override
public JMSContext createContext(int sessionMode) { public JMSContext createContext(int sessionMode) {
switch (sessionMode) { switch (sessionMode) {
case Session.AUTO_ACKNOWLEDGE: case Session.AUTO_ACKNOWLEDGE:
@ -60,6 +62,7 @@ public abstract class ActiveMQConnectionForContextImpl implements ActiveMQConnec
return new ActiveMQJMSContext(this, sessionMode, threadAwareContext); return new ActiveMQJMSContext(this, sessionMode, threadAwareContext);
} }
@Override
public XAJMSContext createXAContext() { public XAJMSContext createXAContext() {
refCounter.increment(); refCounter.increment();

View File

@ -49,34 +49,42 @@ public class ActiveMQConnectionMetaData implements ConnectionMetaData {
// ConnectionMetaData implementation ----------------------------- // ConnectionMetaData implementation -----------------------------
@Override
public String getJMSVersion() throws JMSException { public String getJMSVersion() throws JMSException {
return "2.0"; return "2.0";
} }
@Override
public int getJMSMajorVersion() throws JMSException { public int getJMSMajorVersion() throws JMSException {
return 2; return 2;
} }
@Override
public int getJMSMinorVersion() throws JMSException { public int getJMSMinorVersion() throws JMSException {
return 0; return 0;
} }
@Override
public String getJMSProviderName() throws JMSException { public String getJMSProviderName() throws JMSException {
return ActiveMQConnectionMetaData.ACTIVEMQ; return ActiveMQConnectionMetaData.ACTIVEMQ;
} }
@Override
public String getProviderVersion() throws JMSException { public String getProviderVersion() throws JMSException {
return serverVersion.getFullVersion(); return serverVersion.getFullVersion();
} }
@Override
public int getProviderMajorVersion() throws JMSException { public int getProviderMajorVersion() throws JMSException {
return serverVersion.getMajorVersion(); return serverVersion.getMajorVersion();
} }
@Override
public int getProviderMinorVersion() throws JMSException { public int getProviderMinorVersion() throws JMSException {
return serverVersion.getMinorVersion(); return serverVersion.getMinorVersion();
} }
@Override
public Enumeration getJMSXPropertyNames() throws JMSException { public Enumeration getJMSXPropertyNames() throws JMSException {
Vector<Object> v = new Vector<Object>(); Vector<Object> v = new Vector<Object>();
v.add("JMSXGroupID"); v.add("JMSXGroupID");

View File

@ -296,6 +296,7 @@ public class ActiveMQDestination implements Destination, Serializable, Reference
// Referenceable implementation --------------------------------------- // Referenceable implementation ---------------------------------------
@Override
public Reference getReference() throws NamingException { public Reference getReference() throws NamingException {
return new Reference(this.getClass().getCanonicalName(), new SerializableObjectRefAddr("ActiveMQ-DEST", this), DestinationObjectFactory.class.getCanonicalName(), null); return new Reference(this.getClass().getCanonicalName(), new SerializableObjectRefAddr("ActiveMQ-DEST", this), DestinationObjectFactory.class.getCanonicalName(), null);
} }

View File

@ -100,66 +100,77 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
// MapMessage implementation ------------------------------------- // MapMessage implementation -------------------------------------
@Override
public void setBoolean(final String name, final boolean value) throws JMSException { public void setBoolean(final String name, final boolean value) throws JMSException {
checkName(name); checkName(name);
map.putBooleanProperty(new SimpleString(name), value); map.putBooleanProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setByte(final String name, final byte value) throws JMSException { public void setByte(final String name, final byte value) throws JMSException {
checkName(name); checkName(name);
map.putByteProperty(new SimpleString(name), value); map.putByteProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setShort(final String name, final short value) throws JMSException { public void setShort(final String name, final short value) throws JMSException {
checkName(name); checkName(name);
map.putShortProperty(new SimpleString(name), value); map.putShortProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setChar(final String name, final char value) throws JMSException { public void setChar(final String name, final char value) throws JMSException {
checkName(name); checkName(name);
map.putCharProperty(new SimpleString(name), value); map.putCharProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setInt(final String name, final int value) throws JMSException { public void setInt(final String name, final int value) throws JMSException {
checkName(name); checkName(name);
map.putIntProperty(new SimpleString(name), value); map.putIntProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setLong(final String name, final long value) throws JMSException { public void setLong(final String name, final long value) throws JMSException {
checkName(name); checkName(name);
map.putLongProperty(new SimpleString(name), value); map.putLongProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setFloat(final String name, final float value) throws JMSException { public void setFloat(final String name, final float value) throws JMSException {
checkName(name); checkName(name);
map.putFloatProperty(new SimpleString(name), value); map.putFloatProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setDouble(final String name, final double value) throws JMSException { public void setDouble(final String name, final double value) throws JMSException {
checkName(name); checkName(name);
map.putDoubleProperty(new SimpleString(name), value); map.putDoubleProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setString(final String name, final String value) throws JMSException { public void setString(final String name, final String value) throws JMSException {
checkName(name); checkName(name);
map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value)); map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value));
invalid = true; invalid = true;
} }
@Override
public void setBytes(final String name, final byte[] value) throws JMSException { public void setBytes(final String name, final byte[] value) throws JMSException {
checkName(name); checkName(name);
map.putBytesProperty(new SimpleString(name), value); map.putBytesProperty(new SimpleString(name), value);
invalid = true; invalid = true;
} }
@Override
public void setBytes(final String name, final byte[] value, final int offset, final int length) throws JMSException { public void setBytes(final String name, final byte[] value, final int offset, final int length) throws JMSException {
checkName(name); checkName(name);
if (offset + length > value.length) { if (offset + length > value.length) {
@ -171,6 +182,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
invalid = true; invalid = true;
} }
@Override
public void setObject(final String name, final Object value) throws JMSException { public void setObject(final String name, final Object value) throws JMSException {
checkName(name); checkName(name);
try { try {
@ -182,6 +194,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
invalid = true; invalid = true;
} }
@Override
public boolean getBoolean(final String name) throws JMSException { public boolean getBoolean(final String name) throws JMSException {
try { try {
return map.getBooleanProperty(new SimpleString(name)); return map.getBooleanProperty(new SimpleString(name));
@ -191,6 +204,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public byte getByte(final String name) throws JMSException { public byte getByte(final String name) throws JMSException {
try { try {
return map.getByteProperty(new SimpleString(name)); return map.getByteProperty(new SimpleString(name));
@ -200,6 +214,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public short getShort(final String name) throws JMSException { public short getShort(final String name) throws JMSException {
try { try {
return map.getShortProperty(new SimpleString(name)); return map.getShortProperty(new SimpleString(name));
@ -209,6 +224,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public char getChar(final String name) throws JMSException { public char getChar(final String name) throws JMSException {
try { try {
return map.getCharProperty(new SimpleString(name)); return map.getCharProperty(new SimpleString(name));
@ -218,6 +234,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public int getInt(final String name) throws JMSException { public int getInt(final String name) throws JMSException {
try { try {
return map.getIntProperty(new SimpleString(name)); return map.getIntProperty(new SimpleString(name));
@ -227,6 +244,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public long getLong(final String name) throws JMSException { public long getLong(final String name) throws JMSException {
try { try {
return map.getLongProperty(new SimpleString(name)); return map.getLongProperty(new SimpleString(name));
@ -236,6 +254,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public float getFloat(final String name) throws JMSException { public float getFloat(final String name) throws JMSException {
try { try {
return map.getFloatProperty(new SimpleString(name)); return map.getFloatProperty(new SimpleString(name));
@ -245,6 +264,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public double getDouble(final String name) throws JMSException { public double getDouble(final String name) throws JMSException {
try { try {
return map.getDoubleProperty(new SimpleString(name)); return map.getDoubleProperty(new SimpleString(name));
@ -254,6 +274,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public String getString(final String name) throws JMSException { public String getString(final String name) throws JMSException {
try { try {
SimpleString str = map.getSimpleStringProperty(new SimpleString(name)); SimpleString str = map.getSimpleStringProperty(new SimpleString(name));
@ -269,6 +290,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public byte[] getBytes(final String name) throws JMSException { public byte[] getBytes(final String name) throws JMSException {
try { try {
return map.getBytesProperty(new SimpleString(name)); return map.getBytesProperty(new SimpleString(name));
@ -278,6 +300,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
} }
} }
@Override
public Object getObject(final String name) throws JMSException { public Object getObject(final String name) throws JMSException {
Object val = map.getProperty(new SimpleString(name)); Object val = map.getProperty(new SimpleString(name));
@ -288,6 +311,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
return val; return val;
} }
@Override
public Enumeration getMapNames() throws JMSException { public Enumeration getMapNames() throws JMSException {
Set<SimpleString> simplePropNames = map.getPropertyNames(); Set<SimpleString> simplePropNames = map.getPropertyNames();
Set<String> propNames = new HashSet<String>(simplePropNames.size()); Set<String> propNames = new HashSet<String>(simplePropNames.size());
@ -299,6 +323,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
return Collections.enumeration(propNames); return Collections.enumeration(propNames);
} }
@Override
public boolean itemExists(final String name) throws JMSException { public boolean itemExists(final String name) throws JMSException {
return map.containsProperty(new SimpleString(name)); return map.containsProperty(new SimpleString(name));
} }

View File

@ -277,6 +277,7 @@ public class ActiveMQMessage implements javax.jms.Message {
// javax.jmx.Message implementation ------------------------------ // javax.jmx.Message implementation ------------------------------
@Override
public String getJMSMessageID() { public String getJMSMessageID() {
if (msgID == null) { if (msgID == null) {
UUID uid = message.getUserID(); UUID uid = message.getUserID();
@ -286,6 +287,7 @@ public class ActiveMQMessage implements javax.jms.Message {
return msgID; return msgID;
} }
@Override
public void setJMSMessageID(final String jmsMessageID) throws JMSException { public void setJMSMessageID(final String jmsMessageID) throws JMSException {
if (jmsMessageID != null && !jmsMessageID.startsWith("ID:")) { if (jmsMessageID != null && !jmsMessageID.startsWith("ID:")) {
throw new JMSException("JMSMessageID must start with ID:"); throw new JMSException("JMSMessageID must start with ID:");
@ -296,18 +298,22 @@ public class ActiveMQMessage implements javax.jms.Message {
msgID = jmsMessageID; msgID = jmsMessageID;
} }
@Override
public long getJMSTimestamp() throws JMSException { public long getJMSTimestamp() throws JMSException {
return message.getTimestamp(); return message.getTimestamp();
} }
@Override
public void setJMSTimestamp(final long timestamp) throws JMSException { public void setJMSTimestamp(final long timestamp) throws JMSException {
message.setTimestamp(timestamp); message.setTimestamp(timestamp);
} }
@Override
public byte[] getJMSCorrelationIDAsBytes() throws JMSException { public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
return MessageUtil.getJMSCorrelationIDAsBytes(message); return MessageUtil.getJMSCorrelationIDAsBytes(message);
} }
@Override
public void setJMSCorrelationIDAsBytes(final byte[] correlationID) throws JMSException { public void setJMSCorrelationIDAsBytes(final byte[] correlationID) throws JMSException {
try { try {
MessageUtil.setJMSCorrelationIDAsBytes(message, correlationID); MessageUtil.setJMSCorrelationIDAsBytes(message, correlationID);
@ -319,11 +325,13 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public void setJMSCorrelationID(final String correlationID) throws JMSException { public void setJMSCorrelationID(final String correlationID) throws JMSException {
MessageUtil.setJMSCorrelationID(message, correlationID); MessageUtil.setJMSCorrelationID(message, correlationID);
jmsCorrelationID = correlationID; jmsCorrelationID = correlationID;
} }
@Override
public String getJMSCorrelationID() throws JMSException { public String getJMSCorrelationID() throws JMSException {
if (jmsCorrelationID == null) { if (jmsCorrelationID == null) {
jmsCorrelationID = MessageUtil.getJMSCorrelationID(message); jmsCorrelationID = MessageUtil.getJMSCorrelationID(message);
@ -332,6 +340,7 @@ public class ActiveMQMessage implements javax.jms.Message {
return jmsCorrelationID; return jmsCorrelationID;
} }
@Override
public Destination getJMSReplyTo() throws JMSException { public Destination getJMSReplyTo() throws JMSException {
if (replyTo == null) { if (replyTo == null) {
@ -344,6 +353,7 @@ public class ActiveMQMessage implements javax.jms.Message {
return replyTo; return replyTo;
} }
@Override
public void setJMSReplyTo(final Destination dest) throws JMSException { public void setJMSReplyTo(final Destination dest) throws JMSException {
if (dest == null) { if (dest == null) {
@ -363,6 +373,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public Destination getJMSDestination() throws JMSException { public Destination getJMSDestination() throws JMSException {
if (dest == null) { if (dest == null) {
SimpleString sdest = message.getAddress(); SimpleString sdest = message.getAddress();
@ -373,14 +384,17 @@ public class ActiveMQMessage implements javax.jms.Message {
return dest; return dest;
} }
@Override
public void setJMSDestination(final Destination destination) throws JMSException { public void setJMSDestination(final Destination destination) throws JMSException {
dest = destination; dest = destination;
} }
@Override
public int getJMSDeliveryMode() throws JMSException { public int getJMSDeliveryMode() throws JMSException {
return message.isDurable() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT; return message.isDurable() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
} }
@Override
public void setJMSDeliveryMode(final int deliveryMode) throws JMSException { public void setJMSDeliveryMode(final int deliveryMode) throws JMSException {
if (deliveryMode == DeliveryMode.PERSISTENT) { if (deliveryMode == DeliveryMode.PERSISTENT) {
message.setDurable(true); message.setDurable(true);
@ -393,10 +407,12 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public boolean getJMSRedelivered() throws JMSException { public boolean getJMSRedelivered() throws JMSException {
return message.getDeliveryCount() > 1; return message.getDeliveryCount() > 1;
} }
@Override
public void setJMSRedelivered(final boolean redelivered) throws JMSException { public void setJMSRedelivered(final boolean redelivered) throws JMSException {
if (!redelivered) { if (!redelivered) {
message.setDeliveryCount(1); message.setDeliveryCount(1);
@ -411,6 +427,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public void setJMSType(final String type) throws JMSException { public void setJMSType(final String type) throws JMSException {
if (type != null) { if (type != null) {
MessageUtil.setJMSType(message, type); MessageUtil.setJMSType(message, type);
@ -419,6 +436,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public String getJMSType() throws JMSException { public String getJMSType() throws JMSException {
if (jmsType == null) { if (jmsType == null) {
jmsType = MessageUtil.getJMSType(message); jmsType = MessageUtil.getJMSType(message);
@ -426,24 +444,29 @@ public class ActiveMQMessage implements javax.jms.Message {
return jmsType; return jmsType;
} }
@Override
public long getJMSExpiration() throws JMSException { public long getJMSExpiration() throws JMSException {
return message.getExpiration(); return message.getExpiration();
} }
@Override
public void setJMSExpiration(final long expiration) throws JMSException { public void setJMSExpiration(final long expiration) throws JMSException {
message.setExpiration(expiration); message.setExpiration(expiration);
} }
@Override
public int getJMSPriority() throws JMSException { public int getJMSPriority() throws JMSException {
return message.getPriority(); return message.getPriority();
} }
@Override
public void setJMSPriority(final int priority) throws JMSException { public void setJMSPriority(final int priority) throws JMSException {
checkPriority(priority); checkPriority(priority);
message.setPriority((byte) priority); message.setPriority((byte) priority);
} }
@Override
public void clearProperties() throws JMSException { public void clearProperties() throws JMSException {
MessageUtil.clearProperties(message); MessageUtil.clearProperties(message);
@ -451,14 +474,17 @@ public class ActiveMQMessage implements javax.jms.Message {
propertiesReadOnly = false; propertiesReadOnly = false;
} }
@Override
public void clearBody() throws JMSException { public void clearBody() throws JMSException {
readOnly = false; readOnly = false;
} }
@Override
public boolean propertyExists(final String name) throws JMSException { public boolean propertyExists(final String name) throws JMSException {
return MessageUtil.propertyExists(message, name); return MessageUtil.propertyExists(message, name);
} }
@Override
public boolean getBooleanProperty(final String name) throws JMSException { public boolean getBooleanProperty(final String name) throws JMSException {
try { try {
return message.getBooleanProperty(new SimpleString(name)); return message.getBooleanProperty(new SimpleString(name));
@ -468,6 +494,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public byte getByteProperty(final String name) throws JMSException { public byte getByteProperty(final String name) throws JMSException {
try { try {
return message.getByteProperty(new SimpleString(name)); return message.getByteProperty(new SimpleString(name));
@ -477,6 +504,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public short getShortProperty(final String name) throws JMSException { public short getShortProperty(final String name) throws JMSException {
try { try {
return message.getShortProperty(new SimpleString(name)); return message.getShortProperty(new SimpleString(name));
@ -486,6 +514,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public int getIntProperty(final String name) throws JMSException { public int getIntProperty(final String name) throws JMSException {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) { if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return message.getDeliveryCount(); return message.getDeliveryCount();
@ -499,6 +528,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public long getLongProperty(final String name) throws JMSException { public long getLongProperty(final String name) throws JMSException {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) { if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return message.getDeliveryCount(); return message.getDeliveryCount();
@ -512,6 +542,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public float getFloatProperty(final String name) throws JMSException { public float getFloatProperty(final String name) throws JMSException {
try { try {
return message.getFloatProperty(new SimpleString(name)); return message.getFloatProperty(new SimpleString(name));
@ -521,6 +552,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public double getDoubleProperty(final String name) throws JMSException { public double getDoubleProperty(final String name) throws JMSException {
try { try {
return message.getDoubleProperty(new SimpleString(name)); return message.getDoubleProperty(new SimpleString(name));
@ -530,6 +562,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public String getStringProperty(final String name) throws JMSException { public String getStringProperty(final String name) throws JMSException {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) { if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return String.valueOf(message.getDeliveryCount()); return String.valueOf(message.getDeliveryCount());
@ -548,6 +581,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public Object getObjectProperty(final String name) throws JMSException { public Object getObjectProperty(final String name) throws JMSException {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) { if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return String.valueOf(message.getDeliveryCount()); return String.valueOf(message.getDeliveryCount());
@ -566,42 +600,50 @@ public class ActiveMQMessage implements javax.jms.Message {
return Collections.enumeration(MessageUtil.getPropertyNames(message)); return Collections.enumeration(MessageUtil.getPropertyNames(message));
} }
@Override
public void setBooleanProperty(final String name, final boolean value) throws JMSException { public void setBooleanProperty(final String name, final boolean value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putBooleanProperty(new SimpleString(name), value); message.putBooleanProperty(new SimpleString(name), value);
} }
@Override
public void setByteProperty(final String name, final byte value) throws JMSException { public void setByteProperty(final String name, final byte value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putByteProperty(new SimpleString(name), value); message.putByteProperty(new SimpleString(name), value);
} }
@Override
public void setShortProperty(final String name, final short value) throws JMSException { public void setShortProperty(final String name, final short value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putShortProperty(new SimpleString(name), value); message.putShortProperty(new SimpleString(name), value);
} }
@Override
public void setIntProperty(final String name, final int value) throws JMSException { public void setIntProperty(final String name, final int value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putIntProperty(new SimpleString(name), value); message.putIntProperty(new SimpleString(name), value);
} }
@Override
public void setLongProperty(final String name, final long value) throws JMSException { public void setLongProperty(final String name, final long value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putLongProperty(new SimpleString(name), value); message.putLongProperty(new SimpleString(name), value);
} }
@Override
public void setFloatProperty(final String name, final float value) throws JMSException { public void setFloatProperty(final String name, final float value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putFloatProperty(new SimpleString(name), value); message.putFloatProperty(new SimpleString(name), value);
} }
@Override
public void setDoubleProperty(final String name, final double value) throws JMSException { public void setDoubleProperty(final String name, final double value) throws JMSException {
checkProperty(name); checkProperty(name);
message.putDoubleProperty(new SimpleString(name), value); message.putDoubleProperty(new SimpleString(name), value);
} }
@Override
public void setStringProperty(final String name, final String value) throws JMSException { public void setStringProperty(final String name, final String value) throws JMSException {
checkProperty(name); checkProperty(name);
@ -613,6 +655,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public void setObjectProperty(final String name, final Object value) throws JMSException { public void setObjectProperty(final String name, final Object value) throws JMSException {
if (ActiveMQJMSConstants.JMS_ACTIVEMQ_OUTPUT_STREAM.equals(name)) { if (ActiveMQJMSConstants.JMS_ACTIVEMQ_OUTPUT_STREAM.equals(name)) {
setOutputStream((OutputStream) value); setOutputStream((OutputStream) value);
@ -641,6 +684,7 @@ public class ActiveMQMessage implements javax.jms.Message {
} }
} }
@Override
public void acknowledge() throws JMSException { public void acknowledge() throws JMSException {
if (session != null) { if (session != null) {
try { try {

View File

@ -86,18 +86,21 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
// MessageConsumer implementation -------------------------------- // MessageConsumer implementation --------------------------------
@Override
public String getMessageSelector() throws JMSException { public String getMessageSelector() throws JMSException {
checkClosed(); checkClosed();
return selector; return selector;
} }
@Override
public MessageListener getMessageListener() throws JMSException { public MessageListener getMessageListener() throws JMSException {
checkClosed(); checkClosed();
return listener; return listener;
} }
@Override
public void setMessageListener(final MessageListener listener) throws JMSException { public void setMessageListener(final MessageListener listener) throws JMSException {
this.listener = listener; this.listener = listener;
@ -111,18 +114,22 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
} }
} }
@Override
public Message receive() throws JMSException { public Message receive() throws JMSException {
return getMessage(0, false); return getMessage(0, false);
} }
@Override
public Message receive(final long timeout) throws JMSException { public Message receive(final long timeout) throws JMSException {
return getMessage(timeout, false); return getMessage(timeout, false);
} }
@Override
public Message receiveNoWait() throws JMSException { public Message receiveNoWait() throws JMSException {
return getMessage(0, true); return getMessage(0, true);
} }
@Override
public void close() throws JMSException { public void close() throws JMSException {
try { try {
consumer.close(); consumer.close();
@ -141,6 +148,7 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
// QueueReceiver implementation ---------------------------------- // QueueReceiver implementation ----------------------------------
@Override
public Queue getQueue() throws JMSException { public Queue getQueue() throws JMSException {
checkClosed(); checkClosed();
@ -149,12 +157,14 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
// TopicSubscriber implementation -------------------------------- // TopicSubscriber implementation --------------------------------
@Override
public Topic getTopic() throws JMSException { public Topic getTopic() throws JMSException {
checkClosed(); checkClosed();
return (Topic) destination; return (Topic) destination;
} }
@Override
public boolean getNoLocal() throws JMSException { public boolean getNoLocal() throws JMSException {
checkClosed(); checkClosed();

View File

@ -84,30 +84,35 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
// MessageProducer implementation -------------------------------- // MessageProducer implementation --------------------------------
@Override
public void setDisableMessageID(final boolean value) throws JMSException { public void setDisableMessageID(final boolean value) throws JMSException {
checkClosed(); checkClosed();
disableMessageID = value; disableMessageID = value;
} }
@Override
public boolean getDisableMessageID() throws JMSException { public boolean getDisableMessageID() throws JMSException {
checkClosed(); checkClosed();
return disableMessageID; return disableMessageID;
} }
@Override
public void setDisableMessageTimestamp(final boolean value) throws JMSException { public void setDisableMessageTimestamp(final boolean value) throws JMSException {
checkClosed(); checkClosed();
disableMessageTimestamp = value; disableMessageTimestamp = value;
} }
@Override
public boolean getDisableMessageTimestamp() throws JMSException { public boolean getDisableMessageTimestamp() throws JMSException {
checkClosed(); checkClosed();
return disableMessageTimestamp; return disableMessageTimestamp;
} }
@Override
public void setDeliveryMode(final int deliveryMode) throws JMSException { public void setDeliveryMode(final int deliveryMode) throws JMSException {
checkClosed(); checkClosed();
if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) { if (deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT) {
@ -117,12 +122,14 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
defaultDeliveryMode = deliveryMode; defaultDeliveryMode = deliveryMode;
} }
@Override
public int getDeliveryMode() throws JMSException { public int getDeliveryMode() throws JMSException {
checkClosed(); checkClosed();
return defaultDeliveryMode; return defaultDeliveryMode;
} }
@Override
public void setPriority(final int defaultPriority) throws JMSException { public void setPriority(final int defaultPriority) throws JMSException {
checkClosed(); checkClosed();
@ -133,30 +140,35 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
this.defaultPriority = defaultPriority; this.defaultPriority = defaultPriority;
} }
@Override
public int getPriority() throws JMSException { public int getPriority() throws JMSException {
checkClosed(); checkClosed();
return defaultPriority; return defaultPriority;
} }
@Override
public void setTimeToLive(final long timeToLive) throws JMSException { public void setTimeToLive(final long timeToLive) throws JMSException {
checkClosed(); checkClosed();
defaultTimeToLive = timeToLive; defaultTimeToLive = timeToLive;
} }
@Override
public long getTimeToLive() throws JMSException { public long getTimeToLive() throws JMSException {
checkClosed(); checkClosed();
return defaultTimeToLive; return defaultTimeToLive;
} }
@Override
public Destination getDestination() throws JMSException { public Destination getDestination() throws JMSException {
checkClosed(); checkClosed();
return defaultDestination; return defaultDestination;
} }
@Override
public void close() throws JMSException { public void close() throws JMSException {
connection.getThreadAwareContext().assertNotCompletionListenerThread(); connection.getThreadAwareContext().assertNotCompletionListenerThread();
try { try {
@ -167,11 +179,13 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
} }
} }
@Override
public void send(final Message message) throws JMSException { public void send(final Message message) throws JMSException {
checkDefaultDestination(); checkDefaultDestination();
doSendx(defaultDestination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive, null); doSendx(defaultDestination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive, null);
} }
@Override
public void send(final Message message, public void send(final Message message,
final int deliveryMode, final int deliveryMode,
final int priority, final int priority,
@ -180,10 +194,12 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
doSendx(defaultDestination, message, deliveryMode, priority, timeToLive, null); doSendx(defaultDestination, message, deliveryMode, priority, timeToLive, null);
} }
@Override
public void send(final Destination destination, final Message message) throws JMSException { public void send(final Destination destination, final Message message) throws JMSException {
send(destination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive); send(destination, message, defaultDeliveryMode, defaultPriority, defaultTimeToLive);
} }
@Override
public void send(final Destination destination, public void send(final Destination destination,
final Message message, final Message message,
final int deliveryMode, final int deliveryMode,
@ -247,18 +263,22 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
// TopicPublisher Implementation --------------------------------- // TopicPublisher Implementation ---------------------------------
@Override
public Topic getTopic() throws JMSException { public Topic getTopic() throws JMSException {
return (Topic) getDestination(); return (Topic) getDestination();
} }
@Override
public void publish(final Message message) throws JMSException { public void publish(final Message message) throws JMSException {
send(message); send(message);
} }
@Override
public void publish(final Topic topic, final Message message) throws JMSException { public void publish(final Topic topic, final Message message) throws JMSException {
send(topic, message); send(topic, message);
} }
@Override
public void publish(final Message message, public void publish(final Message message,
final int deliveryMode, final int deliveryMode,
final int priority, final int priority,
@ -266,6 +286,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
send(message, deliveryMode, priority, timeToLive); send(message, deliveryMode, priority, timeToLive);
} }
@Override
public void publish(final Topic topic, public void publish(final Topic topic,
final Message message, final Message message,
final int deliveryMode, final int deliveryMode,
@ -277,10 +298,12 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
// QueueSender Implementation ------------------------------------ // QueueSender Implementation ------------------------------------
@Override
public void send(final Queue queue, final Message message) throws JMSException { public void send(final Queue queue, final Message message) throws JMSException {
send((Destination) queue, message); send((Destination) queue, message);
} }
@Override
public void send(final Queue queue, public void send(final Queue queue,
final Message message, final Message message,
final int deliveryMode, final int deliveryMode,
@ -290,6 +313,7 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender, To
doSendx((ActiveMQDestination) queue, message, deliveryMode, priority, timeToLive, null); doSendx((ActiveMQDestination) queue, message, deliveryMode, priority, timeToLive, null);
} }
@Override
public Queue getQueue() throws JMSException { public Queue getQueue() throws JMSException {
return (Queue) getDestination(); return (Queue) getDestination();
} }

View File

@ -103,6 +103,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
// ObjectMessage implementation ---------------------------------- // ObjectMessage implementation ----------------------------------
@Override
public void setObject(final Serializable object) throws JMSException { public void setObject(final Serializable object) throws JMSException {
checkWrite(); checkWrite();
@ -128,6 +129,7 @@ public class ActiveMQObjectMessage extends ActiveMQMessage implements ObjectMess
} }
// lazy deserialize the Object the first time the client requests it // lazy deserialize the Object the first time the client requests it
@Override
public Serializable getObject() throws JMSException { public Serializable getObject() throws JMSException {
if (data == null || data.length == 0) { if (data == null || data.length == 0) {
return null; return null;

View File

@ -66,6 +66,7 @@ public class ActiveMQQueue extends ActiveMQDestination implements Queue {
// Public -------------------------------------------------------- // Public --------------------------------------------------------
@Override
public String getQueueName() { public String getQueueName() {
return name; return name;
} }

View File

@ -61,6 +61,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser {
// QueueBrowser implementation ------------------------------------------------------------------- // QueueBrowser implementation -------------------------------------------------------------------
@Override
public void close() throws JMSException { public void close() throws JMSException {
if (consumer != null) { if (consumer != null) {
try { try {
@ -72,6 +73,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser {
} }
} }
@Override
public Enumeration getEnumeration() throws JMSException { public Enumeration getEnumeration() throws JMSException {
try { try {
close(); close();
@ -86,10 +88,12 @@ public final class ActiveMQQueueBrowser implements QueueBrowser {
} }
@Override
public String getMessageSelector() throws JMSException { public String getMessageSelector() throws JMSException {
return filterString == null ? null : filterString.toString(); return filterString == null ? null : filterString.toString();
} }
@Override
public Queue getQueue() throws JMSException { public Queue getQueue() throws JMSException {
return queue; return queue;
} }
@ -113,6 +117,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser {
ClientMessage current = null; ClientMessage current = null;
@Override
public boolean hasMoreElements() { public boolean hasMoreElements() {
if (current == null) { if (current == null) {
try { try {
@ -125,6 +130,7 @@ public final class ActiveMQQueueBrowser implements QueueBrowser {
return current != null; return current != null;
} }
@Override
public ActiveMQMessage nextElement() { public ActiveMQMessage nextElement() {
ActiveMQMessage msg; ActiveMQMessage msg;
if (hasMoreElements()) { if (hasMoreElements()) {

View File

@ -54,6 +54,7 @@ public class ActiveMQQueueConnectionFactory extends ActiveMQConnectionFactory im
super(ha, initialConnectors); super(ha, initialConnectors);
} }
@Override
public int getFactoryType() { public int getFactoryType() {
return JMSFactoryType.QUEUE_CF.intValue(); return JMSFactoryType.QUEUE_CF.intValue();
} }

View File

@ -115,30 +115,35 @@ public class ActiveMQSession implements QueueSession, TopicSession {
// Session implementation ---------------------------------------- // Session implementation ----------------------------------------
@Override
public BytesMessage createBytesMessage() throws JMSException { public BytesMessage createBytesMessage() throws JMSException {
checkClosed(); checkClosed();
return new ActiveMQBytesMessage(session); return new ActiveMQBytesMessage(session);
} }
@Override
public MapMessage createMapMessage() throws JMSException { public MapMessage createMapMessage() throws JMSException {
checkClosed(); checkClosed();
return new ActiveMQMapMessage(session); return new ActiveMQMapMessage(session);
} }
@Override
public Message createMessage() throws JMSException { public Message createMessage() throws JMSException {
checkClosed(); checkClosed();
return new ActiveMQMessage(session); return new ActiveMQMessage(session);
} }
@Override
public ObjectMessage createObjectMessage() throws JMSException { public ObjectMessage createObjectMessage() throws JMSException {
checkClosed(); checkClosed();
return new ActiveMQObjectMessage(session); return new ActiveMQObjectMessage(session);
} }
@Override
public ObjectMessage createObjectMessage(final Serializable object) throws JMSException { public ObjectMessage createObjectMessage(final Serializable object) throws JMSException {
checkClosed(); checkClosed();
@ -149,12 +154,14 @@ public class ActiveMQSession implements QueueSession, TopicSession {
return msg; return msg;
} }
@Override
public StreamMessage createStreamMessage() throws JMSException { public StreamMessage createStreamMessage() throws JMSException {
checkClosed(); checkClosed();
return new ActiveMQStreamMessage(session); return new ActiveMQStreamMessage(session);
} }
@Override
public TextMessage createTextMessage() throws JMSException { public TextMessage createTextMessage() throws JMSException {
checkClosed(); checkClosed();
@ -165,6 +172,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
return msg; return msg;
} }
@Override
public TextMessage createTextMessage(final String text) throws JMSException { public TextMessage createTextMessage(final String text) throws JMSException {
checkClosed(); checkClosed();
@ -175,12 +183,14 @@ public class ActiveMQSession implements QueueSession, TopicSession {
return msg; return msg;
} }
@Override
public boolean getTransacted() throws JMSException { public boolean getTransacted() throws JMSException {
checkClosed(); checkClosed();
return transacted; return transacted;
} }
@Override
public int getAcknowledgeMode() throws JMSException { public int getAcknowledgeMode() throws JMSException {
checkClosed(); checkClosed();
@ -191,6 +201,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
return xa; return xa;
} }
@Override
public void commit() throws JMSException { public void commit() throws JMSException {
if (!transacted) { if (!transacted) {
throw new IllegalStateException("Cannot commit a non-transacted session"); throw new IllegalStateException("Cannot commit a non-transacted session");
@ -206,6 +217,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public void rollback() throws JMSException { public void rollback() throws JMSException {
if (!transacted) { if (!transacted) {
throw new IllegalStateException("Cannot rollback a non-transacted session"); throw new IllegalStateException("Cannot rollback a non-transacted session");
@ -222,6 +234,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public void close() throws JMSException { public void close() throws JMSException {
connection.getThreadAwareContext().assertNotCompletionListenerThread(); connection.getThreadAwareContext().assertNotCompletionListenerThread();
connection.getThreadAwareContext().assertNotMessageListenerThread(); connection.getThreadAwareContext().assertNotMessageListenerThread();
@ -241,6 +254,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public void recover() throws JMSException { public void recover() throws JMSException {
if (transacted) { if (transacted) {
throw new IllegalStateException("Cannot recover a transacted session"); throw new IllegalStateException("Cannot recover a transacted session");
@ -256,19 +270,23 @@ public class ActiveMQSession implements QueueSession, TopicSession {
recoverCalled = true; recoverCalled = true;
} }
@Override
public MessageListener getMessageListener() throws JMSException { public MessageListener getMessageListener() throws JMSException {
checkClosed(); checkClosed();
return null; return null;
} }
@Override
public void setMessageListener(final MessageListener listener) throws JMSException { public void setMessageListener(final MessageListener listener) throws JMSException {
checkClosed(); checkClosed();
} }
@Override
public void run() { public void run() {
} }
@Override
public MessageProducer createProducer(final Destination destination) throws JMSException { public MessageProducer createProducer(final Destination destination) throws JMSException {
if (destination != null && !(destination instanceof ActiveMQDestination)) { if (destination != null && !(destination instanceof ActiveMQDestination)) {
throw new InvalidDestinationException("Not an ActiveMQ Artemis Destination:" + destination); throw new InvalidDestinationException("Not an ActiveMQ Artemis Destination:" + destination);
@ -301,15 +319,18 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public MessageConsumer createConsumer(final Destination destination) throws JMSException { public MessageConsumer createConsumer(final Destination destination) throws JMSException {
return createConsumer(destination, null, false); return createConsumer(destination, null, false);
} }
@Override
public MessageConsumer createConsumer(final Destination destination, public MessageConsumer createConsumer(final Destination destination,
final String messageSelector) throws JMSException { final String messageSelector) throws JMSException {
return createConsumer(destination, messageSelector, false); return createConsumer(destination, messageSelector, false);
} }
@Override
public MessageConsumer createConsumer(final Destination destination, public MessageConsumer createConsumer(final Destination destination,
final String messageSelector, final String messageSelector,
final boolean noLocal) throws JMSException { final boolean noLocal) throws JMSException {
@ -331,6 +352,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
return createConsumer(jbdest, null, messageSelector, noLocal, ConsumerDurability.NON_DURABLE); return createConsumer(jbdest, null, messageSelector, noLocal, ConsumerDurability.NON_DURABLE);
} }
@Override
public Queue createQueue(final String queueName) throws JMSException { public Queue createQueue(final String queueName) throws JMSException {
// As per spec. section 4.11 // As per spec. section 4.11
if (sessionType == ActiveMQSession.TYPE_TOPIC_SESSION) { if (sessionType == ActiveMQSession.TYPE_TOPIC_SESSION) {
@ -356,6 +378,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public Topic createTopic(final String topicName) throws JMSException { public Topic createTopic(final String topicName) throws JMSException {
// As per spec. section 4.11 // As per spec. section 4.11
if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) {
@ -381,10 +404,12 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public TopicSubscriber createDurableSubscriber(final Topic topic, final String name) throws JMSException { public TopicSubscriber createDurableSubscriber(final Topic topic, final String name) throws JMSException {
return createDurableSubscriber(topic, name, null, false); return createDurableSubscriber(topic, name, null, false);
} }
@Override
public TopicSubscriber createDurableSubscriber(final Topic topic, public TopicSubscriber createDurableSubscriber(final Topic topic,
final String name, final String name,
String messageSelector, String messageSelector,
@ -730,10 +755,12 @@ public class ActiveMQSession implements QueueSession, TopicSession {
checkClosed(); checkClosed();
} }
@Override
public QueueBrowser createBrowser(final Queue queue) throws JMSException { public QueueBrowser createBrowser(final Queue queue) throws JMSException {
return createBrowser(queue, null); return createBrowser(queue, null);
} }
@Override
public QueueBrowser createBrowser(final Queue queue, String filterString) throws JMSException { public QueueBrowser createBrowser(final Queue queue, String filterString) throws JMSException {
// As per spec. section 4.11 // As per spec. section 4.11
if (sessionType == ActiveMQSession.TYPE_TOPIC_SESSION) { if (sessionType == ActiveMQSession.TYPE_TOPIC_SESSION) {
@ -784,6 +811,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
@Override
public TemporaryQueue createTemporaryQueue() throws JMSException { public TemporaryQueue createTemporaryQueue() throws JMSException {
// As per spec. section 4.11 // As per spec. section 4.11
if (sessionType == ActiveMQSession.TYPE_TOPIC_SESSION) { if (sessionType == ActiveMQSession.TYPE_TOPIC_SESSION) {
@ -806,6 +834,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public TemporaryTopic createTemporaryTopic() throws JMSException { public TemporaryTopic createTemporaryTopic() throws JMSException {
// As per spec. section 4.11 // As per spec. section 4.11
if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) {
@ -833,6 +862,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
} }
} }
@Override
public void unsubscribe(final String name) throws JMSException { public void unsubscribe(final String name) throws JMSException {
// As per spec. section 4.11 // As per spec. section 4.11
if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) {
@ -877,14 +907,17 @@ public class ActiveMQSession implements QueueSession, TopicSession {
// QueueSession implementation // QueueSession implementation
@Override
public QueueReceiver createReceiver(final Queue queue, final String messageSelector) throws JMSException { public QueueReceiver createReceiver(final Queue queue, final String messageSelector) throws JMSException {
return (QueueReceiver) createConsumer(queue, messageSelector); return (QueueReceiver) createConsumer(queue, messageSelector);
} }
@Override
public QueueReceiver createReceiver(final Queue queue) throws JMSException { public QueueReceiver createReceiver(final Queue queue) throws JMSException {
return (QueueReceiver) createConsumer(queue); return (QueueReceiver) createConsumer(queue);
} }
@Override
public QueueSender createSender(final Queue queue) throws JMSException { public QueueSender createSender(final Queue queue) throws JMSException {
return (QueueSender) createProducer(queue); return (QueueSender) createProducer(queue);
} }
@ -897,16 +930,19 @@ public class ActiveMQSession implements QueueSession, TopicSession {
// TopicSession implementation // TopicSession implementation
@Override
public TopicPublisher createPublisher(final Topic topic) throws JMSException { public TopicPublisher createPublisher(final Topic topic) throws JMSException {
return (TopicPublisher) createProducer(topic); return (TopicPublisher) createProducer(topic);
} }
@Override
public TopicSubscriber createSubscriber(final Topic topic, public TopicSubscriber createSubscriber(final Topic topic,
final String messageSelector, final String messageSelector,
final boolean noLocal) throws JMSException { final boolean noLocal) throws JMSException {
return (TopicSubscriber) createConsumer(topic, messageSelector, noLocal); return (TopicSubscriber) createConsumer(topic, messageSelector, noLocal);
} }
@Override
public TopicSubscriber createSubscriber(final Topic topic) throws JMSException { public TopicSubscriber createSubscriber(final Topic topic) throws JMSException {
return (TopicSubscriber) createConsumer(topic); return (TopicSubscriber) createConsumer(topic);
} }

View File

@ -86,6 +86,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
// StreamMessage implementation ---------------------------------- // StreamMessage implementation ----------------------------------
@Override
public boolean readBoolean() throws JMSException { public boolean readBoolean() throws JMSException {
checkRead(); checkRead();
try { try {
@ -99,6 +100,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public byte readByte() throws JMSException { public byte readByte() throws JMSException {
checkRead(); checkRead();
@ -113,6 +115,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public short readShort() throws JMSException { public short readShort() throws JMSException {
checkRead(); checkRead();
try { try {
@ -126,6 +129,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public char readChar() throws JMSException { public char readChar() throws JMSException {
checkRead(); checkRead();
try { try {
@ -139,6 +143,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public int readInt() throws JMSException { public int readInt() throws JMSException {
checkRead(); checkRead();
try { try {
@ -152,6 +157,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public long readLong() throws JMSException { public long readLong() throws JMSException {
checkRead(); checkRead();
try { try {
@ -165,6 +171,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public float readFloat() throws JMSException { public float readFloat() throws JMSException {
checkRead(); checkRead();
try { try {
@ -178,6 +185,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public double readDouble() throws JMSException { public double readDouble() throws JMSException {
checkRead(); checkRead();
try { try {
@ -191,6 +199,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public String readString() throws JMSException { public String readString() throws JMSException {
checkRead(); checkRead();
try { try {
@ -209,6 +218,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
*/ */
private int len = 0; private int len = 0;
@Override
public int readBytes(final byte[] value) throws JMSException { public int readBytes(final byte[] value) throws JMSException {
checkRead(); checkRead();
try { try {
@ -225,6 +235,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public Object readObject() throws JMSException { public Object readObject() throws JMSException {
checkRead(); checkRead();
try { try {
@ -238,60 +249,70 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public void writeBoolean(final boolean value) throws JMSException { public void writeBoolean(final boolean value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.BOOLEAN); getBuffer().writeByte(DataConstants.BOOLEAN);
getBuffer().writeBoolean(value); getBuffer().writeBoolean(value);
} }
@Override
public void writeByte(final byte value) throws JMSException { public void writeByte(final byte value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.BYTE); getBuffer().writeByte(DataConstants.BYTE);
getBuffer().writeByte(value); getBuffer().writeByte(value);
} }
@Override
public void writeShort(final short value) throws JMSException { public void writeShort(final short value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.SHORT); getBuffer().writeByte(DataConstants.SHORT);
getBuffer().writeShort(value); getBuffer().writeShort(value);
} }
@Override
public void writeChar(final char value) throws JMSException { public void writeChar(final char value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.CHAR); getBuffer().writeByte(DataConstants.CHAR);
getBuffer().writeShort((short) value); getBuffer().writeShort((short) value);
} }
@Override
public void writeInt(final int value) throws JMSException { public void writeInt(final int value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.INT); getBuffer().writeByte(DataConstants.INT);
getBuffer().writeInt(value); getBuffer().writeInt(value);
} }
@Override
public void writeLong(final long value) throws JMSException { public void writeLong(final long value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.LONG); getBuffer().writeByte(DataConstants.LONG);
getBuffer().writeLong(value); getBuffer().writeLong(value);
} }
@Override
public void writeFloat(final float value) throws JMSException { public void writeFloat(final float value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.FLOAT); getBuffer().writeByte(DataConstants.FLOAT);
getBuffer().writeInt(Float.floatToIntBits(value)); getBuffer().writeInt(Float.floatToIntBits(value));
} }
@Override
public void writeDouble(final double value) throws JMSException { public void writeDouble(final double value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.DOUBLE); getBuffer().writeByte(DataConstants.DOUBLE);
getBuffer().writeLong(Double.doubleToLongBits(value)); getBuffer().writeLong(Double.doubleToLongBits(value));
} }
@Override
public void writeString(final String value) throws JMSException { public void writeString(final String value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.STRING); getBuffer().writeByte(DataConstants.STRING);
getBuffer().writeNullableString(value); getBuffer().writeNullableString(value);
} }
@Override
public void writeBytes(final byte[] value) throws JMSException { public void writeBytes(final byte[] value) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.BYTES); getBuffer().writeByte(DataConstants.BYTES);
@ -299,6 +320,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
getBuffer().writeBytes(value); getBuffer().writeBytes(value);
} }
@Override
public void writeBytes(final byte[] value, final int offset, final int length) throws JMSException { public void writeBytes(final byte[] value, final int offset, final int length) throws JMSException {
checkWrite(); checkWrite();
getBuffer().writeByte(DataConstants.BYTES); getBuffer().writeByte(DataConstants.BYTES);
@ -306,6 +328,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
getBuffer().writeBytes(value, offset, length); getBuffer().writeBytes(value, offset, length);
} }
@Override
public void writeObject(final Object value) throws JMSException { public void writeObject(final Object value) throws JMSException {
if (value instanceof String) { if (value instanceof String) {
writeString((String) value); writeString((String) value);
@ -345,6 +368,7 @@ public final class ActiveMQStreamMessage extends ActiveMQMessage implements Stre
} }
} }
@Override
public void reset() throws JMSException { public void reset() throws JMSException {
if (!readOnly) { if (!readOnly) {
readOnly = true; readOnly = true;

View File

@ -74,6 +74,7 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
// TextMessage implementation ------------------------------------ // TextMessage implementation ------------------------------------
@Override
public void setText(final String text) throws JMSException { public void setText(final String text) throws JMSException {
checkWrite(); checkWrite();
@ -87,6 +88,7 @@ public class ActiveMQTextMessage extends ActiveMQMessage implements TextMessage
writeBodyText(message.getBodyBuffer(), this.text); writeBodyText(message.getBodyBuffer(), this.text);
} }
@Override
public String getText() { public String getText() {
if (text != null) { if (text != null) {
return text.toString(); return text.toString();

View File

@ -59,6 +59,7 @@ public class ActiveMQTopic extends ActiveMQDestination implements Topic {
// Topic implementation ------------------------------------------ // Topic implementation ------------------------------------------
@Override
public String getTopicName() { public String getTopicName() {
return name; return name;
} }

View File

@ -54,6 +54,7 @@ public class ActiveMQTopicConnectionFactory extends ActiveMQConnectionFactory im
super(ha, initialConnectors); super(ha, initialConnectors);
} }
@Override
public int getFactoryType() { public int getFactoryType() {
return JMSFactoryType.TOPIC_CF.intValue(); return JMSFactoryType.TOPIC_CF.intValue();
} }

Some files were not shown because too many files have changed in this diff Show More