Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added close method, #108 #109

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions api/src/main/java/javax/json/bind/Jsonb.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@
*
* <p>All the methods in this class are safe for use by multiple concurrent threads.</p>
*
* <p>Calling {@code Closable.close()} method will cleanup all CDI managed components
* (such as adapters with CDI dependencies) created during interaction with Jsonb.
* Calling {@code close()} must be done after all threads has finished interaction with Jsonb.
* If there are remaining threads working with Jsonb and {@code close()} is called, behaviour is undefined.
* </p>
*
* @see Jsonb
* @see JsonbBuilder
* @see java.util.ServiceLoader
Expand Down Expand Up @@ -354,4 +348,17 @@ public interface Jsonb extends AutoCloseable {
* @since JSON Binding 1.0
*/
void toJson(Object object, Type runtimeType, OutputStream stream) throws JsonbException;

/**
* Closes this resource, relinquishing any underlying resources. In particular,
* cleans up all CDI managed components (such as adapters with CDI dependencies)
* created during interaction with Jsonb. {@code close()} must be called after
* all threads have finished interaction with Jsonb. If there are remaining
* threads working with Jsonb after {@code close()} has been called, behaviour
* is undefined.
*
* @throws JsonbException If any unexpected problem occurs during the close.
*/
@Override
void close() throws JsonbException;
}