Package com.microsoft.azure.servicebus
Interface ICloseable
-
- All Known Subinterfaces:
IMessageEntityClient
,IMessageReceiver
,IMessageSender
,IMessageSession
,IQueueClient
,ISubscriptionClient
,ITopicClient
- All Known Implementing Classes:
MessageSession
,QueueClient
,SubscriptionClient
,TopicClient
public interface ICloseable
Defines a standard way of properly closing and disposing objects.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Synchronously closes and disposes any resources associated with this object.CompletableFuture<Void>
closeAsync()
Closes and disposes any resources associated with this object.
-
-
-
Method Detail
-
closeAsync
CompletableFuture<Void> closeAsync()
Closes and disposes any resources associated with this object. An object cannot be used after it is closed. This is an asynchronous method that returns a CompletableFuture immediately. This object is completely closed when the returned CompletableFuture is completed.- Returns:
- a CompletableFuture representing the closing of this object.
-
close
void close() throws ServiceBusException
Synchronously closes and disposes any resources associated with this object. Calling this method is equivalent of callingcloseAsync().get()
. This method blocks until this object is closed.- Throws:
ServiceBusException
- If this object cannot be properly closed.
-
-