Skip to content

Commit

Permalink
[ROCKETMQ-139] Degrade the client related modules' JDK version to 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouxinyu authored and dongeforever committed Jun 6, 2017
1 parent 68ebb78 commit aa535dd
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 25 deletions.
6 changes: 5 additions & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
<version>4.1.0-incubating-SNAPSHOT</version>
</parent>


<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>rocketmq-client</artifactId>
<name>rocketmq-client ${project.version}</name>

<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume
/**
* Subscription relationship
*/
private Map<String /* topic */, String /* sub expression */> subscription = new HashMap<>();
private Map<String /* topic */, String /* sub expression */> subscription = new HashMap<String, String>();

/**
* Message listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,11 @@ private void unregisterClient(final String producerGroup, final String consumerG
try {
this.mQClientAPIImpl.unregisterClient(addr, this.clientId, producerGroup, consumerGroup, 3000);
log.info("unregister client[Producer: {} Consumer: {}] from broker[{} {} {}] success", producerGroup, consumerGroup, brokerName, entry1.getKey(), addr);
} catch (RemotingException | InterruptedException | MQBrokerException e) {
} catch (RemotingException e) {
log.error("unregister client exception from broker: " + addr, e);
} catch (InterruptedException e) {
log.error("unregister client exception from broker: " + addr, e);
} catch (MQBrokerException e) {
log.error("unregister client exception from broker: " + addr, e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testPullMessage_Success() throws Exception {
assertThat(pullResult.getNextBeginOffset()).isEqualTo(1024 + 1);
assertThat(pullResult.getMinOffset()).isEqualTo(123);
assertThat(pullResult.getMaxOffset()).isEqualTo(2048);
assertThat(pullResult.getMsgFoundList()).isEqualTo(new ArrayList<>());
assertThat(pullResult.getMsgFoundList()).isEqualTo(new ArrayList<Object>());
}

@Test
Expand Down Expand Up @@ -137,7 +137,7 @@ public void testPullMessageAsync_Success() throws Exception {
assertThat(pullResult.getNextBeginOffset()).isEqualTo(1024 + 1);
assertThat(pullResult.getMinOffset()).isEqualTo(123);
assertThat(pullResult.getMaxOffset()).isEqualTo(2048);
assertThat(pullResult.getMsgFoundList()).isEqualTo(new ArrayList<>());
assertThat(pullResult.getMsgFoundList()).isEqualTo(new ArrayList<Object>());
}

@Override public void onException(Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void init() throws Exception {

doReturn(new FindBrokerResult("127.0.0.1:10911", false)).when(mQClientFactory).findBrokerAddressInSubscribe(anyString(), anyLong(), anyBoolean());
doReturn(Collections.singletonList(mQClientFactory.getClientId())).when(mQClientFactory).findConsumerIdList(anyString(), anyString());
Set<MessageQueue> messageQueueSet = new HashSet<>();
Set<MessageQueue> messageQueueSet = new HashSet<MessageQueue>();
messageQueueSet.add(createPullRequest().getMessageQueue());
pushConsumer.getDefaultMQPushConsumerImpl().updateTopicSubscribeInfo(topic, messageQueueSet);
doReturn(123L).when(rebalancePushImpl).computePullFromWhere(any(MessageQueue.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testReadOffset_FromStore() throws Exception {
offsetStore.updateOffset(messageQueue, 1024, false);
assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(-1);

offsetStore.persistAll(new HashSet<>(Collections.singletonList(messageQueue)));
offsetStore.persistAll(new HashSet<MessageQueue>(Collections.singletonList(messageQueue)));
assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1024);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void testReadOffset_Success() throws Exception {
assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1023);

offsetStore.updateOffset(messageQueue, 1025, false);
offsetStore.persistAll(new HashSet<>(Collections.singletonList(messageQueue)));
offsetStore.persistAll(new HashSet<MessageQueue>(Collections.singletonList(messageQueue)));
assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1025);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ public void testTopicRouteData2TopicPublishInfo() {
TopicRouteData topicRouteData = new TopicRouteData();

topicRouteData.setFilterServerTable(new HashMap<String, List<String>>());
List<BrokerData> brokerDataList = new ArrayList<>();
List<BrokerData> brokerDataList = new ArrayList<BrokerData>();
BrokerData brokerData = new BrokerData();
brokerData.setBrokerName("BrokerA");
brokerData.setCluster("DefaultCluster");
HashMap<Long, String> brokerAddrs = new HashMap<>();
HashMap<Long, String> brokerAddrs = new HashMap<Long, String>();
brokerAddrs.put(0L, "127.0.0.1:10911");
brokerData.setBrokerAddrs(brokerAddrs);
brokerDataList.add(brokerData);
topicRouteData.setBrokerDatas(brokerDataList);

List<QueueData> queueDataList = new ArrayList<>();
List<QueueData> queueDataList = new ArrayList<QueueData>();
QueueData queueData = new QueueData();
queueData.setBrokerName("BrokerA");
queueData.setPerm(6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,17 @@ public static TopicRouteData createTopicRoute() {
TopicRouteData topicRouteData = new TopicRouteData();

topicRouteData.setFilterServerTable(new HashMap<String, List<String>>());
List<BrokerData> brokerDataList = new ArrayList<>();
List<BrokerData> brokerDataList = new ArrayList<BrokerData>();
BrokerData brokerData = new BrokerData();
brokerData.setBrokerName("BrokerA");
brokerData.setCluster("DefaultCluster");
HashMap<Long, String> brokerAddrs = new HashMap<>();
HashMap<Long, String> brokerAddrs = new HashMap<Long, String>();
brokerAddrs.put(0L, "127.0.0.1:10911");
brokerData.setBrokerAddrs(brokerAddrs);
brokerDataList.add(brokerData);
topicRouteData.setBrokerDatas(brokerDataList);

List<QueueData> queueDataList = new ArrayList<>();
List<QueueData> queueDataList = new ArrayList<QueueData>();
QueueData queueData = new QueueData();
queueData.setBrokerName("BrokerA");
queueData.setPerm(6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testSelect() throws Exception {

Message message = new Message(topic, new byte[] {});

List<MessageQueue> messageQueues = new ArrayList<>();
List<MessageQueue> messageQueues = new ArrayList<MessageQueue>();
for (int i = 0; i < 10; i++) {
MessageQueue messageQueue = new MessageQueue(topic, "DefaultBroker", i);
messageQueues.add(messageQueue);
Expand Down
4 changes: 4 additions & 0 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<artifactId>rocketmq-common</artifactId>
<name>rocketmq-common ${project.version}</name>

<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>

<dependencies>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/org/apache/rocketmq/common/MixAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public static void printObjectProperties(final Logger log, final Object object,
if (null == value) {
value = "";
}
} catch (IllegalArgumentException | IllegalAccessException e) {
} catch (IllegalAccessException e) {
e.printStackTrace();
}

Expand Down Expand Up @@ -313,7 +313,7 @@ public static Properties object2Properties(final Object object) {
try {
field.setAccessible(true);
value = field.get(object);
} catch (IllegalArgumentException | IllegalAccessException e) {
} catch (IllegalAccessException e) {
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public void testFile2String() throws IOException {
file.delete();
}
file.createNewFile();
try (PrintWriter out = new PrintWriter(fileName)) {
out.write("TestForMixAll");
}
PrintWriter out = new PrintWriter(fileName);
out.write("TestForMixAll");
out.close();
String string = MixAll.file2String(fileName);
assertThat(string).isEqualTo("TestForMixAll");
file.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void testBuildSubscriptionData() throws Exception {
assertThat(subscriptionData.getTopic()).isEqualTo(topic);
assertThat(subscriptionData.getSubString()).isEqualTo(subString);
String [] tags = subString.split("\\|\\|");
Set<String> tagSet = new HashSet<>();
Set<String> tagSet = new HashSet<String>();
for (String tag : tags) {
tagSet.add(tag.trim());
}
Expand Down
4 changes: 4 additions & 0 deletions remoting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<artifactId>rocketmq-remoting</artifactId>
<name>rocketmq-remoting ${project.version}</name>

<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti
private final Bootstrap bootstrap = new Bootstrap();
private final EventLoopGroup eventLoopGroupWorker;
private final Lock lockChannelTables = new ReentrantLock();
private final ConcurrentHashMap<String /* addr */, ChannelWrapper> channelTables = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String /* addr */, ChannelWrapper> channelTables = new ConcurrentHashMap<String, ChannelWrapper>();

private final Timer timer = new Timer("ClientHouseKeepingService", true);

private final AtomicReference<List<String>> namesrvAddrList = new AtomicReference<>();
private final AtomicReference<String> namesrvAddrChoosed = new AtomicReference<>();
private final AtomicReference<List<String>> namesrvAddrList = new AtomicReference<List<String>>();
private final AtomicReference<String> namesrvAddrChoosed = new AtomicReference<String>();
private final AtomicInteger namesrvIndex = new AtomicInteger(initValueIndex());
private final Lock lockNamesrvChannel = new ReentrantLock();

Expand Down Expand Up @@ -522,7 +522,7 @@ public void registerProcessor(int requestCode, NettyRequestProcessor processor,
executorThis = this.publicExecutor;
}

Pair<NettyRequestProcessor, ExecutorService> pair = new Pair<>(processor, executorThis);
Pair<NettyRequestProcessor, ExecutorService> pair = new Pair<NettyRequestProcessor, ExecutorService>(processor, executorThis);
this.processorTable.put(requestCode, pair);
}

Expand Down

0 comments on commit aa535dd

Please sign in to comment.