ICloseable Interface

public interface ICloseable

Defines a standard way of properly closing and disposing objects.

Method Summary

Modifier and Type Method and Description
void close()

Synchronously closes and disposes any resources associated with this object. Calling this method is equivalent of calling . This method blocks until this object is closed.

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.

Method Details

close

public void close()

Synchronously closes and disposes any resources associated with this object. Calling this method is equivalent of calling . This method blocks until this object is closed.

Throws:

ServiceBusException - If this object cannot be properly closed.

closeAsync

public 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