Skip to content

Commit

Permalink
Added close method, #108
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Cailloux committed Dec 16, 2018
1 parent 431d4bd commit d689957
Showing 1 changed file with 13 additions and 6 deletions.
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;
}

0 comments on commit d689957

Please sign in to comment.