Skip to content

Commit

Permalink
Move isConnected method into each interface class (apache#1780)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsakai authored and merlimat committed May 15, 2018
1 parent b6f93f0 commit d7ab96d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,9 @@ public interface Consumer<T> extends Closeable {
* @return a future to track the completion of the seek operation
*/
CompletableFuture<Void> seekAsync(MessageId messageId);

/**
* @return Whether the consumer is connected to the broker
*/
boolean isConnected();
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,9 @@ public interface Producer<T> extends Closeable {
* @return a future that can used to track when the producer has been closed
*/
CompletableFuture<Void> closeAsync();

/**
* @return Whether the producer is connected to the broker
*/
boolean isConnected();
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,9 @@ public interface Reader<T> extends Closeable {
* Asynchronously Check if there is message that has been published successfully to the broker in the topic.
*/
CompletableFuture<Boolean> hasMessageAvailableAsync();

/**
* @return Whether the reader is connected to the broker
*/
boolean isConnected();
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ protected SubType getSubType() {
return null;
}

abstract public boolean isConnected();

abstract public int getAvailablePermits();

abstract public int numMessagesInQueue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ public void close() throws PulsarClientException {
@Override
abstract public CompletableFuture<Void> closeAsync();

abstract public boolean isConnected();

@Override
public String getTopic() {
return topic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,8 @@ public CompletableFuture<Boolean> hasMessageAvailableAsync() {
return consumer.hasMessageAvailableAsync();
}

@Override
public boolean isConnected() {
return consumer.isConnected();
}
}

0 comments on commit d7ab96d

Please sign in to comment.