com.microsoft.azure.servicebus.ICloseable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-servicebus Show documentation
Show all versions of azure-servicebus Show documentation
Java library for Azure Service Bus. Please note, a newer package com.azure:azure-messaging-servicebus for Azure Service Bus is available as of December 2020. While this package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Read the migration guide at https://aka.ms/azsdk/java/migrate/sb for more details.
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package com.microsoft.azure.servicebus;
import java.util.concurrent.CompletableFuture;
import com.microsoft.azure.servicebus.primitives.ServiceBusException;
/**
* Defines a standard way of properly closing and disposing objects.
* @since 1.0
*
*/
public interface ICloseable {
/**
* 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.
* @return a CompletableFuture representing the closing of this object.
*/
CompletableFuture closeAsync();
/**
* Synchronously closes and disposes any resources associated with this object. Calling this method is equivalent of calling closeAsync().get()
. This method blocks until this object is closed.
* @throws ServiceBusException If this object cannot be properly closed.
*/
void close() throws ServiceBusException;
}