Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
Expand Down Expand Up @@ -52,12 +54,14 @@ public NonPersistentTopicsImpl(WebTarget web, Authentication auth, long readTime
@Override
public void createPartitionedTopic(String topic, int numPartitions) throws PulsarAdminException {
try {
createPartitionedTopicAsync(topic, numPartitions).get();
createPartitionedTopicAsync(topic, numPartitions).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -72,12 +76,14 @@ public CompletableFuture<Void> createPartitionedTopicAsync(String topic, int num
@Override
public PartitionedTopicMetadata getPartitionedTopicMetadata(String topic) throws PulsarAdminException {
try {
return getPartitionedTopicMetadataAsync(topic).get();
return getPartitionedTopicMetadataAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down Expand Up @@ -105,12 +111,14 @@ public void failed(Throwable throwable) {
@Override
public NonPersistentTopicStats getStats(String topic) throws PulsarAdminException {
try {
return getStatsAsync(topic).get();
return getStatsAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down Expand Up @@ -138,12 +146,14 @@ public void failed(Throwable throwable) {
@Override
public PersistentTopicInternalStats getInternalStats(String topic) throws PulsarAdminException {
try {
return getInternalStatsAsync(topic).get();
return getInternalStatsAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down Expand Up @@ -171,12 +181,14 @@ public void failed(Throwable throwable) {
@Override
public void unload(String topic) throws PulsarAdminException {
try {
unloadAsync(topic).get();
unloadAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -190,12 +202,14 @@ public CompletableFuture<Void> unloadAsync(String topic) {
@Override
public List<String> getListInBundle(String namespace, String bundleRange) throws PulsarAdminException {
try {
return getListInBundleAsync(namespace, bundleRange).get();
return getListInBundleAsync(namespace, bundleRange).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -221,12 +235,14 @@ public void failed(Throwable throwable) {
@Override
public List<String> getList(String namespace) throws PulsarAdminException {
try {
return getListAsync(namespace).get();
return getListAsync(namespace).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ public List<String> getPartitionedTopicList(String namespace) throws PulsarAdmin
@Override
public List<String> getListInBundle(String namespace, String bundleRange) throws PulsarAdminException {
try {
return getListInBundleAsync(namespace, bundleRange).get();
return getListInBundleAsync(namespace, bundleRange).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down Expand Up @@ -197,24 +199,28 @@ public void revokePermissions(String topic, String role) throws PulsarAdminExcep
@Override
public void createPartitionedTopic(String topic, int numPartitions) throws PulsarAdminException {
try {
createPartitionedTopicAsync(topic, numPartitions).get();
createPartitionedTopicAsync(topic, numPartitions).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

@Override
public void createNonPartitionedTopic(String topic) throws PulsarAdminException {
try {
createNonPartitionedTopicAsync(topic).get();
createNonPartitionedTopicAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -236,12 +242,14 @@ public CompletableFuture<Void> createPartitionedTopicAsync(String topic, int num
@Override
public void updatePartitionedTopic(String topic, int numPartitions) throws PulsarAdminException {
try {
updatePartitionedTopicAsync(topic, numPartitions).get();
updatePartitionedTopicAsync(topic, numPartitions).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -256,12 +264,14 @@ public CompletableFuture<Void> updatePartitionedTopicAsync(String topic, int num
@Override
public PartitionedTopicMetadata getPartitionedTopicMetadata(String topic) throws PulsarAdminException {
try {
return getPartitionedTopicMetadataAsync(topic).get();
return getPartitionedTopicMetadataAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down Expand Up @@ -294,12 +304,14 @@ public void deletePartitionedTopic(String topic) throws PulsarAdminException {
@Override
public void deletePartitionedTopic(String topic, boolean force) throws PulsarAdminException {
try {
deletePartitionedTopicAsync(topic, force).get();
deletePartitionedTopicAsync(topic, force).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -319,12 +331,14 @@ public void delete(String topic) throws PulsarAdminException {
@Override
public void delete(String topic, boolean force) throws PulsarAdminException {
try {
deleteAsync(topic, force).get();
deleteAsync(topic, force).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -339,12 +353,14 @@ public CompletableFuture<Void> deleteAsync(String topic, boolean force) {
@Override
public void unload(String topic) throws PulsarAdminException {
try {
unloadAsync(topic).get();
unloadAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand All @@ -358,12 +374,14 @@ public CompletableFuture<Void> unloadAsync(String topic) {
@Override
public List<String> getSubscriptions(String topic) throws PulsarAdminException {
try {
return getSubscriptionsAsync(topic).get();
return getSubscriptionsAsync(topic).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down Expand Up @@ -595,12 +613,14 @@ public CompletableFuture<Void> deleteSubscriptionAsync(String topic, String subN
@Override
public void skipAllMessages(String topic, String subName) throws PulsarAdminException {
try {
skipAllMessagesAsync(topic, subName).get();
skipAllMessagesAsync(topic, subName).get(this.readTimeoutMs, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw (PulsarAdminException) e.getCause();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarAdminException(e);
} catch (TimeoutException e) {
throw new PulsarAdminException.TimeoutException(e);
}
}

Expand Down