diff --git a/client/pom.xml b/client/pom.xml index 7c952ac44e157a92ea266ae7bf322ed95d722f87..24d0a54b029e9698099e0672ab612cec96afff37 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -22,12 +22,16 @@ 4.1.0-incubating-SNAPSHOT - 4.0.0 jar rocketmq-client rocketmq-client ${project.version} + + 1.6 + 1.6 + + ${project.groupId} diff --git a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java index 2cce03d347389c4b23476c8886664b5975a1f6ae..3903fe2b4f83c99ce553d14070497324584386db 100644 --- a/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java +++ b/client/src/main/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumer.java @@ -133,7 +133,7 @@ public class DefaultMQPushConsumer extends ClientConfig implements MQPushConsume /** * Subscription relationship */ - private Map subscription = new HashMap<>(); + private Map subscription = new HashMap(); /** * Message listener diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java index 1343e7639b67daa6faa4766bbc54b61a7914abfd..ebcfb62614d509fc351567f25639f446329a63c4 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java @@ -842,7 +842,11 @@ public class MQClientInstance { 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); } } diff --git a/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java b/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java index 6672b1e88d6d9aa5a7fc61a7d76d07cda866bc67..33142617d0d3d533a4f5b0e090a35e84f9bcf90b 100644 --- a/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPullConsumerTest.java @@ -99,7 +99,7 @@ public class DefaultMQPullConsumerTest { 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()); } @Test @@ -137,7 +137,7 @@ public class DefaultMQPullConsumerTest { 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()); } @Override public void onException(Throwable e) { diff --git a/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumerTest.java b/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumerTest.java index 2e0af5affdd074ae9a94a1c52eb1a07019fcb7d5..cdf1d7800363d434f71b9423b8c5aab34ea0c6d8 100644 --- a/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumerTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/consumer/DefaultMQPushConsumerTest.java @@ -143,7 +143,7 @@ public class DefaultMQPushConsumerTest { 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 messageQueueSet = new HashSet<>(); + Set messageQueueSet = new HashSet(); messageQueueSet.add(createPullRequest().getMessageQueue()); pushConsumer.getDefaultMQPushConsumerImpl().updateTopicSubscribeInfo(topic, messageQueueSet); doReturn(123L).when(rebalancePushImpl).computePullFromWhere(any(MessageQueue.class)); diff --git a/client/src/test/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStoreTest.java b/client/src/test/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStoreTest.java index bf0adcb435aaeb072a1e0d9839ac647f4d8f84a3..22e212b33634c4086bc02c83da349d60872e0638 100644 --- a/client/src/test/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStoreTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/consumer/store/LocalFileOffsetStoreTest.java @@ -69,7 +69,7 @@ public class LocalFileOffsetStoreTest { 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(Collections.singletonList(messageQueue))); assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1024); } } \ No newline at end of file diff --git a/client/src/test/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStoreTest.java b/client/src/test/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStoreTest.java index a13930fdea9755328152bacb541a4bc800a1fefc..81c394c448f2b81a5b1836cdb319c0cfec98bbef 100644 --- a/client/src/test/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStoreTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/consumer/store/RemoteBrokerOffsetStoreTest.java @@ -119,7 +119,7 @@ public class RemoteBrokerOffsetStoreTest { 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(Collections.singletonList(messageQueue))); assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_STORE)).isEqualTo(1025); } diff --git a/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java b/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java index eedf0b183efa693cdafda1053ee4d16d02d0896e..7e0b4f934d532779338d1de47582d33e4b75f5bd 100644 --- a/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/impl/factory/MQClientInstanceTest.java @@ -48,17 +48,17 @@ public class MQClientInstanceTest { TopicRouteData topicRouteData = new TopicRouteData(); topicRouteData.setFilterServerTable(new HashMap>()); - List brokerDataList = new ArrayList<>(); + List brokerDataList = new ArrayList(); BrokerData brokerData = new BrokerData(); brokerData.setBrokerName("BrokerA"); brokerData.setCluster("DefaultCluster"); - HashMap brokerAddrs = new HashMap<>(); + HashMap brokerAddrs = new HashMap(); brokerAddrs.put(0L, "127.0.0.1:10911"); brokerData.setBrokerAddrs(brokerAddrs); brokerDataList.add(brokerData); topicRouteData.setBrokerDatas(brokerDataList); - List queueDataList = new ArrayList<>(); + List queueDataList = new ArrayList(); QueueData queueData = new QueueData(); queueData.setBrokerName("BrokerA"); queueData.setPerm(6); diff --git a/client/src/test/java/org/apache/rocketmq/client/producer/DefaultMQProducerTest.java b/client/src/test/java/org/apache/rocketmq/client/producer/DefaultMQProducerTest.java index eddd3806c8513151d4033e369030344ec9dd9af2..2f035e0fca21b3ff216621a9938dce6f106c500c 100644 --- a/client/src/test/java/org/apache/rocketmq/client/producer/DefaultMQProducerTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/producer/DefaultMQProducerTest.java @@ -194,17 +194,17 @@ public class DefaultMQProducerTest { TopicRouteData topicRouteData = new TopicRouteData(); topicRouteData.setFilterServerTable(new HashMap>()); - List brokerDataList = new ArrayList<>(); + List brokerDataList = new ArrayList(); BrokerData brokerData = new BrokerData(); brokerData.setBrokerName("BrokerA"); brokerData.setCluster("DefaultCluster"); - HashMap brokerAddrs = new HashMap<>(); + HashMap brokerAddrs = new HashMap(); brokerAddrs.put(0L, "127.0.0.1:10911"); brokerData.setBrokerAddrs(brokerAddrs); brokerDataList.add(brokerData); topicRouteData.setBrokerDatas(brokerDataList); - List queueDataList = new ArrayList<>(); + List queueDataList = new ArrayList(); QueueData queueData = new QueueData(); queueData.setBrokerName("BrokerA"); queueData.setPerm(6); diff --git a/client/src/test/java/org/apache/rocketmq/client/producer/selector/SelectMessageQueueByHashTest.java b/client/src/test/java/org/apache/rocketmq/client/producer/selector/SelectMessageQueueByHashTest.java index 64ef21de7f2f3e5a2495676dd63ca3352b552ace..056e910bb806732de9aa1d51804c7097fb7d0511 100644 --- a/client/src/test/java/org/apache/rocketmq/client/producer/selector/SelectMessageQueueByHashTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/producer/selector/SelectMessageQueueByHashTest.java @@ -34,7 +34,7 @@ public class SelectMessageQueueByHashTest { Message message = new Message(topic, new byte[] {}); - List messageQueues = new ArrayList<>(); + List messageQueues = new ArrayList(); for (int i = 0; i < 10; i++) { MessageQueue messageQueue = new MessageQueue(topic, "DefaultBroker", i); messageQueues.add(messageQueue); diff --git a/common/pom.xml b/common/pom.xml index c2ab18797bb6ead52928974b2187dac724571b41..835ffa63ba078a3931ef9906b9b57264661ffbdc 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -27,6 +27,10 @@ rocketmq-common rocketmq-common ${project.version} + + 1.6 + 1.6 + diff --git a/common/src/main/java/org/apache/rocketmq/common/MixAll.java b/common/src/main/java/org/apache/rocketmq/common/MixAll.java index cbb395a0cc8032f57b8bc9a91e89c2b7793b9ccc..4a54a602a3cb77a0a15c3cbd31d19ac789f92b44 100644 --- a/common/src/main/java/org/apache/rocketmq/common/MixAll.java +++ b/common/src/main/java/org/apache/rocketmq/common/MixAll.java @@ -256,7 +256,7 @@ public class MixAll { if (null == value) { value = ""; } - } catch (IllegalArgumentException | IllegalAccessException e) { + } catch (IllegalAccessException e) { e.printStackTrace(); } @@ -313,7 +313,7 @@ public class MixAll { try { field.setAccessible(true); value = field.get(object); - } catch (IllegalArgumentException | IllegalAccessException e) { + } catch (IllegalAccessException e) { e.printStackTrace(); } diff --git a/common/src/test/java/org/apache/rocketmq/common/MixAllTest.java b/common/src/test/java/org/apache/rocketmq/common/MixAllTest.java index 06024c3557787482ec0aafc04db8c20e5c03cda6..8220981e51dd382f4eb6d58535dec3befbfad05d 100644 --- a/common/src/test/java/org/apache/rocketmq/common/MixAllTest.java +++ b/common/src/test/java/org/apache/rocketmq/common/MixAllTest.java @@ -59,9 +59,9 @@ public class MixAllTest { 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(); diff --git a/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java b/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java index 097a01cb06e67e3c2cbfc4f9133fc000eedee4c6..5137f3282ee91cc61a55336a9bb47d11cc0b2b34 100644 --- a/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java +++ b/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java @@ -36,7 +36,7 @@ public class FilterAPITest { assertThat(subscriptionData.getTopic()).isEqualTo(topic); assertThat(subscriptionData.getSubString()).isEqualTo(subString); String [] tags = subString.split("\\|\\|"); - Set tagSet = new HashSet<>(); + Set tagSet = new HashSet(); for (String tag : tags) { tagSet.add(tag.trim()); } diff --git a/remoting/pom.xml b/remoting/pom.xml index b25e06238d35a9424522bd6d5405b84917fcc862..1552341230cab6fb2324e7ed9022270e8b5097b6 100644 --- a/remoting/pom.xml +++ b/remoting/pom.xml @@ -27,6 +27,10 @@ rocketmq-remoting rocketmq-remoting ${project.version} + + 1.6 + 1.6 + diff --git a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java index d84f2a8188b79344806bf00e1ed96c735b3e80df..85f9244d2d08e585efd4e0f9d81d693d0dd00d01 100644 --- a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java +++ b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java @@ -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 channelTables = new ConcurrentHashMap<>(); + private final ConcurrentHashMap channelTables = new ConcurrentHashMap(); private final Timer timer = new Timer("ClientHouseKeepingService", true); - private final AtomicReference> namesrvAddrList = new AtomicReference<>(); - private final AtomicReference namesrvAddrChoosed = new AtomicReference<>(); + private final AtomicReference> namesrvAddrList = new AtomicReference>(); + private final AtomicReference namesrvAddrChoosed = new AtomicReference(); private final AtomicInteger namesrvIndex = new AtomicInteger(initValueIndex()); private final Lock lockNamesrvChannel = new ReentrantLock(); @@ -522,7 +522,7 @@ public class NettyRemotingClient extends NettyRemotingAbstract implements Remoti executorThis = this.publicExecutor; } - Pair pair = new Pair<>(processor, executorThis); + Pair pair = new Pair(processor, executorThis); this.processorTable.put(requestCode, pair); }