org.glassfish.jersey.server
Interface CloseableService


public interface CloseableService

A closeable service to add instances of Closeable that are required to be closed.

This interface may be injected onto server-side components using the Context annotation.

The service may be used within the scope of a request to add instances of Closeable that are to be closed when the request goes out of scope, more specifically after the request has been processed and the response has been returned.

Author:
Paul Sandoz (paul.sandoz at oracle.com)

Method Summary
 void add(Closeable c)
          Adds an instance of Closeable that is to be closed when the request goes out of scope.
 void close()
          Invokes Closeable#close() method on all instances of Closeable added by the #add(Closeable) method.
 

Method Detail

add

void add(Closeable c)
Adds an instance of Closeable that is to be closed when the request goes out of scope.

Parameters:
c - the instance of Closeable.

close

void close()
Invokes Closeable#close() method on all instances of Closeable added by the #add(Closeable) method. Subsequent calls of this method should not do anything.



Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.