ICloseable Interface

public interface ICloseable

Defines a standard way of properly closing and disposing objects.

Method Summary

Modifier and Type Method and Description
abstract void close()

Synchronously closes and disposes any resources associated with this object.

abstract CompletableFuture<Void> closeAsync()

Closes and disposes any resources associated with this object.

Method Details

close

public abstract void close()

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.

closeAsync

public abstract CompletableFuture 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.

Applies to