Class DefaultCloseableService
java.lang.Object
org.glassfish.jersey.server.internal.process.DefaultCloseableService
- All Implemented Interfaces:
CloseableService
Default implementation of
CloseableService
.
This implementation stores instances of Closeable
in an internal identity hash set and makes sure
that the close method is invoked at most once.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
LOGGER
-
closed
-
closeables
-
-
Constructor Details
-
DefaultCloseableService
DefaultCloseableService()
-
-
Method Details
-
add
Description copied from interface:CloseableService
Register a new instance ofCloseable
that is to be closed when the request goes out of scope.After
CloseableService.close()
has been called, this method will not accept any new instance registrations and will returnfalse
instead.- Specified by:
add
in interfaceCloseableService
- Parameters:
closeable
- the instance ofCloseable
.- Returns:
true
if the closeable service has not been closed yet and the closeable instance was successfully registered with the service,false
otherwise.
-
close
public void close()Description copied from interface:CloseableService
InvokesCloseable#close()
method on all instances ofCloseable
added by the#add(Closeable)
method. Subsequent calls of this method should not do anything.- Specified by:
close
in interfaceCloseableService
-