IClosable

Interface that allows you to create a component with a method that closes it and frees used resources.

Description

The IClosable interface allows you to create a component with a method that closes it and frees used resources.

Instance methods

close

Closes a component and frees used resources.

void close(IContext context)

  • context: IContext - (optional) execution context to trace execution through call chain.

Examples

class MyConnector implements IClosable {
    private Object client = null;
    
    ... // The client can be lazy created
    
    public void close(String traceId) {
        if (this.client != null) {
            this.client.close();
            this.client = null;
        }
    }
}

See also