You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/10 17:13:03 UTC
[04/53] [abbrv] [partial] activemq-artemis git commit: automatic
checkstyle change
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallback.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallback.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallback.java
index 2f627db..ae14ebd 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallback.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallback.java
@@ -18,8 +18,8 @@ package org.apache.activemq.artemis.core.journal.impl;
import org.apache.activemq.artemis.core.journal.RecordInfo;
-public interface JournalReaderCallback
-{
+public interface JournalReaderCallback {
+
void onReadAddRecord(RecordInfo info) throws Exception;
/**
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallbackAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallbackAbstract.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallbackAbstract.java
index 0214912..7bf9d0f 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallbackAbstract.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalReaderCallbackAbstract.java
@@ -18,47 +18,38 @@ package org.apache.activemq.artemis.core.journal.impl;
import org.apache.activemq.artemis.core.journal.RecordInfo;
-public class JournalReaderCallbackAbstract implements JournalReaderCallback
-{
+public class JournalReaderCallbackAbstract implements JournalReaderCallback {
- public void markAsDataFile(final JournalFile file)
- {
+ public void markAsDataFile(final JournalFile file) {
}
- public void onReadAddRecord(final RecordInfo info) throws Exception
- {
+ public void onReadAddRecord(final RecordInfo info) throws Exception {
}
- public void onReadAddRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception
- {
+ public void onReadAddRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception {
}
- public void onReadCommitRecord(final long transactionID, final int numberOfRecords) throws Exception
- {
+ public void onReadCommitRecord(final long transactionID, final int numberOfRecords) throws Exception {
}
- public void onReadDeleteRecord(final long recordID) throws Exception
- {
+ public void onReadDeleteRecord(final long recordID) throws Exception {
}
- public void onReadDeleteRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception
- {
+ public void onReadDeleteRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception {
}
- public void onReadPrepareRecord(final long transactionID, final byte[] extraData, final int numberOfRecords) throws Exception
- {
+ public void onReadPrepareRecord(final long transactionID,
+ final byte[] extraData,
+ final int numberOfRecords) throws Exception {
}
- public void onReadRollbackRecord(final long transactionID) throws Exception
- {
+ public void onReadRollbackRecord(final long transactionID) throws Exception {
}
- public void onReadUpdateRecord(final RecordInfo recordInfo) throws Exception
- {
+ public void onReadUpdateRecord(final RecordInfo recordInfo) throws Exception {
}
- public void onReadUpdateRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception
- {
+ public void onReadUpdateRecordTX(final long transactionID, final RecordInfo recordInfo) throws Exception {
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java
index 9875cdd..a7d4169 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java
@@ -26,17 +26,16 @@ import org.apache.activemq.artemis.api.core.Pair;
* Note: This class used to be called PosFiles
*
* Used on the ref-count for reclaiming
- * */
-public class JournalRecord
-{
+ */
+public class JournalRecord {
+
private final JournalFile addFile;
private final int size;
private List<Pair<JournalFile, Integer>> updateFiles;
- public JournalRecord(final JournalFile addFile, final int size)
- {
+ public JournalRecord(final JournalFile addFile, final int size) {
this.addFile = addFile;
this.size = size;
@@ -46,10 +45,8 @@ public class JournalRecord
addFile.addSize(size);
}
- void addUpdateFile(final JournalFile updateFile, final int size)
- {
- if (updateFiles == null)
- {
+ void addUpdateFile(final JournalFile updateFile, final int size) {
+ if (updateFiles == null) {
updateFiles = new ArrayList<Pair<JournalFile, Integer>>();
}
@@ -60,15 +57,12 @@ public class JournalRecord
updateFile.addSize(size);
}
- void delete(final JournalFile file)
- {
+ void delete(final JournalFile file) {
file.incNegCount(addFile);
addFile.decSize(size);
- if (updateFiles != null)
- {
- for (Pair<JournalFile, Integer> updFile : updateFiles)
- {
+ if (updateFiles != null) {
+ for (Pair<JournalFile, Integer> updFile : updateFiles) {
file.incNegCount(updFile.getA());
updFile.getA().decSize(updFile.getB());
}
@@ -76,16 +70,13 @@ public class JournalRecord
}
@Override
- public String toString()
- {
+ public String toString() {
StringBuilder buffer = new StringBuilder();
buffer.append("JournalRecord(add=" + addFile.getFile().getFileName());
- if (updateFiles != null)
- {
+ if (updateFiles != null) {
- for (Pair<JournalFile, Integer> update : updateFiles)
- {
+ for (Pair<JournalFile, Integer> update : updateFiles) {
buffer.append(", update=" + update.getA().getFile().getFileName());
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
index fe10243..6c5107a 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecordProvider.java
@@ -25,8 +25,8 @@ import java.util.Map;
*
* when a commit is read, the JournalTransaction will inquire the JournalCompactor about the existent records
*/
-public interface JournalRecordProvider
-{
+public interface JournalRecordProvider {
+
JournalCompactor getCompactor();
Map<Long, JournalRecord> getRecords();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
index 51793fb..930fb34 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
@@ -27,8 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
-public class JournalTransaction
-{
+public class JournalTransaction {
private JournalRecordProvider journal;
@@ -52,55 +51,45 @@ public class JournalTransaction
private final AtomicInteger counter = new AtomicInteger();
- public JournalTransaction(final long id, final JournalRecordProvider journal)
- {
+ public JournalTransaction(final long id, final JournalRecordProvider journal) {
this.id = id;
this.journal = journal;
}
- public void replaceRecordProvider(final JournalRecordProvider provider)
- {
+ public void replaceRecordProvider(final JournalRecordProvider provider) {
journal = provider;
}
/**
* @return the id
*/
- public long getId()
- {
+ public long getId() {
return id;
}
- public int getCounter(final JournalFile file)
- {
+ public int getCounter(final JournalFile file) {
return internalgetCounter(file).intValue();
}
- public void incCounter(final JournalFile file)
- {
+ public void incCounter(final JournalFile file) {
internalgetCounter(file).incrementAndGet();
}
- public long[] getPositiveArray()
- {
- if (pos == null)
- {
+ public long[] getPositiveArray() {
+ if (pos == null) {
return new long[0];
}
- else
- {
+ else {
int i = 0;
long[] ids = new long[pos.size()];
- for (JournalUpdate el : pos)
- {
+ for (JournalUpdate el : pos) {
ids[i++] = el.getId();
}
return ids;
}
}
- public void setCompacting()
- {
+ public void setCompacting() {
compacting = true;
// Everything is cleared on the transaction...
@@ -108,33 +97,28 @@ public class JournalTransaction
clear();
}
- /** This is used to merge transactions from compacting */
- public void merge(final JournalTransaction other)
- {
- if (other.pos != null)
- {
- if (pos == null)
- {
+ /**
+ * This is used to merge transactions from compacting
+ */
+ public void merge(final JournalTransaction other) {
+ if (other.pos != null) {
+ if (pos == null) {
pos = new ArrayList<JournalUpdate>();
}
pos.addAll(other.pos);
}
- if (other.neg != null)
- {
- if (neg == null)
- {
+ if (other.neg != null) {
+ if (neg == null) {
neg = new ArrayList<JournalUpdate>();
}
neg.addAll(other.neg);
}
- if (other.pendingFiles != null)
- {
- if (pendingFiles == null)
- {
+ if (other.pendingFiles != null) {
+ if (pendingFiles == null) {
pendingFiles = new HashSet<JournalFile>();
}
@@ -147,29 +131,24 @@ public class JournalTransaction
/**
*
*/
- public void clear()
- {
+ public void clear() {
// / Compacting is recreating all the previous files and everything
// / so we just clear the list of previous files, previous pos and previous adds
// / The transaction may be working at the top from now
- if (pendingFiles != null)
- {
+ if (pendingFiles != null) {
pendingFiles.clear();
}
- if (callbackList != null)
- {
+ if (callbackList != null) {
callbackList.clear();
}
- if (pos != null)
- {
+ if (pos != null) {
pos.clear();
}
- if (neg != null)
- {
+ if (neg != null) {
neg.clear();
}
@@ -184,28 +163,23 @@ public class JournalTransaction
* @param currentFile
* @param data
*/
- public void fillNumberOfRecords(final JournalFile currentFile, final JournalInternalRecord data)
- {
+ public void fillNumberOfRecords(final JournalFile currentFile, final JournalInternalRecord data) {
data.setNumberOfRecords(getCounter(currentFile));
}
- public TransactionCallback getCallback(final JournalFile file) throws Exception
- {
- if (callbackList == null)
- {
+ public TransactionCallback getCallback(final JournalFile file) throws Exception {
+ if (callbackList == null) {
callbackList = new HashMap<JournalFile, TransactionCallback>();
}
currentCallback = callbackList.get(file);
- if (currentCallback == null)
- {
+ if (currentCallback == null) {
currentCallback = new TransactionCallback();
callbackList.put(file, currentCallback);
}
- if (currentCallback.getErrorMessage() != null)
- {
+ if (currentCallback.getErrorMessage() != null) {
throw ActiveMQExceptionType.createException(currentCallback.getErrorCode(), currentCallback.getErrorMessage());
}
@@ -214,28 +188,24 @@ public class JournalTransaction
return currentCallback;
}
- public void addPositive(final JournalFile file, final long id, final int size)
- {
+ public void addPositive(final JournalFile file, final long id, final int size) {
incCounter(file);
addFile(file);
- if (pos == null)
- {
+ if (pos == null) {
pos = new ArrayList<JournalUpdate>();
}
pos.add(new JournalUpdate(file, id, size));
}
- public void addNegative(final JournalFile file, final long id)
- {
+ public void addNegative(final JournalFile file, final long id) {
incCounter(file);
addFile(file);
- if (neg == null)
- {
+ if (neg == null) {
neg = new ArrayList<JournalUpdate>();
}
@@ -244,58 +214,45 @@ public class JournalTransaction
/**
* The caller of this method needs to guarantee appendLock.lock at the journal. (unless this is being called from load what is a single thread process).
- * */
- public void commit(final JournalFile file)
- {
+ */
+ public void commit(final JournalFile file) {
JournalCompactor compactor = journal.getCompactor();
- if (compacting)
- {
+ if (compacting) {
compactor.addCommandCommit(this, file);
}
- else
- {
+ else {
- if (pos != null)
- {
- for (JournalUpdate trUpdate : pos)
- {
+ if (pos != null) {
+ for (JournalUpdate trUpdate : pos) {
JournalRecord posFiles = journal.getRecords().get(trUpdate.id);
- if (compactor != null && compactor.lookupRecord(trUpdate.id))
- {
+ if (compactor != null && compactor.lookupRecord(trUpdate.id)) {
// This is a case where the transaction was opened after compacting was started,
// but the commit arrived while compacting was working
// We need to cache the counter update, so compacting will take the correct files when it is done
compactor.addCommandUpdate(trUpdate.id, trUpdate.file, trUpdate.size);
}
- else if (posFiles == null)
- {
+ else if (posFiles == null) {
posFiles = new JournalRecord(trUpdate.file, trUpdate.size);
journal.getRecords().put(trUpdate.id, posFiles);
}
- else
- {
+ else {
posFiles.addUpdateFile(trUpdate.file, trUpdate.size);
}
}
}
- if (neg != null)
- {
- for (JournalUpdate trDelete : neg)
- {
- if (compactor != null)
- {
+ if (neg != null) {
+ for (JournalUpdate trDelete : neg) {
+ if (compactor != null) {
compactor.addCommandDelete(trDelete.id, trDelete.file);
}
- else
- {
+ else {
JournalRecord posFiles = journal.getRecords().remove(trDelete.id);
- if (posFiles != null)
- {
+ if (posFiles != null) {
posFiles.delete(trDelete.file);
}
}
@@ -305,29 +262,25 @@ public class JournalTransaction
// Now add negs for the pos we added in each file in which there were
// transactional operations
- for (JournalFile jf : pendingFiles)
- {
+ for (JournalFile jf : pendingFiles) {
file.incNegCount(jf);
}
}
}
- public void waitCallbacks() throws InterruptedException
- {
- if (callbackList != null)
- {
- for (TransactionCallback callback : callbackList.values())
- {
+ public void waitCallbacks() throws InterruptedException {
+ if (callbackList != null) {
+ for (TransactionCallback callback : callbackList.values()) {
callback.waitCompletion();
}
}
}
- /** Wait completion at the latest file only */
- public void waitCompletion() throws Exception
- {
- if (currentCallback != null)
- {
+ /**
+ * Wait completion at the latest file only
+ */
+ public void waitCompletion() throws Exception {
+ if (currentCallback != null) {
currentCallback.waitCompletion();
}
}
@@ -335,17 +288,14 @@ public class JournalTransaction
/**
* The caller of this method needs to guarantee appendLock.lock before calling this method if being used outside of the lock context.
* or else potFilesMap could be affected
- * */
- public void rollback(final JournalFile file)
- {
+ */
+ public void rollback(final JournalFile file) {
JournalCompactor compactor = journal.getCompactor();
- if (compacting && compactor != null)
- {
+ if (compacting && compactor != null) {
compactor.addCommandRollback(this, file);
}
- else
- {
+ else {
// Now add negs for the pos we added in each file in which there were
// transactional operations
// Note that we do this on rollback as we do on commit, since we need
@@ -356,8 +306,7 @@ public class JournalTransaction
// just left with a prepare when the tx
// has actually been rolled back
- for (JournalFile jf : pendingFiles)
- {
+ for (JournalFile jf : pendingFiles) {
file.incNegCount(jf);
}
}
@@ -366,34 +315,31 @@ public class JournalTransaction
/**
* The caller of this method needs to guarantee appendLock.lock before calling this method if being used outside of the lock context.
* or else potFilesMap could be affected
- * */
- public void prepare(final JournalFile file)
- {
+ */
+ public void prepare(final JournalFile file) {
// We don't want the prepare record getting deleted before time
addFile(file);
}
- /** Used by load, when the transaction was not loaded correctly */
- public void forget()
- {
+ /**
+ * Used by load, when the transaction was not loaded correctly
+ */
+ public void forget() {
// The transaction was not committed or rolled back in the file, so we
// reverse any pos counts we added
- for (JournalFile jf : pendingFiles)
- {
+ for (JournalFile jf : pendingFiles) {
jf.decPosCount();
}
}
@Override
- public String toString()
- {
+ public String toString() {
return "JournalTransaction(" + id + ")";
}
- private AtomicInteger internalgetCounter(final JournalFile file)
- {
+ private AtomicInteger internalgetCounter(final JournalFile file) {
if (lastFile != file)
{
@@ -403,15 +349,12 @@ public class JournalTransaction
return counter;
}
- private void addFile(final JournalFile file)
- {
- if (pendingFiles == null)
- {
+ private void addFile(final JournalFile file) {
+ if (pendingFiles == null) {
pendingFiles = new HashSet<JournalFile>();
}
- if (!pendingFiles.contains(file))
- {
+ if (!pendingFiles.contains(file)) {
pendingFiles.add(file);
// We add a pos for the transaction itself in the file - this
@@ -421,8 +364,8 @@ public class JournalTransaction
}
}
- private static class JournalUpdate
- {
+ private static class JournalUpdate {
+
private final JournalFile file;
long id;
@@ -434,8 +377,7 @@ public class JournalTransaction
* @param id
* @param size
*/
- private JournalUpdate(final JournalFile file, final long id, final int size)
- {
+ private JournalUpdate(final JournalFile file, final long id, final int size) {
super();
this.file = file;
this.id = id;
@@ -445,8 +387,7 @@ public class JournalTransaction
/**
* @return the id
*/
- public long getId()
- {
+ public long getId() {
return id;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
index 2a3e268..0f55962 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/Reclaimer.java
@@ -16,11 +16,9 @@
*/
package org.apache.activemq.artemis.core.journal.impl;
-
import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
/**
- *
* <p>The journal consists of an ordered list of journal files Fn where {@code 0 <= n <= N}</p>
*
* <p>A journal file can contain either positives (pos) or negatives (neg)</p>
@@ -34,19 +32,16 @@ import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
* <p>2) All pos that correspond to any neg in file Fn, must all live in any file Fm where {@code 0 <= m <= n}
* which are also marked for deletion in the same pass of the algorithm.</p>
*/
-public class Reclaimer
-{
+public class Reclaimer {
+
private static boolean trace = ActiveMQJournalLogger.LOGGER.isTraceEnabled();
- private static void trace(final String message)
- {
+ private static void trace(final String message) {
ActiveMQJournalLogger.LOGGER.trace(message);
}
- public void scan(final JournalFile[] files)
- {
- for (int i = 0; i < files.length; i++)
- {
+ public void scan(final JournalFile[] files) {
+ for (int i = 0; i < files.length; i++) {
// First we evaluate criterion 1)
JournalFile currentFile = files[i];
@@ -55,22 +50,18 @@ public class Reclaimer
int totNeg = 0;
- if (Reclaimer.trace)
- {
+ if (Reclaimer.trace) {
Reclaimer.trace("posCount on " + currentFile + " = " + posCount);
}
- for (int j = i; j < files.length; j++)
- {
- if (Reclaimer.trace)
- {
- if (files[j].getNegCount(currentFile) != 0)
- {
+ for (int j = i; j < files.length; j++) {
+ if (Reclaimer.trace) {
+ if (files[j].getNegCount(currentFile) != 0) {
Reclaimer.trace("Negative from " + files[j] +
- " into " +
- currentFile +
- " = " +
- files[j].getNegCount(currentFile));
+ " into " +
+ currentFile +
+ " = " +
+ files[j].getNegCount(currentFile));
}
}
@@ -79,26 +70,20 @@ public class Reclaimer
currentFile.setCanReclaim(true);
- if (posCount <= totNeg)
- {
+ if (posCount <= totNeg) {
// Now we evaluate criterion 2)
- for (int j = 0; j <= i; j++)
- {
+ for (int j = 0; j <= i; j++) {
JournalFile file = files[j];
int negCount = currentFile.getNegCount(file);
- if (negCount != 0)
- {
- if (file.isCanReclaim())
- {
+ if (negCount != 0) {
+ if (file.isCanReclaim()) {
// Ok
}
- else
- {
- if (Reclaimer.trace)
- {
+ else {
+ if (Reclaimer.trace) {
Reclaimer.trace(currentFile + " Can't be reclaimed because " + file + " has negative values");
}
@@ -109,8 +94,7 @@ public class Reclaimer
}
}
}
- else
- {
+ else {
currentFile.setCanReclaim(false);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SimpleWaitIOCallback.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SimpleWaitIOCallback.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SimpleWaitIOCallback.java
index 174772f..0efdf8a 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SimpleWaitIOCallback.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SimpleWaitIOCallback.java
@@ -23,8 +23,8 @@ import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
-public final class SimpleWaitIOCallback extends SyncIOCompletion
-{
+public final class SimpleWaitIOCallback extends SyncIOCompletion {
+
private final CountDownLatch latch = new CountDownLatch(1);
private volatile String errorMessage;
@@ -32,18 +32,15 @@ public final class SimpleWaitIOCallback extends SyncIOCompletion
private volatile int errorCode = 0;
@Override
- public String toString()
- {
+ public String toString() {
return SimpleWaitIOCallback.class.getName();
}
- public void done()
- {
+ public void done() {
latch.countDown();
}
- public void onError(final int errorCode1, final String errorMessage1)
- {
+ public void onError(final int errorCode1, final String errorMessage1) {
this.errorCode = errorCode1;
this.errorMessage = errorMessage1;
@@ -54,28 +51,23 @@ public final class SimpleWaitIOCallback extends SyncIOCompletion
}
@Override
- public void waitCompletion() throws InterruptedException, ActiveMQException
- {
- while (true)
- {
+ public void waitCompletion() throws InterruptedException, ActiveMQException {
+ while (true) {
if (latch.await(2, TimeUnit.SECONDS))
break;
}
- if (errorMessage != null)
- {
+ if (errorMessage != null) {
throw ActiveMQExceptionType.createException(errorCode, errorMessage);
}
return;
}
- public boolean waitCompletion(final long timeout) throws InterruptedException, ActiveMQException
- {
+ public boolean waitCompletion(final long timeout) throws InterruptedException, ActiveMQException {
boolean retValue = latch.await(timeout, TimeUnit.MILLISECONDS);
- if (errorMessage != null)
- {
+ if (errorMessage != null) {
throw ActiveMQExceptionType.createException(errorCode, errorMessage);
}
@@ -83,7 +75,6 @@ public final class SimpleWaitIOCallback extends SyncIOCompletion
}
@Override
- public void storeLineUp()
- {
+ public void storeLineUp() {
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SyncIOCompletion.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SyncIOCompletion.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SyncIOCompletion.java
index ae2af61..d34c030 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SyncIOCompletion.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/SyncIOCompletion.java
@@ -21,8 +21,7 @@ import org.apache.activemq.artemis.core.journal.IOCompletion;
/**
* Internal class used to manage explicit syncs on the Journal through callbacks.
*/
-public abstract class SyncIOCompletion implements IOCompletion
-{
+public abstract class SyncIOCompletion implements IOCompletion {
// Constants -----------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/TransactionCallback.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/TransactionCallback.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/TransactionCallback.java
index 140927e..3084dd5 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/TransactionCallback.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/TransactionCallback.java
@@ -21,8 +21,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.core.io.IOCallback;
import org.apache.activemq.artemis.utils.ReusableLatch;
-public class TransactionCallback implements IOCallback
-{
+public class TransactionCallback implements IOCallback {
+
private final ReusableLatch countLatch = new ReusableLatch();
private volatile String errorMessage = null;
@@ -35,17 +35,14 @@ public class TransactionCallback implements IOCallback
private volatile IOCallback delegateCompletion;
- public void countUp()
- {
+ public void countUp() {
up.incrementAndGet();
countLatch.countUp();
}
- public void done()
- {
+ public void done() {
countLatch.countDown();
- if (++done == up.get() && delegateCompletion != null)
- {
+ if (++done == up.get() && delegateCompletion != null) {
final IOCallback delegateToCall = delegateCompletion;
// We need to set the delegateCompletion to null first or blocking commits could miss a callback
// What would affect mainly tests
@@ -54,26 +51,22 @@ public class TransactionCallback implements IOCallback
}
}
- public void waitCompletion() throws InterruptedException
- {
+ public void waitCompletion() throws InterruptedException {
countLatch.await();
- if (errorMessage != null)
- {
+ if (errorMessage != null) {
throw new IllegalStateException("Error on Transaction: " + errorCode + " - " + errorMessage);
}
}
- public void onError(final int errorCode, final String errorMessage)
- {
+ public void onError(final int errorCode, final String errorMessage) {
this.errorMessage = errorMessage;
this.errorCode = errorCode;
countLatch.countDown();
- if (delegateCompletion != null)
- {
+ if (delegateCompletion != null) {
delegateCompletion.onError(errorCode, errorMessage);
}
}
@@ -81,32 +74,28 @@ public class TransactionCallback implements IOCallback
/**
* @return the delegateCompletion
*/
- public IOCallback getDelegateCompletion()
- {
+ public IOCallback getDelegateCompletion() {
return delegateCompletion;
}
/**
* @param delegateCompletion the delegateCompletion to set
*/
- public void setDelegateCompletion(final IOCallback delegateCompletion)
- {
+ public void setDelegateCompletion(final IOCallback delegateCompletion) {
this.delegateCompletion = delegateCompletion;
}
/**
* @return the errorMessage
*/
- public String getErrorMessage()
- {
+ public String getErrorMessage() {
return errorMessage;
}
/**
* @return the errorCode
*/
- public int getErrorCode()
- {
+ public int getErrorCode() {
return errorCode;
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/ByteArrayEncoding.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/ByteArrayEncoding.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/ByteArrayEncoding.java
index 3be9942..be04bc8 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/ByteArrayEncoding.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/ByteArrayEncoding.java
@@ -19,30 +19,25 @@ package org.apache.activemq.artemis.core.journal.impl.dataformat;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
-public class ByteArrayEncoding implements EncodingSupport
-{
+public class ByteArrayEncoding implements EncodingSupport {
final byte[] data;
- public ByteArrayEncoding(final byte[] data)
- {
+ public ByteArrayEncoding(final byte[] data) {
this.data = data;
}
// Public --------------------------------------------------------
- public void decode(final ActiveMQBuffer buffer)
- {
+ public void decode(final ActiveMQBuffer buffer) {
throw new IllegalStateException("operation not supported");
}
- public void encode(final ActiveMQBuffer buffer)
- {
+ public void encode(final ActiveMQBuffer buffer) {
buffer.writeBytes(data);
}
- public int getEncodeSize()
- {
+ public int getEncodeSize() {
return data.length;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecord.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecord.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecord.java
index 87d7e27..69734bc 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecord.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecord.java
@@ -20,8 +20,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
-public class JournalAddRecord extends JournalInternalRecord
-{
+public class JournalAddRecord extends JournalInternalRecord {
private final long id;
@@ -36,8 +35,7 @@ public class JournalAddRecord extends JournalInternalRecord
* @param recordType
* @param record
*/
- public JournalAddRecord(final boolean add, final long id, final byte recordType, final EncodingSupport record)
- {
+ public JournalAddRecord(final boolean add, final long id, final byte recordType, final EncodingSupport record) {
this.id = id;
this.record = record;
@@ -48,14 +46,11 @@ public class JournalAddRecord extends JournalInternalRecord
}
@Override
- public void encode(final ActiveMQBuffer buffer)
- {
- if (add)
- {
+ public void encode(final ActiveMQBuffer buffer) {
+ if (add) {
buffer.writeByte(JournalImpl.ADD_RECORD);
}
- else
- {
+ else {
buffer.writeByte(JournalImpl.UPDATE_RECORD);
}
@@ -75,8 +70,7 @@ public class JournalAddRecord extends JournalInternalRecord
}
@Override
- public int getEncodeSize()
- {
+ public int getEncodeSize() {
return JournalImpl.SIZE_ADD_RECORD + record.getEncodeSize() + 1;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecordTX.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecordTX.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecordTX.java
index ff22393..2af8797 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecordTX.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalAddRecordTX.java
@@ -20,8 +20,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
-public class JournalAddRecordTX extends JournalInternalRecord
-{
+public class JournalAddRecordTX extends JournalInternalRecord {
private final long txID;
@@ -42,8 +41,7 @@ public class JournalAddRecordTX extends JournalInternalRecord
final long txID,
final long id,
final byte recordType,
- final EncodingSupport record)
- {
+ final EncodingSupport record) {
this.txID = txID;
@@ -57,14 +55,11 @@ public class JournalAddRecordTX extends JournalInternalRecord
}
@Override
- public void encode(final ActiveMQBuffer buffer)
- {
- if (add)
- {
+ public void encode(final ActiveMQBuffer buffer) {
+ if (add) {
buffer.writeByte(JournalImpl.ADD_RECORD_TX);
}
- else
- {
+ else {
buffer.writeByte(JournalImpl.UPDATE_RECORD_TX);
}
@@ -86,8 +81,7 @@ public class JournalAddRecordTX extends JournalInternalRecord
}
@Override
- public int getEncodeSize()
- {
+ public int getEncodeSize() {
return JournalImpl.SIZE_ADD_RECORD_TX + record.getEncodeSize() + 1;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalCompleteRecordTX.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalCompleteRecordTX.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalCompleteRecordTX.java
index 17a3d7b..b0c2c49 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalCompleteRecordTX.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalCompleteRecordTX.java
@@ -34,12 +34,12 @@ import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
* <p>
* The commit operation itself is not included in this total.
*/
-public class JournalCompleteRecordTX extends JournalInternalRecord
-{
- public enum TX_RECORD_TYPE
- {
+public class JournalCompleteRecordTX extends JournalInternalRecord {
+
+ public enum TX_RECORD_TYPE {
COMMIT, PREPARE;
}
+
private final TX_RECORD_TYPE txRecordType;
private final long txID;
@@ -48,8 +48,9 @@ public class JournalCompleteRecordTX extends JournalInternalRecord
private int numberOfRecords;
- public JournalCompleteRecordTX(final TX_RECORD_TYPE isCommit, final long txID, final EncodingSupport transactionData)
- {
+ public JournalCompleteRecordTX(final TX_RECORD_TYPE isCommit,
+ final long txID,
+ final EncodingSupport transactionData) {
this.txRecordType = isCommit;
this.txID = txID;
@@ -58,14 +59,11 @@ public class JournalCompleteRecordTX extends JournalInternalRecord
}
@Override
- public void encode(final ActiveMQBuffer buffer)
- {
- if (txRecordType == TX_RECORD_TYPE.COMMIT)
- {
+ public void encode(final ActiveMQBuffer buffer) {
+ if (txRecordType == TX_RECORD_TYPE.COMMIT) {
buffer.writeByte(JournalImpl.COMMIT_RECORD);
}
- else
- {
+ else {
buffer.writeByte(JournalImpl.PREPARE_RECORD);
}
@@ -77,13 +75,11 @@ public class JournalCompleteRecordTX extends JournalInternalRecord
buffer.writeInt(numberOfRecords);
- if (transactionData != null)
- {
+ if (transactionData != null) {
buffer.writeInt(transactionData.getEncodeSize());
}
- if (transactionData != null)
- {
+ if (transactionData != null) {
transactionData.encode(buffer);
}
@@ -91,26 +87,21 @@ public class JournalCompleteRecordTX extends JournalInternalRecord
}
@Override
- public void setNumberOfRecords(final int records)
- {
+ public void setNumberOfRecords(final int records) {
numberOfRecords = records;
}
@Override
- public int getNumberOfRecords()
- {
+ public int getNumberOfRecords() {
return numberOfRecords;
}
@Override
- public int getEncodeSize()
- {
- if (txRecordType == TX_RECORD_TYPE.COMMIT)
- {
+ public int getEncodeSize() {
+ if (txRecordType == TX_RECORD_TYPE.COMMIT) {
return JournalImpl.SIZE_COMPLETE_TRANSACTION_RECORD + 1;
}
- else
- {
+ else {
return JournalImpl.SIZE_PREPARE_RECORD + (transactionData != null ? transactionData.getEncodeSize() : 0) + 1;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecord.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecord.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecord.java
index 00037ea..06444eb 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecord.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecord.java
@@ -19,21 +19,18 @@ package org.apache.activemq.artemis.core.journal.impl.dataformat;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
-public class JournalDeleteRecord extends JournalInternalRecord
-{
+public class JournalDeleteRecord extends JournalInternalRecord {
private final long id;
/**
* @param id
*/
- public JournalDeleteRecord(final long id)
- {
+ public JournalDeleteRecord(final long id) {
this.id = id;
}
- public void encode(final ActiveMQBuffer buffer)
- {
+ public void encode(final ActiveMQBuffer buffer) {
buffer.writeByte(JournalImpl.DELETE_RECORD);
buffer.writeInt(fileID);
@@ -46,8 +43,7 @@ public class JournalDeleteRecord extends JournalInternalRecord
}
@Override
- public int getEncodeSize()
- {
+ public int getEncodeSize() {
return JournalImpl.SIZE_DELETE_RECORD + 1;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecordTX.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecordTX.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecordTX.java
index 939d04d..32dfc36 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecordTX.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalDeleteRecordTX.java
@@ -20,8 +20,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
-public class JournalDeleteRecordTX extends JournalInternalRecord
-{
+public class JournalDeleteRecordTX extends JournalInternalRecord {
private final long txID;
@@ -34,8 +33,7 @@ public class JournalDeleteRecordTX extends JournalInternalRecord
* @param id
* @param record
*/
- public JournalDeleteRecordTX(final long txID, final long id, final EncodingSupport record)
- {
+ public JournalDeleteRecordTX(final long txID, final long id, final EncodingSupport record) {
this.id = id;
this.txID = txID;
@@ -44,8 +42,7 @@ public class JournalDeleteRecordTX extends JournalInternalRecord
}
@Override
- public void encode(final ActiveMQBuffer buffer)
- {
+ public void encode(final ActiveMQBuffer buffer) {
buffer.writeByte(JournalImpl.DELETE_RECORD_TX);
buffer.writeInt(fileID);
@@ -58,8 +55,7 @@ public class JournalDeleteRecordTX extends JournalInternalRecord
buffer.writeInt(record != null ? record.getEncodeSize() : 0);
- if (record != null)
- {
+ if (record != null) {
record.encode(buffer);
}
@@ -67,8 +63,7 @@ public class JournalDeleteRecordTX extends JournalInternalRecord
}
@Override
- public int getEncodeSize()
- {
+ public int getEncodeSize() {
return JournalImpl.SIZE_DELETE_RECORD_TX + (record != null ? record.getEncodeSize() : 0) + 1;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalInternalRecord.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalInternalRecord.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalInternalRecord.java
index 4449045..b05f161 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalInternalRecord.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalInternalRecord.java
@@ -19,50 +19,40 @@ package org.apache.activemq.artemis.core.journal.impl.dataformat;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.EncodingSupport;
-public abstract class JournalInternalRecord implements EncodingSupport
-{
+public abstract class JournalInternalRecord implements EncodingSupport {
protected int fileID;
protected byte compactCount;
- public int getFileID()
- {
+ public int getFileID() {
return fileID;
}
- public void setFileID(final int fileID)
- {
+ public void setFileID(final int fileID) {
this.fileID = fileID;
}
- public void decode(final ActiveMQBuffer buffer)
- {
+ public void decode(final ActiveMQBuffer buffer) {
}
- public void setNumberOfRecords(final int records)
- {
+ public void setNumberOfRecords(final int records) {
}
- public int getNumberOfRecords()
- {
+ public int getNumberOfRecords() {
return 0;
}
- public short getCompactCount()
- {
+ public short getCompactCount() {
return compactCount;
}
- public void setCompactCount(final short compactCount)
- {
- if (compactCount > Byte.MAX_VALUE)
- {
+ public void setCompactCount(final short compactCount) {
+ if (compactCount > Byte.MAX_VALUE) {
this.compactCount = Byte.MAX_VALUE;
}
- else
- {
- this.compactCount = (byte)compactCount;
+ else {
+ this.compactCount = (byte) compactCount;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalRollbackRecordTX.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalRollbackRecordTX.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalRollbackRecordTX.java
index 3c9ab8a..fe43913 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalRollbackRecordTX.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/dataformat/JournalRollbackRecordTX.java
@@ -19,18 +19,16 @@ package org.apache.activemq.artemis.core.journal.impl.dataformat;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
-public class JournalRollbackRecordTX extends JournalInternalRecord
-{
+public class JournalRollbackRecordTX extends JournalInternalRecord {
+
private final long txID;
- public JournalRollbackRecordTX(final long txID)
- {
+ public JournalRollbackRecordTX(final long txID) {
this.txID = txID;
}
@Override
- public void encode(final ActiveMQBuffer buffer)
- {
+ public void encode(final ActiveMQBuffer buffer) {
buffer.writeByte(JournalImpl.ROLLBACK_RECORD);
buffer.writeInt(fileID);
buffer.writeByte(compactCount);
@@ -40,8 +38,7 @@ public class JournalRollbackRecordTX extends JournalInternalRecord
}
@Override
- public int getEncodeSize()
- {
+ public int getEncodeSize() {
return JournalImpl.SIZE_ROLLBACK_RECORD + 1;
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
index 91a4f04..474bf18 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalBundle.java
@@ -16,7 +16,6 @@
*/
package org.apache.activemq.artemis.journal;
-
import org.apache.activemq.artemis.api.core.ActiveMQIOErrorException;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;
@@ -30,19 +29,19 @@ import org.jboss.logging.Messages;
* so 149000 to 149999
*/
@MessageBundle(projectCode = "AMQ")
-public interface ActiveMQJournalBundle
-{
+public interface ActiveMQJournalBundle {
+
ActiveMQJournalBundle BUNDLE = Messages.getBundle(ActiveMQJournalBundle.class);
- @Message(id = 149000, value = "failed to rename file {0} to {1}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 149000, value = "failed to rename file {0} to {1}", format = Message.Format.MESSAGE_FORMAT)
ActiveMQIOErrorException ioRenameFileError(String name, String newFileName);
- @Message(id = 149001, value = "Journal data belong to a different version")
+ @Message(id = 149001, value = "Journal data belong to a different version")
ActiveMQIOErrorException journalDifferentVersion();
- @Message(id = 149002, value = "Journal files version mismatch. You should export the data from the previous version and import it as explained on the user''s manual")
+ @Message(id = 149002, value = "Journal files version mismatch. You should export the data from the previous version and import it as explained on the user''s manual")
ActiveMQIOErrorException journalFileMisMatch();
- @Message(id = 149003, value = "File not opened")
+ @Message(id = 149003, value = "File not opened")
ActiveMQIOErrorException fileNotOpened();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
index 4d2429d..198185c 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/journal/ActiveMQJournalLogger.java
@@ -39,8 +39,8 @@ import org.jboss.logging.annotations.MessageLogger;
* so an INFO message would be 141000 to 141999
*/
@MessageLogger(projectCode = "AMQ")
-public interface ActiveMQJournalLogger extends BasicLogger
-{
+public interface ActiveMQJournalLogger extends BasicLogger {
+
/**
* The journal logger.
*/
@@ -72,9 +72,9 @@ public interface ActiveMQJournalLogger extends BasicLogger
@LogMessage(level = Logger.Level.INFO)
@Message(id = 141007, value = "Current File on the journal is <= the sequence file.getFileID={0} on the dataFiles" +
- "\nCurrentfile.getFileId={1} while the file.getFileID()={2}" +
- "\nIs same = ({3})",
- format = Message.Format.MESSAGE_FORMAT)
+ "\nCurrentfile.getFileId={1} while the file.getFileID()={2}" +
+ "\nIs same = ({3})",
+ format = Message.Format.MESSAGE_FORMAT)
void currentFile(Long fileID, Long id, Long fileFileID, Boolean b);
@LogMessage(level = Logger.Level.INFO)
@@ -91,7 +91,7 @@ public interface ActiveMQJournalLogger extends BasicLogger
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142001, value = "Could not get lock after 60 seconds on closing Asynchronous File: {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void couldNotGetLock(String fileName);
@LogMessage(level = Logger.Level.WARN)
@@ -104,121 +104,121 @@ public interface ActiveMQJournalLogger extends BasicLogger
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142004, value = "Inconsistency during compacting: CommitRecord ID = {0} for an already committed transaction during compacting",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void inconsistencyDuringCompacting(Long transactionID);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142005, value = "Inconsistency during compacting: Delete record being read on an existent record (id={0})",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void inconsistencyDuringCompactingDelete(Long recordID);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142006, value = "Could not find add Record information for record {0} during compacting",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void compactingWithNoAddRecord(Long id);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142007, value = "Can not find record {0} during compact replay",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void noRecordDuringCompactReplay(Long id);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142008, value = "Could not remove file {0} from the list of data files",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void couldNotRemoveFile(JournalFile file);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142009, value = "Deleting {0} as it does not have the configured size",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void deletingFile(JournalFile file);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142010, value = "Failed to add file to opened files queue: {0}. This should NOT happen!",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void failedToAddFile(JournalFile nextOpenedFile);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142011, value = "Error on reading compacting for {0}",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void compactReadError(JournalFile file);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142012, value = "Couldn''t find tx={0} to merge after compacting",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void compactMergeError(Long id);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142013, value = "Prepared transaction {0} was not considered completed, it will be ignored",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void preparedTXIncomplete(Long id);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142014, value = "Transaction {0} is missing elements so the transaction is being ignored",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void txMissingElements(Long id);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142015, value = "Uncommitted transaction with id {0} found and discarded",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void uncomittedTxFound(Long id);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142016, value = "Couldn''t stop compactor executor after 120 seconds",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void couldNotStopCompactor();
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142017, value = "Couldn''t stop journal executor after 60 seconds",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void couldNotStopJournalExecutor();
@LogMessage(level = Logger.Level.WARN)
@Message(id = 142018, value = "Temporary files were left unnatended after a crash on journal directory, deleting invalid files now",
- format = Message.Format.MESSAGE_FORMAT)
+ format = Message.Format.MESSAGE_FORMAT)
void tempFilesLeftOpen();
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142019, value = "Deleting orphaned file {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142019, value = "Deleting orphaned file {0}", format = Message.Format.MESSAGE_FORMAT)
void deletingOrphanedFile(String fileToDelete);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142020, value = "Couldn''t get lock after 60 seconds on closing Asynchronous File: {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142020, value = "Couldn''t get lock after 60 seconds on closing Asynchronous File: {0}", format = Message.Format.MESSAGE_FORMAT)
void errorClosingFile(String fileToDelete);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142021, value = "Error on IO callback, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142021, value = "Error on IO callback, {0}", format = Message.Format.MESSAGE_FORMAT)
void errorOnIOCallback(String errorMessage);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142022, value = "Timed out on AIO poller shutdown", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142022, value = "Timed out on AIO poller shutdown", format = Message.Format.MESSAGE_FORMAT)
void timeoutOnPollerShutdown(@Cause Exception e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142023, value = "Executor on file {0} couldn''t complete its tasks in 60 seconds.", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142023, value = "Executor on file {0} couldn''t complete its tasks in 60 seconds.", format = Message.Format.MESSAGE_FORMAT)
void couldNotCompleteTask(@Cause Exception e, String name);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142024, value = "Error completing callback", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142024, value = "Error completing callback", format = Message.Format.MESSAGE_FORMAT)
void errorCompletingCallback(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142025, value = "Error calling onError callback", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142025, value = "Error calling onError callback", format = Message.Format.MESSAGE_FORMAT)
void errorCallingErrorCallback(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142026, value = "Timed out on AIO writer shutdown", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142026, value = "Timed out on AIO writer shutdown", format = Message.Format.MESSAGE_FORMAT)
void timeoutOnWriterShutdown(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142027, value = "Error on writing data! {0} code - {1}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142027, value = "Error on writing data! {0} code - {1}", format = Message.Format.MESSAGE_FORMAT)
void errorWritingData(@Cause Throwable e, String errorMessage, Integer errorCode);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142028, value = "Error replaying pending commands after compacting", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142028, value = "Error replaying pending commands after compacting", format = Message.Format.MESSAGE_FORMAT)
void errorReplayingCommands(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142029, value = "Error closing file", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142029, value = "Error closing file", format = Message.Format.MESSAGE_FORMAT)
void errorClosingFile(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
@@ -226,15 +226,15 @@ public interface ActiveMQJournalLogger extends BasicLogger
void errorOpeningFile(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142031, value = "Error retrieving ID part of the file name {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142031, value = "Error retrieving ID part of the file name {0}", format = Message.Format.MESSAGE_FORMAT)
void errorRetrievingID(@Cause Throwable e, String fileName);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142032, value = "Error reading journal file", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142032, value = "Error reading journal file", format = Message.Format.MESSAGE_FORMAT)
void errorReadingFile(@Cause Throwable e);
@LogMessage(level = Logger.Level.WARN)
- @Message(id = 142033, value = "Error reinitializing file {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 142033, value = "Error reinitializing file {0}", format = Message.Format.MESSAGE_FORMAT)
void errorReinitializingFile(@Cause Throwable e, JournalFile file);
@LogMessage(level = Logger.Level.WARN)
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/aio/CallbackOrderTest.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/aio/CallbackOrderTest.java b/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/aio/CallbackOrderTest.java
index 82d4502..926981c 100644
--- a/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/aio/CallbackOrderTest.java
+++ b/artemis-journal/src/test/java/org/apache/activemq/artemis/core/io/aio/CallbackOrderTest.java
@@ -27,40 +27,38 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-/** This will emulate callbacks out of order from libaio*/
-public class CallbackOrderTest
-{
+/**
+ * This will emulate callbacks out of order from libaio
+ */
+public class CallbackOrderTest {
@Rule
public TemporaryFolder temporaryFolder;
- public CallbackOrderTest()
- {
+ public CallbackOrderTest() {
File parent = new File("./target");
parent.mkdirs();
temporaryFolder = new TemporaryFolder(parent);
}
- /** This method will make sure callbacks will come back in order even when out order from libaio */
+ /**
+ * This method will make sure callbacks will come back in order even when out order from libaio
+ */
@Test
- public void testCallbackOutOfOrder() throws Exception
- {
+ public void testCallbackOutOfOrder() throws Exception {
AIOSequentialFileFactory factory = new AIOSequentialFileFactory(temporaryFolder.getRoot(), 100);
- AIOSequentialFile file = (AIOSequentialFile)factory.createSequentialFile("test.bin");
+ AIOSequentialFile file = (AIOSequentialFile) factory.createSequentialFile("test.bin");
final AtomicInteger count = new AtomicInteger(0);
- IOCallback callback = new IOCallback()
- {
+ IOCallback callback = new IOCallback() {
@Override
- public void done()
- {
+ public void done() {
count.incrementAndGet();
}
@Override
- public void onError(int errorCode, String errorMessage)
- {
+ public void onError(int errorCode, String errorMessage) {
}
};
@@ -69,20 +67,16 @@ public class CallbackOrderTest
// We will repeat the teset a few times, increasing N
// to increase possibility of issues due to reuse of callbacks
- for (int n = 1; n < 100; n++)
- {
+ for (int n = 1; n < 100; n++) {
System.out.println("n = " + n);
int N = n;
count.set(0);
list.clear();
- for (int i = 0; i < N; i++)
- {
+ for (int i = 0; i < N; i++) {
list.add(file.getCallback(callback, null));
}
-
- for (int i = N - 1; i >= 0; i--)
- {
+ for (int i = N - 1; i >= 0; i--) {
list.get(i).done();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
index 43cc075..f7647d3 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java
@@ -22,24 +22,21 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;
-public abstract class ArtemisAbstractPlugin extends AbstractMojo
-{
+public abstract class ArtemisAbstractPlugin extends AbstractMojo {
-
- /** It will ignore executioni if ignore has been set to true. This is useful as a property from the build. */
+ /**
+ * It will ignore executioni if ignore has been set to true. This is useful as a property from the build.
+ */
@Parameter(defaultValue = "")
private boolean ignore;
- public void execute() throws MojoExecutionException, MojoFailureException
- {
- if (ignore)
- {
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (ignore) {
getLog().debug("******************************************************************************************************");
getLog().debug("Execution of " + getClass().getSimpleName() + " is being ignored as ignore has been set to true");
getLog().debug("******************************************************************************************************");
}
- else
- {
+ else {
doExecute();
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
index 45aafcb..447a570 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCLIPlugin.java
@@ -33,8 +33,8 @@ import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
@Mojo(name = "cli", defaultPhase = LifecyclePhase.VERIFY)
-public class ArtemisCLIPlugin extends ArtemisAbstractPlugin
-{
+public class ArtemisCLIPlugin extends ArtemisAbstractPlugin {
+
private PluginDescriptor descriptor;
@Parameter(defaultValue = "server")
@@ -67,53 +67,42 @@ public class ArtemisCLIPlugin extends ArtemisAbstractPlugin
@Parameter
private String testPassword = null;
-
/**
* Validate if the directory is a artemis.home *
*
* @param path
* @return
*/
- private boolean lookupHome(Path path)
- {
+ private boolean lookupHome(Path path) {
- if (path == null)
- {
+ if (path == null) {
return false;
}
Path binFolder = path.resolve("bin");
- if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS))
- {
+ if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS)) {
return false;
}
Path artemisScript = binFolder.resolve("artemis");
-
return artemisScript != null && Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS);
-
}
@Override
- protected void doExecute() throws MojoExecutionException, MojoFailureException
- {
+ protected void doExecute() throws MojoExecutionException, MojoFailureException {
// This is to avoid the Run issuing a kill at any point
Run.setEmbedded(true);
MavenProject project = (MavenProject) getPluginContext().get("project");
-
- if (!lookupHome(home.toPath()))
- {
- if (lookupHome(alternateHome.toPath()))
- {
+ if (!lookupHome(home.toPath())) {
+ if (lookupHome(alternateHome.toPath())) {
home = alternateHome;
}
- else
- {
+ else {
getLog().error("********************************************************************************************");
getLog().error("Could not locate suitable Artemis.home on either " + home + " or " + alternateHome);
getLog().error("Use the binary distribution or build the distribution before running the examples");
@@ -123,38 +112,28 @@ public class ArtemisCLIPlugin extends ArtemisAbstractPlugin
}
}
- try
- {
- if (spawn)
- {
+ try {
+ if (spawn) {
final Process process = org.apache.activemq.artemis.cli.process.ProcessBuilder.build(name, location, true, args);
- Runtime.getRuntime().addShutdownHook(new Thread()
- {
- public void run()
- {
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ public void run() {
process.destroy();
}
});
- if (testURI != null)
- {
+ if (testURI != null) {
long timeout = System.currentTimeMillis() + spawnTimeout;
- while (System.currentTimeMillis() <= timeout)
- {
- try (ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(testURI))
- {
- if (testUser != null && testPassword != null)
- {
+ while (System.currentTimeMillis() <= timeout) {
+ try (ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(testURI)) {
+ if (testUser != null && testPassword != null) {
cf.createConnection(testUser, testPassword).close();
}
- else
- {
+ else {
cf.createConnection().close();
}
getLog().info("Server started");
}
- catch (Exception e)
- {
+ catch (Exception e) {
getLog().info("awaiting server to start");
Thread.sleep(500);
continue;
@@ -163,8 +142,7 @@ public class ArtemisCLIPlugin extends ArtemisAbstractPlugin
}
}
}
- else
- {
+ else {
Artemis.execute(home, location, args);
}
@@ -172,8 +150,7 @@ public class ArtemisCLIPlugin extends ArtemisAbstractPlugin
org.apache.activemq.artemis.cli.process.ProcessBuilder.cleanupProcess();
}
- catch (Exception e)
- {
+ catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisClientPlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisClientPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisClientPlugin.java
index 1716c03..be3a19b 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisClientPlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisClientPlugin.java
@@ -29,8 +29,7 @@ import org.apache.maven.plugins.annotations.Parameter;
* Allows a Java Client to be run which must hve a static main(String[] args) method
*/
@Mojo(name = "runClient", defaultPhase = LifecyclePhase.VERIFY)
-public class ArtemisClientPlugin extends ArtemisAbstractPlugin
-{
+public class ArtemisClientPlugin extends ArtemisAbstractPlugin {
@Parameter
String clientClass;
@@ -44,20 +43,16 @@ public class ArtemisClientPlugin extends ArtemisAbstractPlugin
private Properties systemProperties;
@Override
- protected void doExecute() throws MojoExecutionException, MojoFailureException
- {
- try
- {
- if (systemProperties != null && !systemProperties.isEmpty())
- {
+ protected void doExecute() throws MojoExecutionException, MojoFailureException {
+ try {
+ if (systemProperties != null && !systemProperties.isEmpty()) {
System.getProperties().putAll(systemProperties);
}
Class aClass = Class.forName(clientClass);
Method method = aClass.getDeclaredMethod("main", new Class[]{String[].class});
method.invoke(null, new Object[]{args});
}
- catch (Exception e)
- {
+ catch (Exception e) {
getLog().error(e);
throw new MojoFailureException(e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bac96047/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
----------------------------------------------------------------------
diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
index eb3462e..d4d1120 100644
--- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
+++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisCreatePlugin.java
@@ -58,7 +58,9 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
*/
private PluginDescriptor descriptor;
- /** Directory to replace the configuration with */
+ /**
+ * Directory to replace the configuration with
+ */
@Parameter(defaultValue = "${basedir}/target/classes/activemq/server0", required = true)
private File configuration;
@@ -110,7 +112,9 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
@Parameter(defaultValue = "false")
private boolean failoverOnShutdown;
- /** it will disable auto-tune*/
+ /**
+ * it will disable auto-tune
+ */
@Parameter(defaultValue = "true")
private boolean noAutoTune;
@@ -132,8 +136,6 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
@Parameter
ArrayList<String> args = new ArrayList<>();
-
-
@Parameter
private String[] libList;
@@ -146,56 +148,43 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
* @param path
* @return
*/
- private boolean lookupHome(Path path)
- {
+ private boolean lookupHome(Path path) {
- if (path == null)
- {
+ if (path == null) {
return false;
}
Path binFolder = path.resolve("bin");
- if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS))
- {
+ if (binFolder == null && Files.exists(binFolder, LinkOption.NOFOLLOW_LINKS)) {
return false;
}
Path artemisScript = binFolder.resolve("artemis");
-
return artemisScript != null && Files.exists(artemisScript, LinkOption.NOFOLLOW_LINKS);
-
}
- private void add(List<String> list, String ... str)
- {
- for (String s: str)
- {
+ private void add(List<String> list, String... str) {
+ for (String s : str) {
list.add(s);
}
}
@Override
- protected void doExecute() throws MojoExecutionException, MojoFailureException
- {
- if (System.getProperty("bypassAddress") != null)
- {
+ protected void doExecute() throws MojoExecutionException, MojoFailureException {
+ if (System.getProperty("bypassAddress") != null) {
System.out.println("BYPASSADDRESS");
}
getLog().info("Local " + localRepository);
MavenProject project = (MavenProject) getPluginContext().get("project");
-
- if (!lookupHome(home.toPath()))
- {
- if (lookupHome(alternateHome.toPath()))
- {
+ if (!lookupHome(home.toPath())) {
+ if (lookupHome(alternateHome.toPath())) {
home = alternateHome;
}
- else
- {
+ else {
getLog().error("********************************************************************************************");
getLog().error("Could not locate suitable Artemis.home on either " + home + " or " + alternateHome);
getLog().error("Use the binary distribution or build the distribution before running the examples");
@@ -205,73 +194,58 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
}
}
-
Map properties = getPluginContext();
Set<Map.Entry> entries = properties.entrySet();
getLog().info("Entries.size " + entries.size());
- for (Map.Entry entry : entries)
- {
+ for (Map.Entry entry : entries) {
getLog().info("... key=" + entry.getKey() + " = " + entry.getValue());
}
ArrayList<String> listCommands = new ArrayList<>();
- add(listCommands, "create", "--allow-anonymous", "--silent", "--force", "--no-web", "--user", user, "--password", password,
- "--role", role,
- "--port-offset", "" + portOffset,
- "--data", dataFolder);
+ add(listCommands, "create", "--allow-anonymous", "--silent", "--force", "--no-web", "--user", user, "--password", password, "--role", role, "--port-offset", "" + portOffset, "--data", dataFolder);
- if (allowAnonymous)
- {
+ if (allowAnonymous) {
add(listCommands, "--allow-anonymous");
}
- else
- {
+ else {
add(listCommands, "--require-login");
}
- if (!javaOptions.isEmpty())
- {
+ if (!javaOptions.isEmpty()) {
add(listCommands, "--java-options", javaOptions);
}
- if (slave)
- {
+ if (slave) {
add(listCommands, "--slave");
}
- if (replicated)
- {
+ if (replicated) {
add(listCommands, "--replicated");
}
- if (sharedStore)
- {
+ if (sharedStore) {
add(listCommands, "--shared-store");
}
- if (clustered)
- {
+ if (clustered) {
add(listCommands, "--clustered");
add(listCommands, "--message-load-balancing", messageLoadBalancing);
}
- if (failoverOnShutdown)
- {
+ if (failoverOnShutdown) {
add(listCommands, "--failover-on-shutdown");
}
- if (noAutoTune)
- {
+ if (noAutoTune) {
add(listCommands, "--no-autotune");
}
add(listCommands, "--verbose");
- for (String str : args)
- {
+ for (String str : args) {
add(listCommands, str);
}
@@ -279,62 +253,51 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
getLog().debug("***** Server created at " + instance + " with home=" + home + " *****");
- try
- {
+ try {
Artemis.execute(home, null, listCommands);
- if (configuration != null)
- {
+ if (configuration != null) {
String[] list = configuration.list();
- if (list != null)
- {
+ if (list != null) {
getLog().debug("************************************************");
getLog().debug("Replacing configuration files:");
- for (String file : configuration.list())
- {
+ for (String file : configuration.list()) {
Path target = instance.toPath().resolve("etc").resolve(file);
getLog().debug("Replacing " + file + " into " + target);
-
Files.copy(configuration.toPath().resolve(file), target, StandardCopyOption.REPLACE_EXISTING);
}
}
}
- if (libList != null)
- {
- for (int i = 0; i < libList.length; i++)
- {
+ if (libList != null) {
+ for (int i = 0; i < libList.length; i++) {
String[] splitString = libList[i].split(":");
getLog().debug("********************" + splitString[0] + "/" + splitString[1] + "/" + splitString[2]);
Artifact artifact;
- try
- {
- artifact = new DefaultArtifact( libList[i] );
+ try {
+ artifact = new DefaultArtifact(libList[i]);
}
- catch ( IllegalArgumentException e )
- {
- throw new MojoFailureException( e.getMessage(), e );
+ catch (IllegalArgumentException e) {
+ throw new MojoFailureException(e.getMessage(), e);
}
ArtifactRequest request = new ArtifactRequest();
- request.setArtifact( artifact );
- request.setRepositories( remoteRepos );
+ request.setArtifact(artifact);
+ request.setRepositories(remoteRepos);
getLog().debug("Resolving artifact " + artifact + " from " + remoteRepos);
ArtifactResult result;
- try
- {
- result = repositorySystem.resolveArtifact( repoSession, request );
+ try {
+ result = repositorySystem.resolveArtifact(repoSession, request);
}
- catch ( ArtifactResolutionException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
+ catch (ArtifactResolutionException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
}
File artifactFile = result.getArtifact().getFile();
@@ -347,15 +310,13 @@ public class ArtemisCreatePlugin extends ArtemisAbstractPlugin
}
}
- catch (Exception e)
- {
+ catch (Exception e) {
getLog().error(e);
throw new MojoFailureException(e.getMessage());
}
}
- private void copyToLib(File projectLib) throws IOException
- {
+ private void copyToLib(File projectLib) throws IOException {
Path target = instance.toPath().resolve("lib").resolve(projectLib.getName());
target.toFile().mkdirs();
getLog().debug("Copying " + projectLib.getName() + " as " + target.toFile().getAbsolutePath());