Fixed backporting errors and lombok license (#1752)
diff --git a/all/licenses/LICENSE-Lombok.txt b/all/licenses/LICENSE-Lombok.txt
new file mode 100644
index 0000000..5da7dbe
--- /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 944ba2d..b5e7db8 100644
--- a/all/src/assemble/LICENSE.bin.txt
+++ b/all/src/assemble/LICENSE.bin.txt
@@ -348,6 +348,7 @@
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 16b1eca..9043897 100644
--- a/pom.xml
+++ b/pom.xml
@@ -592,6 +592,13 @@
<artifactId>powermock-module-testng</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.16.20</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
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 b8e4ae0..547f914 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.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 @@
// 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 @@
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 3929c48..f7301ed 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 @@
// Force to create a topic
final String namespace = "prop-xyz/use/ns1";
final String topicName = (new StringBuilder("persistent://")).append(namespace).append("/ds2").toString();
- Producer<byte[]> 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));