Skip to content

Commit b6fb47b

Browse files
author
Olivier Cailloux
committed
Added close method, #108
Signed-off-by: Olivier Cailloux <olivier.cailloux@gmail.com>
1 parent 431d4bd commit b6fb47b

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

api/src/main/java/javax/json/bind/Jsonb.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@
9595
*
9696
* <p>All the methods in this class are safe for use by multiple concurrent threads.</p>
9797
*
98-
* <p>Calling {@code Closable.close()} method will cleanup all CDI managed components
99-
* (such as adapters with CDI dependencies) created during interaction with Jsonb.
100-
* Calling {@code close()} must be done after all threads has finished interaction with Jsonb.
101-
* If there are remaining threads working with Jsonb and {@code close()} is called, behaviour is undefined.
102-
* </p>
103-
*
10498
* @see Jsonb
10599
* @see JsonbBuilder
106100
* @see java.util.ServiceLoader
@@ -354,4 +348,17 @@ public interface Jsonb extends AutoCloseable {
354348
* @since JSON Binding 1.0
355349
*/
356350
void toJson(Object object, Type runtimeType, OutputStream stream) throws JsonbException;
351+
352+
/**
353+
* Closes this resource, relinquishing any underlying resources. In particular,
354+
* cleans up all CDI managed components (such as adapters with CDI dependencies)
355+
* created during interaction with Jsonb. {@code close()} must be called after
356+
* all threads have finished interaction with Jsonb. If there are remaining
357+
* threads working with Jsonb after {@code close()} has been called, behaviour
358+
* is undefined.
359+
*
360+
* @throws JsonbException If any unexpected problem occurs during the close.
361+
*/
362+
@Override
363+
void close() throws JsonbException;
357364
}

0 commit comments

Comments
 (0)