This closes #340

This commit is contained in:
Clebert Suconic 2016-01-25 13:48:22 -05:00
commit 27c59583f6
27 changed files with 169 additions and 27 deletions

View File

@ -121,7 +121,7 @@ public class URISupport {
public static Map<String, String> parseQuery(String uri) throws URISyntaxException {
try {
uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query
Map<String, String> rc = new HashMap<String, String>();
Map<String, String> rc = new HashMap<>();
if (uri != null && !uri.isEmpty()) {
parseParameters(rc, uri.split("&"));
parseParameters(rc, uri.split(";"));
@ -164,7 +164,7 @@ public class URISupport {
}
else {
CompositeData data = URISupport.parseComposite(uri);
Map<String, String> parameters = new HashMap<String, String>();
Map<String, String> parameters = new HashMap<>();
parameters.putAll(data.getParameters());
if (parameters.isEmpty()) {
parameters = emptyMap();
@ -402,7 +402,7 @@ public class URISupport {
* @return an array containing each inner URI from the composite one.
*/
private static String[] splitComponents(String str) {
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
int last = 0;
int depth = 0;

View File

@ -304,7 +304,7 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
@Override
public String sendTextMessageWithProperties(String properties) throws Exception {
String[] kvs = properties.split(",");
Map<String, String> props = new HashMap<String, String>();
Map<String, String> props = new HashMap<>();
for (String kv : kvs) {
String[] it = kv.split("=");
if (it.length == 2) {

View File

@ -52,10 +52,11 @@ public final class JMSOpenTypeSupport {
public abstract static class AbstractOpenTypeFactory implements OpenTypeFactory {
private CompositeType compositeType;
private final List<String> itemNamesList = new ArrayList<String>();
private final List<String> itemDescriptionsList = new ArrayList<String>();
private final List<OpenType> itemTypesList = new ArrayList<OpenType>();
private final List<String> itemNamesList = new ArrayList<>();
private final List<String> itemDescriptionsList = new ArrayList<>();
private final List<OpenType> itemTypesList = new ArrayList<>();
@Override
public CompositeType getCompositeType() throws OpenDataException {
if (compositeType == null) {
init();
@ -86,8 +87,9 @@ public final class JMSOpenTypeSupport {
return getTypeName();
}
@Override
public Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException {
Map<String, Object> rc = new HashMap<String, Object>();
Map<String, Object> rc = new HashMap<>();
return rc;
}
}

View File

@ -25,9 +25,9 @@ public class PreparedTransactionInfo {
private final byte[] extraData;
private final List<RecordInfo> records = new ArrayList<RecordInfo>();
private final List<RecordInfo> records = new ArrayList<>();
private final List<RecordInfo> recordsToDelete = new ArrayList<RecordInfo>();
private final List<RecordInfo> recordsToDelete = new ArrayList<>();
public PreparedTransactionInfo(final long id, final byte[] extraData) {
this.id = id;

View File

@ -495,6 +495,7 @@ public class ConfigurationImpl implements Configuration, Serializable {
return this;
}
@Override
public ClusterConnectionConfiguration addClusterConfiguration(String name, String uri) throws Exception {
ClusterConnectionConfiguration newConfig = new ClusterConnectionConfiguration(new URI(uri)).setName(name);
clusterConfigurations.add(newConfig);
@ -1289,10 +1290,12 @@ public class ConfigurationImpl implements Configuration, Serializable {
return this;
}
@Override
public TransportConfiguration[] getTransportConfigurations(String... connectorNames) {
return getTransportConfigurations(Arrays.asList(connectorNames));
}
@Override
public TransportConfiguration[] getTransportConfigurations(final List<String> connectorNames) {
TransportConfiguration[] tcConfigs = (TransportConfiguration[]) Array.newInstance(TransportConfiguration.class, connectorNames.size());
int count = 0;

View File

@ -52,9 +52,9 @@ public final class OpenTypeSupport {
static class MessageOpenTypeFactory {
private CompositeType compositeType;
private final List<String> itemNamesList = new ArrayList<String>();
private final List<String> itemDescriptionsList = new ArrayList<String>();
private final List<OpenType> itemTypesList = new ArrayList<OpenType>();
private final List<String> itemNamesList = new ArrayList<>();
private final List<String> itemDescriptionsList = new ArrayList<>();
private final List<OpenType> itemTypesList = new ArrayList<>();
protected TabularType stringPropertyTabularType;
protected TabularType booleanPropertyTabularType;
@ -239,7 +239,7 @@ public final class OpenTypeSupport {
}
protected CompositeDataSupport createTabularRowValue(TabularType type, String key, Object value) throws OpenDataException {
Map<String, Object> fields = new HashMap<String, Object>();
Map<String, Object> fields = new HashMap<>();
fields.put("key", key);
fields.put("value", value);
return new CompositeDataSupport(type.getRowType(), fields);

View File

@ -263,10 +263,12 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
return getContext().waitCompletion(timeout);
}
@Override
public OperationContext getContext() {
return OperationContextImpl.getContext(executorFactory);
}
@Override
public void setContext(final OperationContext context) {
OperationContextImpl.setContext(context);
}
@ -275,22 +277,27 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
return singleThreadExecutor;
}
@Override
public OperationContext newSingleThreadContext() {
return newContext(singleThreadExecutor);
}
@Override
public OperationContext newContext(final Executor executor1) {
return new OperationContextImpl(executor1);
}
@Override
public void afterCompleteOperations(final IOCallback run) {
getContext().executeOnCompletion(run);
}
@Override
public long generateID() {
return idGenerator.generateID();
}
@Override
public long getCurrentID() {
return idGenerator.getCurrentID();
}
@ -298,6 +305,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
// Non transactional operations
@Override
public void confirmPendingLargeMessageTX(final Transaction tx, long messageID, long recordID) throws Exception {
readLock();
try {
@ -312,6 +320,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
/**
* We don't need messageID now but we are likely to need it we ever decide to support a database
*/
@Override
public void confirmPendingLargeMessage(long recordID) throws Exception {
readLock();
try {
@ -322,6 +331,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeMessage(final ServerMessage message) throws Exception {
if (message.getMessageID() <= 0) {
// Sanity check only... this shouldn't happen unless there is a bug
@ -345,6 +355,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeReference(final long queueID, final long messageID, final boolean last) throws Exception {
readLock();
try {
@ -365,6 +376,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
storageManagerLock.readLock().unlock();
}
@Override
public void storeAcknowledge(final long queueID, final long messageID) throws Exception {
readLock();
try {
@ -375,6 +387,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeCursorAcknowledge(long queueID, PagePosition position) throws Exception {
readLock();
try {
@ -387,6 +400,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteMessage(final long messageID) throws Exception {
readLock();
try {
@ -401,6 +415,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void updateScheduledDeliveryTime(final MessageReference ref) throws Exception {
ScheduledDeliveryEncoding encoding = new ScheduledDeliveryEncoding(ref.getScheduledDeliveryTime(), ref.getQueue().getID());
readLock();
@ -412,6 +427,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception {
readLock();
try {
@ -424,6 +440,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteDuplicateID(final long recordID) throws Exception {
readLock();
try {
@ -436,6 +453,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
// Transactional operations
@Override
public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception {
if (message.getMessageID() <= 0) {
throw ActiveMQMessageBundle.BUNDLE.messageIdNotAssigned();
@ -456,6 +474,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storePageTransaction(final long txID, final PageTransactionInfo pageTransaction) throws Exception {
readLock();
try {
@ -467,6 +486,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void updatePageTransaction(final long txID,
final PageTransactionInfo pageTransaction,
final int depages) throws Exception {
@ -479,6 +499,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void updatePageTransaction(final PageTransactionInfo pageTransaction, final int depages) throws Exception {
readLock();
try {
@ -489,6 +510,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeReferenceTransactional(final long txID, final long queueID, final long messageID) throws Exception {
readLock();
try {
@ -499,6 +521,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeAcknowledgeTransactional(final long txID,
final long queueID,
final long messageID) throws Exception {
@ -511,6 +534,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeCursorAcknowledgeTransactional(long txID, long queueID, PagePosition position) throws Exception {
readLock();
try {
@ -523,16 +547,19 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storePageCompleteTransactional(long txID, long queueID, PagePosition position) throws Exception {
long recordID = idGenerator.generateID();
position.setRecordID(recordID);
messageJournal.appendAddRecordTransactional(txID, recordID, JournalRecordIds.PAGE_CURSOR_COMPLETE, new CursorAckRecordEncoding(queueID, position));
}
@Override
public void deletePageComplete(long ackID) throws Exception {
messageJournal.appendDeleteRecord(ackID, false);
}
@Override
public void deleteCursorAcknowledgeTransactional(long txID, long ackID) throws Exception {
readLock();
try {
@ -543,10 +570,12 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteCursorAcknowledge(long ackID) throws Exception {
messageJournal.appendDeleteRecord(ackID, false);
}
@Override
public long storeHeuristicCompletion(final Xid xid, final boolean isCommit) throws Exception {
readLock();
try {
@ -560,6 +589,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteHeuristicCompletion(final long id) throws Exception {
readLock();
try {
@ -571,6 +601,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deletePageTransactional(final long recordID) throws Exception {
readLock();
try {
@ -581,6 +612,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void updateScheduledDeliveryTimeTransactional(final long txID, final MessageReference ref) throws Exception {
ScheduledDeliveryEncoding encoding = new ScheduledDeliveryEncoding(ref.getScheduledDeliveryTime(), ref.getQueue().getID());
readLock();
@ -593,6 +625,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void prepare(final long txID, final Xid xid) throws Exception {
readLock();
try {
@ -603,19 +636,23 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void commit(final long txID) throws Exception {
commit(txID, true);
}
@Override
public void commitBindings(final long txID) throws Exception {
bindingsJournal.appendCommitRecord(txID, true);
}
@Override
public void rollbackBindings(final long txID) throws Exception {
// no need to sync, it's going away anyways
bindingsJournal.appendRollbackRecord(txID, false);
}
@Override
public void commit(final long txID, final boolean lineUpContext) throws Exception {
readLock();
try {
@ -636,6 +673,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void rollback(final long txID) throws Exception {
readLock();
try {
@ -646,6 +684,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeDuplicateIDTransactional(final long txID,
final SimpleString address,
final byte[] duplID,
@ -661,6 +700,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void updateDuplicateIDTransactional(final long txID,
final SimpleString address,
final byte[] duplID,
@ -676,6 +716,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteDuplicateIDTransactional(final long txID, final long recordID) throws Exception {
readLock();
try {
@ -688,6 +729,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
// Other operations
@Override
public void updateDeliveryCount(final MessageReference ref) throws Exception {
// no need to store if it's the same value
// otherwise the journal will get OME in case of lots of redeliveries
@ -707,6 +749,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception {
deleteAddressSetting(addressSetting.getAddressMatch());
readLock();
@ -721,14 +764,17 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public List<PersistedAddressSetting> recoverAddressSettings() throws Exception {
return new ArrayList<>(mapPersistedAddressSettings.values());
}
@Override
public List<PersistedRoles> recoverPersistedRoles() throws Exception {
return new ArrayList<>(mapPersistedRoles.values());
}
@Override
public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception {
deleteSecurityRoles(persistedRoles.getAddressMatch());
@ -766,6 +812,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteAddressSetting(SimpleString addressMatch) throws Exception {
PersistedAddressSetting oldSetting = mapPersistedAddressSettings.remove(addressMatch);
if (oldSetting != null) {
@ -779,6 +826,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteSecurityRoles(SimpleString addressMatch) throws Exception {
PersistedRoles oldRoles = mapPersistedRoles.remove(addressMatch);
if (oldRoles != null) {
@ -1174,6 +1222,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
// grouping handler operations
@Override
public void addGrouping(final GroupBinding groupBinding) throws Exception {
GroupingEncoding groupingEncoding = new GroupingEncoding(groupBinding.getId(), groupBinding.getGroupId(), groupBinding.getClusterName());
readLock();
@ -1185,6 +1234,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteGrouping(long tx, final GroupBinding groupBinding) throws Exception {
readLock();
try {
@ -1197,6 +1247,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
// BindingsImpl operations
@Override
public void addQueueBinding(final long tx, final Binding binding) throws Exception {
Queue queue = (Queue) binding.getBindable();
@ -1215,6 +1266,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteQueueBinding(long tx, final long queueBindingID) throws Exception {
readLock();
try {
@ -1225,6 +1277,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public long storePageCounterInc(long txID, long queueID, int value) throws Exception {
readLock();
try {
@ -1237,6 +1290,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public long storePageCounterInc(long queueID, int value) throws Exception {
readLock();
try {
@ -1278,6 +1332,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deleteIncrementRecord(long txID, long recordID) throws Exception {
readLock();
try {
@ -1288,6 +1343,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deletePageCounter(long txID, long recordID) throws Exception {
readLock();
try {
@ -1298,6 +1354,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void deletePendingPageCounter(long txID, long recordID) throws Exception {
readLock();
try {
@ -1308,11 +1365,12 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public JournalLoadInformation loadBindingJournal(final List<QueueBindingInfo> queueBindingInfos,
final List<GroupingInfo> groupingInfos) throws Exception {
List<RecordInfo> records = new ArrayList<RecordInfo>();
List<RecordInfo> records = new ArrayList<>();
List<PreparedTransactionInfo> preparedTransactions = new ArrayList<PreparedTransactionInfo>();
List<PreparedTransactionInfo> preparedTransactions = new ArrayList<>();
JournalLoadInformation bindingsInfo = bindingsJournal.load(records, preparedTransactions, null);
@ -1354,6 +1412,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
return bindingsInfo;
}
@Override
public void lineUpContext() {
readLock();
try {
@ -1369,6 +1428,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
protected abstract void beforeStart() throws Exception;
@Override
public synchronized void start() throws Exception {
if (started) {
return;
@ -1390,6 +1450,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
started = true;
}
@Override
public void stop() throws Exception {
stop(false);
}
@ -1407,6 +1468,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
*/
protected abstract void performCachedLargeMessageDeletes();
@Override
public synchronized void stop(boolean ioCriticalError) throws Exception {
if (!started) {
return;
@ -1444,6 +1506,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
protected abstract void beforeStop() throws Exception;
@Override
public synchronized boolean isStarted() {
return started;
}
@ -1465,12 +1528,14 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
}
}
@Override
public void beforePageRead() throws Exception {
if (pageMaxConcurrentIO != null) {
pageMaxConcurrentIO.acquire();
}
}
@Override
public void afterPageRead() throws Exception {
if (pageMaxConcurrentIO != null) {
pageMaxConcurrentIO.release();
@ -1479,10 +1544,12 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
// Public -----------------------------------------------------------------------------------
@Override
public Journal getMessageJournal() {
return messageJournal;
}
@Override
public Journal getBindingsJournal() {
return bindingsJournal;
}
@ -1521,9 +1588,9 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
Transaction tx = new TransactionImpl(preparedTransaction.getId(), xid, this);
List<MessageReference> referencesToAck = new ArrayList<MessageReference>();
List<MessageReference> referencesToAck = new ArrayList<>();
Map<Long, ServerMessage> messages = new HashMap<Long, ServerMessage>();
Map<Long, ServerMessage> messages = new HashMap<>();
// Use same method as load message journal to prune out acks, so they don't get added.
// Then have reacknowledge(tx) methods on queue, which needs to add the page size
@ -1677,7 +1744,7 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
switch (b) {
case ADD_LARGE_MESSAGE_PENDING: {
long messageID = buff.readLong();
if (!pendingLargeMessages.remove(new Pair<Long, Long>(recordDeleted.id, messageID))) {
if (!pendingLargeMessages.remove(new Pair<>(recordDeleted.id, messageID))) {
ActiveMQServerLogger.LOGGER.largeMessageNotFound(recordDeleted.id);
}
installLargeMessageConfirmationOnTX(tx, recordDeleted.id);
@ -1714,37 +1781,47 @@ public abstract class AbstractJournalStorageManager implements StorageManager {
return DummyOperationContext.instance;
}
@Override
public void executeOnCompletion(final IOCallback runnable) {
// There are no executeOnCompletion calls while using the DummyOperationContext
// However we keep the code here for correctness
runnable.done();
}
@Override
public void replicationDone() {
}
@Override
public void replicationLineUp() {
}
@Override
public void storeLineUp() {
}
@Override
public void done() {
}
@Override
public void onError(final int errorCode, final String errorMessage) {
}
@Override
public void waitCompletion() {
}
@Override
public boolean waitCompletion(final long timeout) {
return true;
}
@Override
public void pageSyncLineUp() {
}
@Override
public void pageSyncDone() {
}
}

View File

@ -564,7 +564,7 @@ public final class DescribeJournal {
}
case QUEUE_BINDING_RECORD:
return JournalStorageManager.newBindingEncoding(id, buffer);
return AbstractJournalStorageManager.newBindingEncoding(id, buffer);
case ID_COUNTER_RECORD:
EncodingSupport idReturn = new IDCounterEncoding();
@ -573,13 +573,13 @@ public final class DescribeJournal {
return idReturn;
case JournalRecordIds.GROUP_RECORD:
return JournalStorageManager.newGroupEncoding(id, buffer);
return AbstractJournalStorageManager.newGroupEncoding(id, buffer);
case ADDRESS_SETTING_RECORD:
return JournalStorageManager.newAddressEncoding(id, buffer);
return AbstractJournalStorageManager.newAddressEncoding(id, buffer);
case SECURITY_RECORD:
return JournalStorageManager.newSecurityRecord(id, buffer);
return AbstractJournalStorageManager.newSecurityRecord(id, buffer);
default:
return null;

View File

@ -27,37 +27,47 @@ final class DummyOperationContext implements OperationContext {
return DummyOperationContext.instance;
}
@Override
public void executeOnCompletion(final IOCallback runnable) {
// There are no executeOnCompletion calls while using the DummyOperationContext
// However we keep the code here for correctness
runnable.done();
}
@Override
public void replicationDone() {
}
@Override
public void replicationLineUp() {
}
@Override
public void storeLineUp() {
}
@Override
public void done() {
}
@Override
public void onError(final int errorCode, final String errorMessage) {
}
@Override
public void waitCompletion() {
}
@Override
public boolean waitCompletion(final long timeout) {
return true;
}
@Override
public void pageSyncLineUp() {
}
@Override
public void pageSyncDone() {
}
}

View File

@ -41,6 +41,7 @@ public class LargeMessageTXFailureCallback implements TransactionFailureCallback
this.messages = messages;
}
@Override
public void failedTransaction(final long transactionID,
final List<RecordInfo> records,
final List<RecordInfo> recordsToDelete) {

View File

@ -26,7 +26,7 @@ import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract
public final class TXLargeMessageConfirmationOperation extends TransactionOperationAbstract {
private AbstractJournalStorageManager journalStorageManager;
public List<Long> confirmedMessages = new LinkedList<Long>();
public List<Long> confirmedMessages = new LinkedList<>();
public TXLargeMessageConfirmationOperation(AbstractJournalStorageManager journalStorageManager) {
this.journalStorageManager = journalStorageManager;

View File

@ -42,16 +42,19 @@ public class CursorAckRecordEncoding implements EncodingSupport {
public PagePosition position;
@Override
public int getEncodeSize() {
return DataConstants.SIZE_LONG + DataConstants.SIZE_LONG + DataConstants.SIZE_INT;
}
@Override
public void encode(ActiveMQBuffer buffer) {
buffer.writeLong(queueID);
buffer.writeLong(position.getPageNr());
buffer.writeInt(position.getMessageNr());
}
@Override
public void decode(ActiveMQBuffer buffer) {
queueID = buffer.readLong();
long pageNR = buffer.readLong();

View File

@ -35,16 +35,19 @@ public class DeliveryCountUpdateEncoding implements EncodingSupport {
this.count = count;
}
@Override
public void decode(final ActiveMQBuffer buffer) {
queueID = buffer.readLong();
count = buffer.readInt();
}
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeLong(queueID);
buffer.writeInt(count);
}
@Override
public int getEncodeSize() {
return 8 + 4;
}

View File

@ -40,6 +40,7 @@ public class DuplicateIDEncoding implements EncodingSupport {
public DuplicateIDEncoding() {
}
@Override
public void decode(final ActiveMQBuffer buffer) {
address = buffer.readSimpleString();
@ -50,6 +51,7 @@ public class DuplicateIDEncoding implements EncodingSupport {
buffer.readBytes(duplID);
}
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeSimpleString(address);
@ -58,6 +60,7 @@ public class DuplicateIDEncoding implements EncodingSupport {
buffer.writeBytes(duplID);
}
@Override
public int getEncodeSize() {
return SimpleString.sizeofString(address) + DataConstants.SIZE_INT + duplID.length;
}

View File

@ -38,20 +38,24 @@ public class GroupingEncoding implements EncodingSupport, GroupingInfo {
public GroupingEncoding() {
}
@Override
public int getEncodeSize() {
return SimpleString.sizeofString(groupId) + SimpleString.sizeofString(clusterName);
}
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeSimpleString(groupId);
buffer.writeSimpleString(clusterName);
}
@Override
public void decode(final ActiveMQBuffer buffer) {
groupId = buffer.readSimpleString();
clusterName = buffer.readSimpleString();
}
@Override
public long getId() {
return id;
}
@ -60,10 +64,12 @@ public class GroupingEncoding implements EncodingSupport, GroupingInfo {
this.id = id;
}
@Override
public SimpleString getGroupId() {
return groupId;
}
@Override
public SimpleString getClusterName() {
return clusterName;
}

View File

@ -42,16 +42,19 @@ public class HeuristicCompletionEncoding implements EncodingSupport {
public HeuristicCompletionEncoding() {
}
@Override
public void decode(final ActiveMQBuffer buffer) {
xid = XidCodecSupport.decodeXid(buffer);
isCommit = buffer.readBoolean();
}
@Override
public void encode(final ActiveMQBuffer buffer) {
XidCodecSupport.encodeXid(xid, buffer);
buffer.writeBoolean(isCommit);
}
@Override
public int getEncodeSize() {
return XidCodecSupport.getXidEncodeLength(xid) + DataConstants.SIZE_BOOLEAN;
}

View File

@ -31,6 +31,7 @@ public class LargeMessageEncoding implements EncodingSupport {
/* (non-Javadoc)
* @see org.apache.activemq.artemis.core.journal.EncodingSupport#decode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
*/
@Override
public void decode(final ActiveMQBuffer buffer) {
message.decodeHeadersAndProperties(buffer);
}
@ -38,6 +39,7 @@ public class LargeMessageEncoding implements EncodingSupport {
/* (non-Javadoc)
* @see org.apache.activemq.artemis.core.journal.EncodingSupport#encode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
*/
@Override
public void encode(final ActiveMQBuffer buffer) {
message.encode(buffer);
}
@ -45,6 +47,7 @@ public class LargeMessageEncoding implements EncodingSupport {
/* (non-Javadoc)
* @see org.apache.activemq.artemis.core.journal.EncodingSupport#getEncodeSize()
*/
@Override
public int getEncodeSize() {
return message.getEncodeSize();
}

View File

@ -47,14 +47,17 @@ public class PageCountPendingImpl implements EncodingSupport, PageCountPending {
this.id = id;
}
@Override
public long getID() {
return id;
}
@Override
public long getQueueID() {
return queueID;
}
@Override
public long getPageID() {
return pageID;
}

View File

@ -47,15 +47,18 @@ public class PageCountRecordInc implements EncodingSupport {
return value;
}
@Override
public int getEncodeSize() {
return DataConstants.SIZE_LONG + DataConstants.SIZE_INT;
}
@Override
public void encode(ActiveMQBuffer buffer) {
buffer.writeLong(queueID);
buffer.writeInt(value);
}
@Override
public void decode(ActiveMQBuffer buffer) {
queueID = buffer.readLong();
value = buffer.readInt();

View File

@ -42,6 +42,7 @@ public class PageUpdateTXEncoding implements EncodingSupport {
this.recods = records;
}
@Override
public void decode(ActiveMQBuffer buffer) {
this.pageTX = buffer.readLong();
this.recods = buffer.readInt();

View File

@ -34,6 +34,7 @@ public class PendingLargeMessageEncoding implements EncodingSupport {
/* (non-Javadoc)
* @see org.apache.activemq.artemis.core.journal.EncodingSupport#decode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
*/
@Override
public void decode(final ActiveMQBuffer buffer) {
largeMessageID = buffer.readLong();
}
@ -41,6 +42,7 @@ public class PendingLargeMessageEncoding implements EncodingSupport {
/* (non-Javadoc)
* @see org.apache.activemq.artemis.core.journal.EncodingSupport#encode(org.apache.activemq.artemis.spi.core.remoting.ActiveMQBuffer)
*/
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeLong(largeMessageID);
}
@ -48,6 +50,7 @@ public class PendingLargeMessageEncoding implements EncodingSupport {
/* (non-Javadoc)
* @see org.apache.activemq.artemis.core.journal.EncodingSupport#getEncodeSize()
*/
@Override
public int getEncodeSize() {
return DataConstants.SIZE_LONG;
}

View File

@ -67,6 +67,7 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
this.autoCreated = autoCreated;
}
@Override
public long getId() {
return id;
}
@ -75,30 +76,37 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
this.id = id;
}
@Override
public SimpleString getAddress() {
return address;
}
@Override
public void replaceQueueName(SimpleString newName) {
this.name = newName;
}
@Override
public SimpleString getFilterString() {
return filterString;
}
@Override
public SimpleString getQueueName() {
return name;
}
@Override
public SimpleString getUser() {
return user;
}
@Override
public boolean isAutoCreated() {
return autoCreated;
}
@Override
public void decode(final ActiveMQBuffer buffer) {
name = buffer.readSimpleString();
address = buffer.readSimpleString();
@ -120,6 +128,7 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
autoCreated = buffer.readBoolean();
}
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeSimpleString(name);
buffer.writeSimpleString(address);
@ -128,6 +137,7 @@ public class PersistentQueueBindingEncoding implements EncodingSupport, QueueBin
buffer.writeBoolean(autoCreated);
}
@Override
public int getEncodeSize() {
return SimpleString.sizeofString(name) + SimpleString.sizeofString(address) +
SimpleString.sizeofNullableString(filterString) + DataConstants.SIZE_BOOLEAN +

View File

@ -32,14 +32,17 @@ public class QueueEncoding implements EncodingSupport {
super();
}
@Override
public void decode(final ActiveMQBuffer buffer) {
queueID = buffer.readLong();
}
@Override
public void encode(final ActiveMQBuffer buffer) {
buffer.writeLong(queueID);
}
@Override
public int getEncodeSize() {
return 8;
}

View File

@ -38,14 +38,17 @@ public class XidEncoding implements EncodingSupport {
xid = XidCodecSupport.decodeXid(ActiveMQBuffers.wrappedBuffer(data));
}
@Override
public void decode(final ActiveMQBuffer buffer) {
throw new IllegalStateException("Non Supported Operation");
}
@Override
public void encode(final ActiveMQBuffer buffer) {
XidCodecSupport.encodeXid(xid, buffer);
}
@Override
public int getEncodeSize() {
return XidCodecSupport.getXidEncodeLength(xid);
}

View File

@ -384,6 +384,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin {
}
}
@Override
public SecuritySettingPlugin stop() {
try {
eventContext.close();

View File

@ -40,6 +40,7 @@ public class ThreadLeakCheckRule extends ExternalResource {
*
* @throws if setup fails (which will disable {@code after}
*/
@Override
protected void before() throws Throwable {
// do nothing
@ -50,6 +51,7 @@ public class ThreadLeakCheckRule extends ExternalResource {
/**
* Override to tear down your specific external resource.
*/
@Override
protected void after() {
try {
if (enabled) {

View File

@ -41,7 +41,6 @@ import org.apache.activemq.artemis.api.core.management.MessageCounterInfo;
import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.apache.activemq.artemis.core.messagecounter.impl.MessageCounterManagerImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
@ -2030,7 +2029,7 @@ public class QueueControlTest extends ManagementTestBase {
QueueControl queueControl = createManagementControl(address, queue);
queueControl.sendMessage(new HashMap<String, String>(), MessageImpl.TEXT_TYPE, Base64.encodeBytes("theBody".getBytes()), "myID", true, "myUser", "myPassword");
queueControl.sendMessage(new HashMap<String, String>(), Message.TEXT_TYPE, Base64.encodeBytes("theBody".getBytes()), "myID", true, "myUser", "myPassword");
Assert.assertEquals(1, getMessageCount(queueControl));
@ -2055,7 +2054,7 @@ public class QueueControlTest extends ManagementTestBase {
QueueControl queueControl = createManagementControl(address, queue);
queueControl.sendMessage(new HashMap<String, String>(), MessageImpl.TEXT_TYPE, null, "myID", true, "myUser", "myPassword");
queueControl.sendMessage(new HashMap<String, String>(), Message.TEXT_TYPE, null, "myID", true, "myUser", "myPassword");
Assert.assertEquals(1, getMessageCount(queueControl));