You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by vi...@apache.org on 2016/12/28 10:02:38 UTC
[31/50] [abbrv] incubator-rocketmq git commit: ROCKETMQ-18 Reformat
all codes.
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/UtilAll.java b/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
index 55d9b3f..54bcdef 100644
--- a/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
+++ b/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
@@ -16,8 +16,6 @@
*/
package org.apache.rocketmq.common;
-import org.apache.rocketmq.remoting.common.RemotingHelper;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -30,17 +28,21 @@ import java.net.NetworkInterface;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
import java.util.zip.CRC32;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
-
+import org.apache.rocketmq.remoting.common.RemotingHelper;
public class UtilAll {
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd#HH:mm:ss:SSS";
public static final String YYYY_MMDD_HHMMSS = "yyyyMMddHHmmss";
-
+ final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static int getPid() {
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
@@ -75,7 +77,6 @@ public class UtilAll {
return System.currentTimeMillis() - beginTime;
}
-
public static boolean isItTimeToDo(final String when) {
String[] whiles = when.split(";");
if (whiles != null && whiles.length > 0) {
@@ -91,21 +92,18 @@ public class UtilAll {
return false;
}
-
public static String timeMillisToHumanString() {
return timeMillisToHumanString(System.currentTimeMillis());
}
-
public static String timeMillisToHumanString(final long t) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(t);
return String.format("%04d%02d%02d%02d%02d%02d%03d", cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1,
- cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND),
- cal.get(Calendar.MILLISECOND));
+ cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND),
+ cal.get(Calendar.MILLISECOND));
}
-
public static long computNextMorningTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
@@ -118,7 +116,6 @@ public class UtilAll {
return cal.getTimeInMillis();
}
-
public static long computNextMinutesTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
@@ -131,7 +128,6 @@ public class UtilAll {
return cal.getTimeInMillis();
}
-
public static long computNextHourTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
@@ -144,7 +140,6 @@ public class UtilAll {
return cal.getTimeInMillis();
}
-
public static long computNextHalfHourTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
@@ -157,34 +152,31 @@ public class UtilAll {
return cal.getTimeInMillis();
}
-
public static String timeMillisToHumanString2(final long t) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(t);
return String.format("%04d-%02d-%02d %02d:%02d:%02d,%03d",
- cal.get(Calendar.YEAR),
- cal.get(Calendar.MONTH) + 1,
- cal.get(Calendar.DAY_OF_MONTH),
- cal.get(Calendar.HOUR_OF_DAY),
- cal.get(Calendar.MINUTE),
- cal.get(Calendar.SECOND),
- cal.get(Calendar.MILLISECOND));
+ cal.get(Calendar.YEAR),
+ cal.get(Calendar.MONTH) + 1,
+ cal.get(Calendar.DAY_OF_MONTH),
+ cal.get(Calendar.HOUR_OF_DAY),
+ cal.get(Calendar.MINUTE),
+ cal.get(Calendar.SECOND),
+ cal.get(Calendar.MILLISECOND));
}
-
public static String timeMillisToHumanString3(final long t) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(t);
return String.format("%04d%02d%02d%02d%02d%02d",
- cal.get(Calendar.YEAR),
- cal.get(Calendar.MONTH) + 1,
- cal.get(Calendar.DAY_OF_MONTH),
- cal.get(Calendar.HOUR_OF_DAY),
- cal.get(Calendar.MINUTE),
- cal.get(Calendar.SECOND));
+ cal.get(Calendar.YEAR),
+ cal.get(Calendar.MONTH) + 1,
+ cal.get(Calendar.DAY_OF_MONTH),
+ cal.get(Calendar.HOUR_OF_DAY),
+ cal.get(Calendar.MINUTE),
+ cal.get(Calendar.SECOND));
}
-
public static double getDiskPartitionSpaceUsedPercent(final String path) {
if (null == path || path.isEmpty())
return -1;
@@ -201,7 +193,7 @@ public class UtilAll {
long freeSpace = file.getFreeSpace();
long usedSpace = totalSpace - freeSpace;
if (totalSpace > 0) {
- return usedSpace / (double) totalSpace;
+ return usedSpace / (double)totalSpace;
}
} catch (Exception e) {
return -1;
@@ -210,7 +202,6 @@ public class UtilAll {
return -1;
}
-
public static final int crc32(byte[] array) {
if (array != null) {
return crc32(array, 0, array.length);
@@ -219,15 +210,12 @@ public class UtilAll {
return 0;
}
-
public static final int crc32(byte[] array, int offset, int length) {
CRC32 crc32 = new CRC32();
crc32.update(array, offset, length);
- return (int) (crc32.getValue() & 0x7FFFFFFF);
+ return (int)(crc32.getValue() & 0x7FFFFFFF);
}
- final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
-
public static String bytes2string(byte[] src) {
char[] hexChars = new char[src.length * 2];
for (int j = 0; j < src.length; j++) {
@@ -248,17 +236,15 @@ public class UtilAll {
byte[] d = new byte[length];
for (int i = 0; i < length; i++) {
int pos = i * 2;
- d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
+ d[i] = (byte)(charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
}
return d;
}
-
private static byte charToByte(char c) {
- return (byte) "0123456789ABCDEF".indexOf(c);
+ return (byte)"0123456789ABCDEF".indexOf(c);
}
-
public static byte[] uncompress(final byte[] src) throws IOException {
byte[] result = src;
byte[] uncompressData = new byte[src.length];
@@ -296,7 +282,6 @@ public class UtilAll {
return result;
}
-
public static byte[] compress(final byte[] src, final int level) throws IOException {
byte[] result = src;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(src.length);
@@ -322,7 +307,6 @@ public class UtilAll {
return result;
}
-
public static int asInt(String str, int defaultValue) {
try {
return Integer.parseInt(str);
@@ -331,7 +315,6 @@ public class UtilAll {
}
}
-
public static long asLong(String str, long defaultValue) {
try {
return Long.parseLong(str);
@@ -340,13 +323,11 @@ public class UtilAll {
}
}
-
public static String formatDate(Date date, String pattern) {
SimpleDateFormat df = new SimpleDateFormat(pattern);
return df.format(date);
}
-
public static Date parseDate(String date, String pattern) {
SimpleDateFormat df = new SimpleDateFormat(pattern);
try {
@@ -356,12 +337,10 @@ public class UtilAll {
}
}
-
public static String responseCode2String(final int code) {
return Integer.toString(code);
}
-
public static String frontStringAtLeast(final String str, final int size) {
if (str != null) {
if (str.length() > size) {
@@ -372,7 +351,6 @@ public class UtilAll {
return str;
}
-
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
@@ -386,12 +364,10 @@ public class UtilAll {
return true;
}
-
public static String jstack() {
return jstack(Thread.getAllStackTraces());
}
-
public static String jstack(Map<Thread, StackTraceElement[]> map) {
StringBuilder result = new StringBuilder();
try {
@@ -421,19 +397,18 @@ public class UtilAll {
throw new RuntimeException("illegal ipv4 bytes");
}
-
//10.0.0.0~10.255.255.255
//172.16.0.0~172.31.255.255
//192.168.0.0~192.168.255.255
- if (ip[0] == (byte) 10) {
+ if (ip[0] == (byte)10) {
return true;
- } else if (ip[0] == (byte) 172) {
- if (ip[1] >= (byte) 16 && ip[1] <= (byte) 31) {
+ } else if (ip[0] == (byte)172) {
+ if (ip[1] >= (byte)16 && ip[1] <= (byte)31) {
return true;
}
- } else if (ip[0] == (byte) 192) {
- if (ip[1] == (byte) 168) {
+ } else if (ip[0] == (byte)192) {
+ if (ip[1] == (byte)168) {
return true;
}
}
@@ -448,28 +423,27 @@ public class UtilAll {
// if (ip[0] == (byte)30 && ip[1] == (byte)10 && ip[2] == (byte)163 && ip[3] == (byte)120) {
// }
-
- if (ip[0] >= (byte) 1 && ip[0] <= (byte) 126) {
- if (ip[1] == (byte) 1 && ip[2] == (byte) 1 && ip[3] == (byte) 1) {
+ if (ip[0] >= (byte)1 && ip[0] <= (byte)126) {
+ if (ip[1] == (byte)1 && ip[2] == (byte)1 && ip[3] == (byte)1) {
return false;
}
- if (ip[1] == (byte) 0 && ip[2] == (byte) 0 && ip[3] == (byte) 0) {
+ if (ip[1] == (byte)0 && ip[2] == (byte)0 && ip[3] == (byte)0) {
return false;
}
return true;
- } else if (ip[0] >= (byte) 128 && ip[0] <= (byte) 191) {
- if (ip[2] == (byte) 1 && ip[3] == (byte) 1) {
+ } else if (ip[0] >= (byte)128 && ip[0] <= (byte)191) {
+ if (ip[2] == (byte)1 && ip[3] == (byte)1) {
return false;
}
- if (ip[2] == (byte) 0 && ip[3] == (byte) 0) {
+ if (ip[2] == (byte)0 && ip[3] == (byte)0) {
return false;
}
return true;
- } else if (ip[0] >= (byte) 192 && ip[0] <= (byte) 223) {
- if (ip[3] == (byte) 1) {
+ } else if (ip[0] >= (byte)192 && ip[0] <= (byte)223) {
+ if (ip[3] == (byte)1) {
return false;
}
- if (ip[3] == (byte) 0) {
+ if (ip[3] == (byte)0) {
return false;
}
return true;
@@ -482,8 +456,8 @@ public class UtilAll {
return null;
}
return new StringBuilder().append(ip[0] & 0xFF).append(".").append(
- ip[1] & 0xFF).append(".").append(ip[2] & 0xFF)
- .append(".").append(ip[3] & 0xFF).toString();
+ ip[1] & 0xFF).append(".").append(ip[2] & 0xFF)
+ .append(".").append(ip[3] & 0xFF).toString();
}
public static byte[] getIP() {
@@ -492,10 +466,10 @@ public class UtilAll {
InetAddress ip = null;
byte[] internalIP = null;
while (allNetInterfaces.hasMoreElements()) {
- NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
+ NetworkInterface netInterface = (NetworkInterface)allNetInterfaces.nextElement();
Enumeration addresses = netInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
- ip = (InetAddress) addresses.nextElement();
+ ip = (InetAddress)addresses.nextElement();
if (ip != null && ip instanceof Inet4Address) {
byte[] ipByte = ip.getAddress();
if (ipByte.length == 4) {
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/admin/ConsumeStats.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/admin/ConsumeStats.java b/common/src/main/java/org/apache/rocketmq/common/admin/ConsumeStats.java
index efab41b..1fc8897 100644
--- a/common/src/main/java/org/apache/rocketmq/common/admin/ConsumeStats.java
+++ b/common/src/main/java/org/apache/rocketmq/common/admin/ConsumeStats.java
@@ -6,23 +6,21 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.admin;
-import org.apache.rocketmq.common.message.MessageQueue;
-import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
-
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
-
+import org.apache.rocketmq.common.message.MessageQueue;
+import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
/**
*
@@ -32,7 +30,6 @@ public class ConsumeStats extends RemotingSerializable {
private HashMap<MessageQueue, OffsetWrapper> offsetTable = new HashMap<MessageQueue, OffsetWrapper>();
private double consumeTps = 0;
-
public long computeTotalDiff() {
long diffTotal = 0L;
@@ -46,12 +43,10 @@ public class ConsumeStats extends RemotingSerializable {
return diffTotal;
}
-
public HashMap<MessageQueue, OffsetWrapper> getOffsetTable() {
return offsetTable;
}
-
public void setOffsetTable(HashMap<MessageQueue, OffsetWrapper> offsetTable) {
this.offsetTable = offsetTable;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/admin/OffsetWrapper.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/admin/OffsetWrapper.java b/common/src/main/java/org/apache/rocketmq/common/admin/OffsetWrapper.java
index 170509a..a5697ec 100644
--- a/common/src/main/java/org/apache/rocketmq/common/admin/OffsetWrapper.java
+++ b/common/src/main/java/org/apache/rocketmq/common/admin/OffsetWrapper.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.admin;
@@ -26,32 +26,26 @@ public class OffsetWrapper {
private long lastTimestamp;
-
public long getBrokerOffset() {
return brokerOffset;
}
-
public void setBrokerOffset(long brokerOffset) {
this.brokerOffset = brokerOffset;
}
-
public long getConsumerOffset() {
return consumerOffset;
}
-
public void setConsumerOffset(long consumerOffset) {
this.consumerOffset = consumerOffset;
}
-
public long getLastTimestamp() {
return lastTimestamp;
}
-
public void setLastTimestamp(long lastTimestamp) {
this.lastTimestamp = lastTimestamp;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/admin/RollbackStats.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/admin/RollbackStats.java b/common/src/main/java/org/apache/rocketmq/common/admin/RollbackStats.java
index 3af6a0c..2f90e69 100644
--- a/common/src/main/java/org/apache/rocketmq/common/admin/RollbackStats.java
+++ b/common/src/main/java/org/apache/rocketmq/common/admin/RollbackStats.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.admin;
@@ -28,62 +28,50 @@ public class RollbackStats {
private long timestampOffset;
private long rollbackOffset;
-
public String getBrokerName() {
return brokerName;
}
-
public void setBrokerName(String brokerName) {
this.brokerName = brokerName;
}
-
public long getQueueId() {
return queueId;
}
-
public void setQueueId(long queueId) {
this.queueId = queueId;
}
-
public long getBrokerOffset() {
return brokerOffset;
}
-
public void setBrokerOffset(long brokerOffset) {
this.brokerOffset = brokerOffset;
}
-
public long getConsumerOffset() {
return consumerOffset;
}
-
public void setConsumerOffset(long consumerOffset) {
this.consumerOffset = consumerOffset;
}
-
public long getTimestampOffset() {
return timestampOffset;
}
-
public void setTimestampOffset(long timestampOffset) {
this.timestampOffset = timestampOffset;
}
-
public long getRollbackOffset() {
return rollbackOffset;
}
-
public void setRollbackOffset(long rollbackOffset) {
this.rollbackOffset = rollbackOffset;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/admin/TopicOffset.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/admin/TopicOffset.java b/common/src/main/java/org/apache/rocketmq/common/admin/TopicOffset.java
index f64ddcb..8147d63 100644
--- a/common/src/main/java/org/apache/rocketmq/common/admin/TopicOffset.java
+++ b/common/src/main/java/org/apache/rocketmq/common/admin/TopicOffset.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.admin;
@@ -25,32 +25,26 @@ public class TopicOffset {
private long maxOffset;
private long lastUpdateTimestamp;
-
public long getMinOffset() {
return minOffset;
}
-
public void setMinOffset(long minOffset) {
this.minOffset = minOffset;
}
-
public long getMaxOffset() {
return maxOffset;
}
-
public void setMaxOffset(long maxOffset) {
this.maxOffset = maxOffset;
}
-
public long getLastUpdateTimestamp() {
return lastUpdateTimestamp;
}
-
public void setLastUpdateTimestamp(long lastUpdateTimestamp) {
this.lastUpdateTimestamp = lastUpdateTimestamp;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/admin/TopicStatsTable.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/admin/TopicStatsTable.java b/common/src/main/java/org/apache/rocketmq/common/admin/TopicStatsTable.java
index a9e9e84..01f4557 100644
--- a/common/src/main/java/org/apache/rocketmq/common/admin/TopicStatsTable.java
+++ b/common/src/main/java/org/apache/rocketmq/common/admin/TopicStatsTable.java
@@ -6,22 +6,20 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.admin;
+import java.util.HashMap;
import org.apache.rocketmq.common.message.MessageQueue;
import org.apache.rocketmq.remoting.protocol.RemotingSerializable;
-import java.util.HashMap;
-
-
/**
*
*
@@ -29,12 +27,10 @@ import java.util.HashMap;
public class TopicStatsTable extends RemotingSerializable {
private HashMap<MessageQueue, TopicOffset> offsetTable = new HashMap<MessageQueue, TopicOffset>();
-
public HashMap<MessageQueue, TopicOffset> getOffsetTable() {
return offsetTable;
}
-
public void setOffsetTable(HashMap<MessageQueue, TopicOffset> offsetTable) {
this.offsetTable = offsetTable;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/constant/DBMsgConstants.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/constant/DBMsgConstants.java b/common/src/main/java/org/apache/rocketmq/common/constant/DBMsgConstants.java
index 298a427..ee3e52a 100644
--- a/common/src/main/java/org/apache/rocketmq/common/constant/DBMsgConstants.java
+++ b/common/src/main/java/org/apache/rocketmq/common/constant/DBMsgConstants.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.constant;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/constant/LoggerName.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/constant/LoggerName.java b/common/src/main/java/org/apache/rocketmq/common/constant/LoggerName.java
index 2bcfacf..482a04e 100644
--- a/common/src/main/java/org/apache/rocketmq/common/constant/LoggerName.java
+++ b/common/src/main/java/org/apache/rocketmq/common/constant/LoggerName.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.constant;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/constant/PermName.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/constant/PermName.java b/common/src/main/java/org/apache/rocketmq/common/constant/PermName.java
index e5ab1fc..72ac372 100644
--- a/common/src/main/java/org/apache/rocketmq/common/constant/PermName.java
+++ b/common/src/main/java/org/apache/rocketmq/common/constant/PermName.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.constant;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/consumer/ConsumeFromWhere.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/consumer/ConsumeFromWhere.java b/common/src/main/java/org/apache/rocketmq/common/consumer/ConsumeFromWhere.java
index 2c8e989..2e6c2db 100644
--- a/common/src/main/java/org/apache/rocketmq/common/consumer/ConsumeFromWhere.java
+++ b/common/src/main/java/org/apache/rocketmq/common/consumer/ConsumeFromWhere.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.consumer;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/FilterAPI.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/FilterAPI.java b/common/src/main/java/org/apache/rocketmq/common/filter/FilterAPI.java
index 7f558ef..01c1732 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/FilterAPI.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/FilterAPI.java
@@ -6,20 +6,18 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter;
-import org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData;
-
import java.net.URL;
-
+import org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData;
/**
*
@@ -42,7 +40,7 @@ public class FilterAPI {
}
public static SubscriptionData buildSubscriptionData(final String consumerGroup, String topic,
- String subString) throws Exception {
+ String subString) throws Exception {
SubscriptionData subscriptionData = new SubscriptionData();
subscriptionData.setTopic(topic);
subscriptionData.setSubString(subString);
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/FilterContext.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/FilterContext.java b/common/src/main/java/org/apache/rocketmq/common/filter/FilterContext.java
index e18fe48..3501d26 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/FilterContext.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/FilterContext.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter;
@@ -20,12 +20,10 @@ package org.apache.rocketmq.common.filter;
public class FilterContext {
private String consumerGroup;
-
public String getConsumerGroup() {
return consumerGroup;
}
-
public void setConsumerGroup(String consumerGroup) {
this.consumerGroup = consumerGroup;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/MessageFilter.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/MessageFilter.java b/common/src/main/java/org/apache/rocketmq/common/filter/MessageFilter.java
index c20e737..3af3d10 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/MessageFilter.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/MessageFilter.java
@@ -19,7 +19,6 @@ package org.apache.rocketmq.common.filter;
import org.apache.rocketmq.common.message.MessageExt;
-
public interface MessageFilter {
boolean match(final MessageExt msg, final FilterContext context);
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java
index af54566..ac85e4d 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Op.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter.impl;
@@ -21,17 +21,14 @@ public abstract class Op {
private String symbol;
-
protected Op(String symbol) {
this.symbol = symbol;
}
-
public String getSymbol() {
return symbol;
}
-
public String toString() {
return symbol;
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java
index ce21d90..5de03b7 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operand.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter.impl;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java
index 45bebf0..a232fe4 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Operator.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter.impl;
@@ -27,7 +27,6 @@ public class Operator extends Op {
private int priority;
private boolean compareable;
-
private Operator(String symbol, int priority, boolean compareable) {
super(symbol);
this.priority = priority;
@@ -55,7 +54,6 @@ public class Operator extends Op {
return compareable;
}
-
public int compare(Operator operator) {
if (this.priority > operator.priority)
return 1;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java b/common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java
index 73b51b6..2b89944 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/impl/PolishExpr.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter.impl;
@@ -49,7 +49,7 @@ public class PolishExpr {
segments.add(token);
} else if (isLeftParenthesis(token)) {
- operatorStack.push((Operator) token);
+ operatorStack.push((Operator)token);
} else if (isRightParenthesis(token)) {
Operator opNew = null;
@@ -60,7 +60,7 @@ public class PolishExpr {
throw new IllegalArgumentException("mismatched parentheses");
} else if (isOperator(token)) {
- Operator opNew = (Operator) token;
+ Operator opNew = (Operator)token;
if (!operatorStack.empty()) {
Operator opOld = operatorStack.peek();
if (opOld.isCompareable() && opNew.compare(opOld) != 1) {
@@ -99,17 +99,16 @@ public class PolishExpr {
Type preType = Type.NULL;
for (int i = 0; i < size; i++) {
- int chValue = (int) expression.charAt(i);
+ int chValue = (int)expression.charAt(i);
if ((97 <= chValue && chValue <= 122) || (65 <= chValue && chValue <= 90)
- || (49 <= chValue && chValue <= 57) || 95 == chValue) {
-
+ || (49 <= chValue && chValue <= 57) || 95 == chValue) {
if (Type.OPERATOR == preType || Type.SEPAERATOR == preType || Type.NULL == preType
- || Type.PARENTHESIS == preType) {
+ || Type.PARENTHESIS == preType) {
if (Type.OPERATOR == preType) {
segments.add(createOperator(expression.substring(wordStartIndex, wordStartIndex
- + wordLen)));
+ + wordLen)));
}
wordStartIndex = i;
wordLen = 0;
@@ -118,10 +117,9 @@ public class PolishExpr {
wordLen++;
} else if (40 == chValue || 41 == chValue) {
-
if (Type.OPERATOR == preType) {
segments.add(createOperator(expression
- .substring(wordStartIndex, wordStartIndex + wordLen)));
+ .substring(wordStartIndex, wordStartIndex + wordLen)));
wordStartIndex = -1;
wordLen = 0;
} else if (Type.OPERAND == preType) {
@@ -131,13 +129,13 @@ public class PolishExpr {
}
preType = Type.PARENTHESIS;
- segments.add(createOperator((char) chValue + ""));
+ segments.add(createOperator((char)chValue + ""));
} else if (38 == chValue || 124 == chValue) {
if (Type.OPERAND == preType || Type.SEPAERATOR == preType || Type.PARENTHESIS == preType) {
if (Type.OPERAND == preType) {
segments.add(new Operand(expression.substring(wordStartIndex, wordStartIndex
- + wordLen)));
+ + wordLen)));
}
wordStartIndex = i;
wordLen = 0;
@@ -146,10 +144,9 @@ public class PolishExpr {
wordLen++;
} else if (32 == chValue || 9 == chValue) {
-
if (Type.OPERATOR == preType) {
segments.add(createOperator(expression
- .substring(wordStartIndex, wordStartIndex + wordLen)));
+ .substring(wordStartIndex, wordStartIndex + wordLen)));
wordStartIndex = -1;
wordLen = 0;
} else if (Type.OPERAND == preType) {
@@ -160,7 +157,7 @@ public class PolishExpr {
preType = Type.SEPAERATOR;
} else {
- throw new IllegalArgumentException("illegal expression, at index " + i + " " + (char) chValue);
+ throw new IllegalArgumentException("illegal expression, at index " + i + " " + (char)chValue);
}
}
@@ -176,11 +173,11 @@ public class PolishExpr {
}
public static boolean isLeftParenthesis(Op token) {
- return token instanceof Operator && LEFTPARENTHESIS == (Operator) token;
+ return token instanceof Operator && LEFTPARENTHESIS == (Operator)token;
}
public static boolean isRightParenthesis(Op token) {
- return token instanceof Operator && RIGHTPARENTHESIS == (Operator) token;
+ return token instanceof Operator && RIGHTPARENTHESIS == (Operator)token;
}
public static boolean isOperator(Op token) {
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java
index 834bde8..68797de 100644
--- a/common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java
+++ b/common/src/main/java/org/apache/rocketmq/common/filter/impl/Type.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.filter.impl;
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java b/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java
index d3c5f33..603db27 100644
--- a/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java
+++ b/common/src/main/java/org/apache/rocketmq/common/help/FAQUrl.java
@@ -6,72 +6,61 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.help;
public class FAQUrl {
public static final String APPLY_TOPIC_URL = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&topic_not_exist";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&topic_not_exist";
public static final String NAME_SERVER_ADDR_NOT_EXIST_URL = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&namesrv_not_exist";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&namesrv_not_exist";
public static final String GROUP_NAME_DUPLICATE_URL = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&group_duplicate";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&group_duplicate";
public static final String CLIENT_PARAMETER_CHECK_URL = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions¶meter_check_failed";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions¶meter_check_failed";
public static final String SUBSCRIPTION_GROUP_NOT_EXIST = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&subGroup_not_exist";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&subGroup_not_exist";
public static final String CLIENT_SERVICE_NOT_OK = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&service_not_ok";
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&service_not_ok";
// FAQ: No route info of this topic, TopicABC
public static final String NO_TOPIC_ROUTE_INFO = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&topic_not_exist";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&topic_not_exist";
public static final String LOAD_JSON_EXCEPTION = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&load_json_exception";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&load_json_exception";
public static final String SAME_GROUP_DIFFERENT_TOPIC = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&subscription_exception";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&subscription_exception";
public static final String MQLIST_NOT_EXIST = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&queue_not_exist";
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&queue_not_exist";
public static final String UNEXPECTED_EXCEPTION_URL = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&unexpected_exception";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&unexpected_exception";
public static final String SEND_MSG_FAILED = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&send_msg_failed";
-
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&send_msg_failed";
public static final String UNKNOWN_HOST_EXCEPTION = //
- "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&unknown_host";
+ "http://docs.aliyun.com/cn#/pub/ons/faq/exceptions&unknown_host";
private static final String TIP_STRING_BEGIN = "\nSee ";
private static final String TIP_STRING_END = " for further details.";
-
public static String suggestTodo(final String url) {
StringBuilder sb = new StringBuilder();
sb.append(TIP_STRING_BEGIN);
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/hook/FilterCheckHook.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/hook/FilterCheckHook.java b/common/src/main/java/org/apache/rocketmq/common/hook/FilterCheckHook.java
index 10b1097..a0a7925 100644
--- a/common/src/main/java/org/apache/rocketmq/common/hook/FilterCheckHook.java
+++ b/common/src/main/java/org/apache/rocketmq/common/hook/FilterCheckHook.java
@@ -6,20 +6,19 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.hook;
import java.nio.ByteBuffer;
-
/**
*
*
@@ -27,6 +26,5 @@ import java.nio.ByteBuffer;
public interface FilterCheckHook {
public String hookName();
-
public boolean isFilterMatched(final boolean isUnitMode, final ByteBuffer byteBuffer);
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/Message.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/Message.java b/common/src/main/java/org/apache/rocketmq/common/message/Message.java
index 258104c..00cb6d1 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/Message.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/Message.java
@@ -6,13 +6,13 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.message;
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-
/**
*
*
@@ -34,16 +33,13 @@ public class Message implements Serializable {
private Map<String, String> properties;
private byte[] body;
-
public Message() {
}
-
public Message(String topic, byte[] body) {
this(topic, "", "", 0, body, true);
}
-
public Message(String topic, String tags, String keys, int flag, byte[] body, boolean waitStoreMsgOK) {
this.topic = topic;
this.flag = flag;
@@ -58,6 +54,14 @@ public class Message implements Serializable {
this.setWaitStoreMsgOK(waitStoreMsgOK);
}
+ public Message(String topic, String tags, byte[] body) {
+ this(topic, tags, "", 0, body, true);
+ }
+
+ public Message(String topic, String tags, String keys, byte[] body) {
+ this(topic, tags, keys, 0, body, true);
+ }
+
public void setKeys(String keys) {
this.putProperty(MessageConst.PROPERTY_KEYS, keys);
}
@@ -70,16 +74,6 @@ public class Message implements Serializable {
this.properties.put(name, value);
}
-
- public Message(String topic, String tags, byte[] body) {
- this(topic, tags, "", 0, body, true);
- }
-
-
- public Message(String topic, String tags, String keys, byte[] body) {
- this(topic, tags, keys, 0, body, true);
- }
-
void clearProperty(final String name) {
if (null != this.properties) {
this.properties.remove(name);
@@ -89,7 +83,7 @@ public class Message implements Serializable {
public void putUserProperty(final String name, final String value) {
if (MessageConst.STRING_HASH_SET.contains(name)) {
throw new RuntimeException(String.format(
- "The Property<%s> is used by system, input another please", name));
+ "The Property<%s> is used by system, input another please", name));
}
this.putProperty(name, value);
}
@@ -136,7 +130,6 @@ public class Message implements Serializable {
this.setKeys(sb.toString().trim());
}
-
public int getDelayTimeLevel() {
String t = this.getProperty(MessageConst.PROPERTY_DELAY_TIME_LEVEL);
if (t != null) {
@@ -146,12 +139,10 @@ public class Message implements Serializable {
return 0;
}
-
public void setDelayTimeLevel(int level) {
this.putProperty(MessageConst.PROPERTY_DELAY_TIME_LEVEL, String.valueOf(level));
}
-
public boolean isWaitStoreMsgOK() {
String result = this.getProperty(MessageConst.PROPERTY_WAIT_STORE_MSG_OK);
if (null == result)
@@ -160,37 +151,30 @@ public class Message implements Serializable {
return Boolean.parseBoolean(result);
}
-
public void setWaitStoreMsgOK(boolean waitStoreMsgOK) {
this.putProperty(MessageConst.PROPERTY_WAIT_STORE_MSG_OK, Boolean.toString(waitStoreMsgOK));
}
-
public int getFlag() {
return flag;
}
-
public void setFlag(int flag) {
this.flag = flag;
}
-
public byte[] getBody() {
return body;
}
-
public void setBody(byte[] body) {
this.body = body;
}
-
public Map<String, String> getProperties() {
return properties;
}
-
void setProperties(Map<String, String> properties) {
this.properties = properties;
}
@@ -206,6 +190,6 @@ public class Message implements Serializable {
@Override
public String toString() {
return "Message [topic=" + topic + ", flag=" + flag + ", properties=" + properties + ", body="
- + (body != null ? body.length : 0) + "]";
+ + (body != null ? body.length : 0) + "]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageAccessor.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageAccessor.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageAccessor.java
index 5cd0ba8..7663ecd 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageAccessor.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageAccessor.java
@@ -6,20 +6,19 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.message;
import java.util.Map;
-
public class MessageAccessor {
public static void clearProperty(final Message msg, final String name) {
@@ -42,52 +41,42 @@ public class MessageAccessor {
return msg.getProperty(MessageConst.PROPERTY_TRANSFER_FLAG);
}
-
public static void setCorrectionFlag(final Message msg, String unit) {
putProperty(msg, MessageConst.PROPERTY_CORRECTION_FLAG, unit);
}
-
public static String getCorrectionFlag(final Message msg) {
return msg.getProperty(MessageConst.PROPERTY_CORRECTION_FLAG);
}
-
public static void setOriginMessageId(final Message msg, String originMessageId) {
putProperty(msg, MessageConst.PROPERTY_ORIGIN_MESSAGE_ID, originMessageId);
}
-
public static String getOriginMessageId(final Message msg) {
return msg.getProperty(MessageConst.PROPERTY_ORIGIN_MESSAGE_ID);
}
-
public static void setMQ2Flag(final Message msg, String flag) {
putProperty(msg, MessageConst.PROPERTY_MQ2_FLAG, flag);
}
-
public static String getMQ2Flag(final Message msg) {
return msg.getProperty(MessageConst.PROPERTY_MQ2_FLAG);
}
-
public static void setReconsumeTime(final Message msg, String reconsumeTimes) {
putProperty(msg, MessageConst.PROPERTY_RECONSUME_TIME, reconsumeTimes);
}
-
public static String getReconsumeTime(final Message msg) {
return msg.getProperty(MessageConst.PROPERTY_RECONSUME_TIME);
}
-
public static void setMaxReconsumeTimes(final Message msg, String maxReconsumeTimes) {
putProperty(msg, MessageConst.PROPERTY_MAX_RECONSUME_TIMES, maxReconsumeTimes);
}
-
public static String getMaxReconsumeTimes(final Message msg) {
return msg.getProperty(MessageConst.PROPERTY_MAX_RECONSUME_TIMES);
}
@@ -96,7 +85,6 @@ public class MessageAccessor {
putProperty(msg, MessageConst.PROPERTY_CONSUME_START_TIMESTAMP, propertyConsumeStartTimeStamp);
}
-
public static String getConsumeStartTimeStamp(final Message msg) {
return msg.getProperty(MessageConst.PROPERTY_CONSUME_START_TIMESTAMP);
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageClientExt.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageClientExt.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageClientExt.java
index 90703ca..8fa6a15 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageClientExt.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageClientExt.java
@@ -6,40 +6,38 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.message;
public class MessageClientExt extends MessageExt {
-
- public void setOffsetMsgId(String offsetMsgId) {
- super.setMsgId(offsetMsgId);
- }
-
public String getOffsetMsgId() {
return super.getMsgId();
}
-
- public void setMsgId(String msgId) {
- //DO NOTHING
- //MessageClientIDSetter.setUniqID(this);
+
+ public void setOffsetMsgId(String offsetMsgId) {
+ super.setMsgId(offsetMsgId);
}
-
+
@Override
public String getMsgId() {
String uniqID = MessageClientIDSetter.getUniqID(this);
if (uniqID == null) {
return this.getOffsetMsgId();
- }
- else {
+ } else {
return uniqID;
}
}
+
+ public void setMsgId(String msgId) {
+ //DO NOTHING
+ //MessageClientIDSetter.setUniqID(this);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java
index 1c3a1b7..1c27920 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java
@@ -16,12 +16,11 @@
*/
package org.apache.rocketmq.common.message;
-import org.apache.rocketmq.common.UtilAll;
-
import java.nio.ByteBuffer;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.rocketmq.common.UtilAll;
public class MessageClientIDSetter {
private static final String TOPIC_KEY_SPLITTER = "#";
@@ -65,10 +64,10 @@ public class MessageClientIDSetter {
public static Date getNearlyTimeFromID(String msgID) {
ByteBuffer buf = ByteBuffer.allocate(8);
byte[] bytes = UtilAll.string2bytes(msgID);
- buf.put((byte) 0);
- buf.put((byte) 0);
- buf.put((byte) 0);
- buf.put((byte) 0);
+ buf.put((byte)0);
+ buf.put((byte)0);
+ buf.put((byte)0);
+ buf.put((byte)0);
buf.put(bytes, 10, 4);
buf.position(0);
long spanMS = buf.getLong();
@@ -107,7 +106,6 @@ public class MessageClientIDSetter {
return sb.toString();
}
-
private static byte[] createUniqIDBuffer() {
ByteBuffer buffer = ByteBuffer.allocate(4 + 2);
long current = System.currentTimeMillis();
@@ -115,8 +113,8 @@ public class MessageClientIDSetter {
setStartTime(current);
}
buffer.position(0);
- buffer.putInt((int) (System.currentTimeMillis() - startTime));
- buffer.putShort((short) COUNTER.getAndIncrement());
+ buffer.putInt((int)(System.currentTimeMillis() - startTime));
+ buffer.putShort((short)COUNTER.getAndIncrement());
return buffer.array();
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
index d65160b..a4c15a8 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageConst.java
@@ -18,7 +18,6 @@ package org.apache.rocketmq.common.message;
import java.util.HashSet;
-
public class MessageConst {
public static final String PROPERTY_KEYS = "KEYS";
public static final String PROPERTY_TAGS = "TAGS";
@@ -47,7 +46,6 @@ public class MessageConst {
public static final HashSet<String> STRING_HASH_SET = new HashSet<String>();
-
static {
STRING_HASH_SET.add(PROPERTY_TRACE_SWITCH);
STRING_HASH_SET.add(PROPERTY_MSG_REGION);
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java
index 375cc47..6ae1d2a 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageDecoder.java
@@ -16,9 +16,6 @@
*/
package org.apache.rocketmq.common.message;
-import org.apache.rocketmq.common.UtilAll;
-import org.apache.rocketmq.common.sysflag.MessageSysFlag;
-
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -30,7 +27,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
+import org.apache.rocketmq.common.UtilAll;
+import org.apache.rocketmq.common.sysflag.MessageSysFlag;
public class MessageDecoder {
public final static int MSG_ID_LENGTH = 8 + 8;
@@ -41,7 +39,8 @@ public class MessageDecoder {
public final static int MESSAGE_PHYSIC_OFFSET_POSTION = 28;
public final static int MESSAGE_STORE_TIMESTAMP_POSTION = 56;
public final static int MESSAGE_MAGIC_CODE = 0xAABBCCDD ^ 1880681586 + 8;
-
+ public static final char NAME_VALUE_SEPARATOR = 1;
+ public static final char PROPERTY_SEPARATOR = 2;
public static String createMessageId(final ByteBuffer input, final ByteBuffer addr, final long offset) {
input.flip();
@@ -53,10 +52,9 @@ public class MessageDecoder {
return UtilAll.bytes2string(input.array());
}
-
public static String createMessageId(SocketAddress socketAddress, long transactionIdhashCode) {
ByteBuffer byteBuffer = ByteBuffer.allocate(MessageDecoder.MSG_ID_LENGTH);
- InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+ InetSocketAddress inetSocketAddress = (InetSocketAddress)socketAddress;
byteBuffer.put(inetSocketAddress.getAddress().getAddress());
byteBuffer.putInt(inetSocketAddress.getPort());
byteBuffer.putLong(transactionIdhashCode);
@@ -64,12 +62,10 @@ public class MessageDecoder {
return UtilAll.bytes2string(byteBuffer.array());
}
-
public static MessageId decodeMessageId(final String msgId) throws UnknownHostException {
SocketAddress address;
long offset;
-
byte[] ip = UtilAll.string2bytes(msgId.substring(0, 8));
byte[] port = UtilAll.string2bytes(msgId.substring(8, 16));
ByteBuffer bb = ByteBuffer.wrap(port);
@@ -84,7 +80,6 @@ public class MessageDecoder {
return new MessageId(address, offset);
}
-
public static MessageExt decode(java.nio.ByteBuffer byteBuffer) {
return decode(byteBuffer, true, true, false);
}
@@ -97,14 +92,13 @@ public class MessageDecoder {
return decode(byteBuffer, readBody, true, false);
}
-
public static byte[] encode(MessageExt messageExt, boolean needCompress) throws Exception {
byte[] body = messageExt.getBody();
byte[] topics = messageExt.getTopic().getBytes(CHARSET_UTF8);
- byte topicLen = (byte) topics.length;
+ byte topicLen = (byte)topics.length;
String properties = messageProperties2String(messageExt.getProperties());
byte[] propertiesBytes = properties.getBytes(CHARSET_UTF8);
- short propertiesLength = (short) propertiesBytes.length;
+ short propertiesLength = (short)propertiesBytes.length;
int sysFlag = messageExt.getSysFlag();
byte[] newBody = messageExt.getBody();
if (needCompress && (sysFlag & MessageSysFlag.COMPRESSED_FLAG) == MessageSysFlag.COMPRESSED_FLAG) {
@@ -117,23 +111,23 @@ public class MessageDecoder {
byteBuffer = ByteBuffer.allocate(storeSize);
} else {
storeSize = 4 // 1 TOTALSIZE
- + 4 // 2 MAGICCODE
- + 4 // 3 BODYCRC
- + 4 // 4 QUEUEID
- + 4 // 5 FLAG
- + 8 // 6 QUEUEOFFSET
- + 8 // 7 PHYSICALOFFSET
- + 4 // 8 SYSFLAG
- + 8 // 9 BORNTIMESTAMP
- + 8 // 10 BORNHOST
- + 8 // 11 STORETIMESTAMP
- + 8 // 12 STOREHOSTADDRESS
- + 4 // 13 RECONSUMETIMES
- + 8 // 14 Prepared Transaction Offset
- + 4 + bodyLength // 14 BODY
- + 1 + topicLen // 15 TOPIC
- + 2 + propertiesLength // 16 propertiesLength
- + 0;
+ + 4 // 2 MAGICCODE
+ + 4 // 3 BODYCRC
+ + 4 // 4 QUEUEID
+ + 4 // 5 FLAG
+ + 8 // 6 QUEUEOFFSET
+ + 8 // 7 PHYSICALOFFSET
+ + 4 // 8 SYSFLAG
+ + 8 // 9 BORNTIMESTAMP
+ + 8 // 10 BORNHOST
+ + 8 // 11 STORETIMESTAMP
+ + 8 // 12 STOREHOSTADDRESS
+ + 4 // 13 RECONSUMETIMES
+ + 8 // 14 Prepared Transaction Offset
+ + 4 + bodyLength // 14 BODY
+ + 1 + topicLen // 15 TOPIC
+ + 2 + propertiesLength // 16 propertiesLength
+ + 0;
byteBuffer = ByteBuffer.allocate(storeSize);
}
// 1 TOTALSIZE
@@ -170,7 +164,7 @@ public class MessageDecoder {
byteBuffer.putLong(bornTimeStamp);
// 10 BORNHOST
- InetSocketAddress bornHost = (InetSocketAddress) messageExt.getBornHost();
+ InetSocketAddress bornHost = (InetSocketAddress)messageExt.getBornHost();
byteBuffer.put(bornHost.getAddress().getAddress());
byteBuffer.putInt(bornHost.getPort());
@@ -179,7 +173,7 @@ public class MessageDecoder {
byteBuffer.putLong(storeTimestamp);
// 12 STOREHOST
- InetSocketAddress serverHost = (InetSocketAddress) messageExt.getStoreHost();
+ InetSocketAddress serverHost = (InetSocketAddress)messageExt.getStoreHost();
byteBuffer.put(serverHost.getAddress().getAddress());
byteBuffer.putInt(serverHost.getPort());
@@ -207,12 +201,12 @@ public class MessageDecoder {
}
public static MessageExt decode(
- java.nio.ByteBuffer byteBuffer, final boolean readBody, final boolean deCompressBody) {
+ java.nio.ByteBuffer byteBuffer, final boolean readBody, final boolean deCompressBody) {
return decode(byteBuffer, readBody, deCompressBody, false);
}
public static MessageExt decode(
- java.nio.ByteBuffer byteBuffer, final boolean readBody, final boolean deCompressBody, final boolean isClient) {
+ java.nio.ByteBuffer byteBuffer, final boolean readBody, final boolean deCompressBody, final boolean isClient) {
try {
MessageExt msgExt;
@@ -301,7 +295,7 @@ public class MessageDecoder {
// 16 TOPIC
byte topicLen = byteBuffer.get();
- byte[] topic = new byte[(int) topicLen];
+ byte[] topic = new byte[(int)topicLen];
byteBuffer.get(topic);
msgExt.setTopic(new String(topic, CHARSET_UTF8));
@@ -320,7 +314,7 @@ public class MessageDecoder {
msgExt.setMsgId(msgId);
if (isClient) {
- ((MessageClientExt) msgExt).setOffsetMsgId(msgId);
+ ((MessageClientExt)msgExt).setOffsetMsgId(msgId);
}
return msgExt;
@@ -335,7 +329,6 @@ public class MessageDecoder {
return null;
}
-
public static List<MessageExt> decodes(java.nio.ByteBuffer byteBuffer) {
return decodes(byteBuffer, true);
}
@@ -353,10 +346,6 @@ public class MessageDecoder {
return msgExts;
}
- public static final char NAME_VALUE_SEPARATOR = 1;
- public static final char PROPERTY_SEPARATOR = 2;
-
-
public static String messageProperties2String(Map<String, String> properties) {
StringBuilder sb = new StringBuilder();
if (properties != null) {
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
index b771666..9fec0ca 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageExt.java
@@ -6,23 +6,21 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.message;
-import org.apache.rocketmq.common.TopicFilterType;
-import org.apache.rocketmq.common.sysflag.MessageSysFlag;
-
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
-
+import org.apache.rocketmq.common.TopicFilterType;
+import org.apache.rocketmq.common.sysflag.MessageSysFlag;
public class MessageExt extends Message {
private static final long serialVersionUID = 5720810158625748049L;
@@ -45,13 +43,11 @@ public class MessageExt extends Message {
private long preparedTransactionOffset;
-
public MessageExt() {
}
-
public MessageExt(int queueId, long bornTimestamp, SocketAddress bornHost, long storeTimestamp,
- SocketAddress storeHost, String msgId) {
+ SocketAddress storeHost, String msgId) {
this.queueId = queueId;
this.bornTimestamp = bornTimestamp;
this.bornHost = bornHost;
@@ -68,16 +64,8 @@ public class MessageExt extends Message {
return TopicFilterType.SINGLE_TAG;
}
- public ByteBuffer getBornHostBytes() {
- return socketAddress2ByteBuffer(this.bornHost);
- }
-
- public ByteBuffer getBornHostBytes(ByteBuffer byteBuffer) {
- return socketAddress2ByteBuffer(this.bornHost, byteBuffer);
- }
-
private static ByteBuffer socketAddress2ByteBuffer(final SocketAddress socketAddress, final ByteBuffer byteBuffer) {
- InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+ InetSocketAddress inetSocketAddress = (InetSocketAddress)socketAddress;
byteBuffer.put(inetSocketAddress.getAddress().getAddress(), 0, 4);
byteBuffer.putInt(inetSocketAddress.getPort());
byteBuffer.flip();
@@ -89,6 +77,14 @@ public class MessageExt extends Message {
return socketAddress2ByteBuffer(socketAddress, byteBuffer);
}
+ public ByteBuffer getBornHostBytes() {
+ return socketAddress2ByteBuffer(this.bornHost);
+ }
+
+ public ByteBuffer getBornHostBytes(ByteBuffer byteBuffer) {
+ return socketAddress2ByteBuffer(this.bornHost, byteBuffer);
+ }
+
public ByteBuffer getStoreHostBytes() {
return socketAddress2ByteBuffer(this.storeHost);
}
@@ -123,7 +119,7 @@ public class MessageExt extends Message {
public String getBornHostString() {
if (this.bornHost != null) {
- InetSocketAddress inetSocketAddress = (InetSocketAddress) this.bornHost;
+ InetSocketAddress inetSocketAddress = (InetSocketAddress)this.bornHost;
return inetSocketAddress.getAddress().getHostAddress();
}
@@ -132,7 +128,7 @@ public class MessageExt extends Message {
public String getBornHostNameString() {
if (this.bornHost != null) {
- InetSocketAddress inetSocketAddress = (InetSocketAddress) this.bornHost;
+ InetSocketAddress inetSocketAddress = (InetSocketAddress)this.bornHost;
return inetSocketAddress.getAddress().getHostName();
}
@@ -207,29 +203,25 @@ public class MessageExt extends Message {
return reconsumeTimes;
}
-
public void setReconsumeTimes(int reconsumeTimes) {
this.reconsumeTimes = reconsumeTimes;
}
-
public long getPreparedTransactionOffset() {
return preparedTransactionOffset;
}
-
public void setPreparedTransactionOffset(long preparedTransactionOffset) {
this.preparedTransactionOffset = preparedTransactionOffset;
}
-
@Override
public String toString() {
return "MessageExt [queueId=" + queueId + ", storeSize=" + storeSize + ", queueOffset=" + queueOffset
- + ", sysFlag=" + sysFlag + ", bornTimestamp=" + bornTimestamp + ", bornHost=" + bornHost
- + ", storeTimestamp=" + storeTimestamp + ", storeHost=" + storeHost + ", msgId=" + msgId
- + ", commitLogOffset=" + commitLogOffset + ", bodyCRC=" + bodyCRC + ", reconsumeTimes="
- + reconsumeTimes + ", preparedTransactionOffset=" + preparedTransactionOffset
- + ", toString()=" + super.toString() + "]";
+ + ", sysFlag=" + sysFlag + ", bornTimestamp=" + bornTimestamp + ", bornHost=" + bornHost
+ + ", storeTimestamp=" + storeTimestamp + ", storeHost=" + storeHost + ", msgId=" + msgId
+ + ", commitLogOffset=" + commitLogOffset + ", bodyCRC=" + bodyCRC + ", reconsumeTimes="
+ + reconsumeTimes + ", preparedTransactionOffset=" + preparedTransactionOffset
+ + ", toString()=" + super.toString() + "]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/388ba7a5/common/src/main/java/org/apache/rocketmq/common/message/MessageId.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/rocketmq/common/message/MessageId.java b/common/src/main/java/org/apache/rocketmq/common/message/MessageId.java
index 04dd01f..0de3318 100644
--- a/common/src/main/java/org/apache/rocketmq/common/message/MessageId.java
+++ b/common/src/main/java/org/apache/rocketmq/common/message/MessageId.java
@@ -6,45 +6,39 @@
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.rocketmq.common.message;
import java.net.SocketAddress;
-
public class MessageId {
private SocketAddress address;
private long offset;
-
public MessageId(SocketAddress address, long offset) {
this.address = address;
this.offset = offset;
}
-
public SocketAddress getAddress() {
return address;
}
-
public void setAddress(SocketAddress address) {
this.address = address;
}
-
public long getOffset() {
return offset;
}
-
public void setOffset(long offset) {
this.offset = offset;
}