Package org.glassfish.jersey.server
Interface CloseableService
-
public interface CloseableServiceA closeable service to add instances ofCloseablethat are required to be closed.This interface may be injected onto server-side components using the
Contextannotation.The service may be used within the scope of a request to add instances of
Closeablethat 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:
- Marek Potociar, Paul Sandoz
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanadd(Closeable c)Register a new instance ofCloseablethat is to be closed when the request goes out of scope.voidclose()
-
-
-
Method Detail
-
add
boolean add(Closeable c)
Register a new instance ofCloseablethat is to be closed when the request goes out of scope.After
close()has been called, this method will not accept any new instance registrations and will returnfalseinstead.- Parameters:
c- the instance ofCloseable.- Returns:
trueif the closeable service has not been closed yet and the closeable instance was successfully registered with the service,falseotherwise.
-
close
void close()
InvokesCloseable#close()method on all instances ofCloseableadded by the#add(Closeable)method. Subsequent calls of this method should not do anything.
-
-