File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed
jsonurl-factory/src/main/java/org/jsonurl
jsonurl-jsonorg/src/main/java/org/jsonurl/jsonorg
jsonurl-jsr374/src/main/java/org/jsonurl/jsonp Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 2727
2828/**
2929 * Concrete implementation of {@link Parser}.
30+ *
31+ * <h2>Concurrency</h2>
32+ *
33+ * <p>Each instance of {@code ValueFactoryParser} stores references to a
34+ * {@link ValueFactory},
35+ * a set of {@link org.jsonurl.JsonUrlOption JsonUrlOptions},
36+ * and {@linkplain org.jsonurl.JsonUrlLimits JsonUrlLimits}.
37+ * The state of each call to the {@link #parse(CharSequence)} method (or one
38+ * of its variants) is local. That means it is technically safe to reuse a
39+ * {@code ValueFactoryParser} across multiple threads. However, the parser does
40+ * provide access to its set of {@link #options()}, via a reference to a
41+ * mutable set. That means that it's possible to change the set by doing
42+ * something like:
43+ * <pre>JsonUrlParser p = ...;
44+ *p.options().add(JsonUrlOption.SKIP_NULLS);</pre>
45+ * Therefore, reusing a {@code ValueFactoryParser} is not recommended.
46+ * Because this object it so lightweight, and you're unlikely to realize any
47+ * real world benefit, you're better off simply creating a new instance each
48+ * time you need one.
3049 * @author jsonurl.org
3150 * @author David MacCormack
3251 * @since 2019-09-01
Original file line number Diff line number Diff line change 2828/**
2929 * A {@link org.jsonurl.factory.Parser Parser} bound to Java SE data types.
3030 *
31+ * <p>See {@link org.jsonurl.factory.ValueFactoryParser ValueFactoryParser}
32+ * for a note regarding concurrency.
33+ *
3134 * @author jsonurl.org
3235 * @author David MacCormack
3336 * @since 2019-09-01
Original file line number Diff line number Diff line change 2929 * A <a href="https://jsonurl.org/">JSON→URL</a> parser bound to
3030 * Douglas Crockford's original Java implementation of JSON.
3131 *
32+ * <p>See {@link org.jsonurl.factory.ValueFactoryParser ValueFactoryParser}
33+ * for a note regarding concurrency.
34+ *
3235 * @author jsonurl.org
3336 * @author David MacCormack
3437 * @since 2019-09-01
Original file line number Diff line number Diff line change 3535 * A <a href="https://jsonurl.org/">JSON→URL</a> parser bound to the
3636 * JSON-P interface defined by JSR-374.
3737 *
38+ * <p>See {@link org.jsonurl.factory.ValueFactoryParser ValueFactoryParser}
39+ * for a note regarding concurrency.
40+ *
3841 * @author jsonurl.org
3942 * @author David MacCormack
4043 * @since 2019-09-01
You can’t perform that action at this time.
0 commit comments