Class CloseableRequestResources

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class CloseableRequestResources
    extends Object
    implements Closeable
    A QueryOption that allows to keep track of query resources which were opened to process a request and which need to be closed when processing of the request is finished.

    The add(Closeable) method is used to add Closeable objects to this object. Then when processing the request has finished (often when ResultSet.close() is called), the engine will retrieve this object from the query options and call the close() method on this object, which will close all resources which had been added.

    Author:
    Silvano Riz
    • Constructor Detail

      • CloseableRequestResources

        public CloseableRequestResources()
    • Method Detail

      • add

        public void add​(Closeable closeable)
        Add a new resource that needs to be closed.
        Parameters:
        closeable - The resource that needs to be closed
      • close

        public void close()
        Close and removes all resources and resource groups which have been added so far.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
      • closeForQueryOptions

        public static void closeForQueryOptions​(QueryOptions queryOptions)
        Closes an existing CloseableRequestResources if one is stored the QueryOptions and then removes it from the QueryOptions.
        Parameters:
        queryOptions - The QueryOptions
      • closeQuietly

        public static void closeQuietly​(Closeable closeable)