From 0093a8024f2be1aea8d85406dca403c3ef01e17c Mon Sep 17 00:00:00 2001 From: Jai Asher Date: Wed, 9 May 2018 00:46:17 -0700 Subject: [PATCH] Fixed backporting errors and lombok license (#1752) --- all/licenses/LICENSE-Lombok.txt | 19 +++++++++++++++++++ all/src/assemble/LICENSE.bin.txt | 1 + pom.xml | 7 +++++++ .../broker/namespace/NamespaceService.java | 13 +++++++++---- .../pulsar/broker/admin/AdminApiTest.java | 2 +- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 all/licenses/LICENSE-Lombok.txt diff --git a/all/licenses/LICENSE-Lombok.txt b/all/licenses/LICENSE-Lombok.txt new file mode 100644 index 00000000000..5da7dbeff38 --- /dev/null +++ b/all/licenses/LICENSE-Lombok.txt @@ -0,0 +1,19 @@ +Copyright (C) 2009-2015 The Project Lombok Authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/all/src/assemble/LICENSE.bin.txt b/all/src/assemble/LICENSE.bin.txt index 944ba2d1a6f..b5e7db8707f 100644 --- a/all/src/assemble/LICENSE.bin.txt +++ b/all/src/assemble/LICENSE.bin.txt @@ -348,6 +348,7 @@ BSD License MIT License * Java SemVer -- com.github.zafarkhaja-java-semver-*.jar -- licenses/LICENSE-SemVer.txt * SLF4J -- org.slf4j.*.jar -- licenses/LICENSE-SLF4J.txt + * Lombok -- org.projectlombok-*.jar -- licenses/LICENSE-Lombok.txt Protocol Buffers License * Protocol Buffers -- com.google.protobuf-*.jar -- licenses/LICENSE-protobuf.txt diff --git a/pom.xml b/pom.xml index 16b1ecaaa69..9043897643a 100644 --- a/pom.xml +++ b/pom.xml @@ -592,6 +592,13 @@ flexible messaging model and an intuitive client API. powermock-module-testng test + + + org.projectlombok + lombok + 1.16.20 + provided + diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java index b8e4ae0e58b..547f914a6cb 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java @@ -42,6 +42,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import org.apache.bookkeeper.util.SafeRunnable; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.pulsar.broker.PulsarServerException; @@ -632,12 +633,16 @@ public class NamespaceService { // If success updateNamespaceBundles, then do invalidateBundleCache and unload. // Else retry splitAndOwnBundleOnceAndRetry. - updateFuture.whenCompleteAsync((r, t)-> { + updateFuture.whenComplete((r, t)-> { if (t != null) { // retry several times on BadVersion if ((t instanceof ServerMetadataException) && (counter.decrementAndGet() >= 0)) { - pulsar.getOrderedExecutor().submit( - () -> splitAndOwnBundleOnceAndRetry(bundle, unload, counter, unloadFuture)); + pulsar.getOrderedExecutor().submit(new SafeRunnable() { + @Override + public void safeRun() { + splitAndOwnBundleOnceAndRetry(bundle, unload, counter, unloadFuture); + } + }); } else { // Retry enough, or meet other exception String msg2 = format(" %s not success update nsBundles, counter %d, reason %s", @@ -678,7 +683,7 @@ public class NamespaceService { unloadFuture.completeExceptionally(new ServiceUnitNotReadyException(msg1)); } return; - }, pulsar.getOrderedExecutor()); + }); } /** diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java index 3929c4855ed..f7301edbd35 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java @@ -924,7 +924,7 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest { // Force to create a topic final String namespace = "prop-xyz/use/ns1"; final String topicName = (new StringBuilder("persistent://")).append(namespace).append("/ds2").toString(); - Producer producer = pulsarClient.newProducer().topic(topicName).create(); + Producer producer = pulsarClient.createProducer(topicName); producer.send("message".getBytes()); publishMessagesOnPersistentTopic(topicName, 0); assertEquals(admin.persistentTopics().getList(namespace), Lists.newArrayList(topicName)); -- GitLab