users@jsonb-spec.java.net

[jsonb-spec users] concurrency capabilities of JsonP/B parts

From: Mark Struberg <struberg_at_yahoo.de>
Date: Fri, 25 Mar 2016 08:53:27 +0100

Hi!

While looking at a few tests I asked myself whether those instances are allowed to be used in concurrent requests.


       JsonbConfig config = new JsonbConfig();
       config.withAdapters(new AnimalAdapter());
       Jsonb jsonb = JsonbBuilder.create(config);
       String json = jsonb.toJson(pojo);


Can I e.g. have an @ApplicationScoped CDI bean which creates a single Jsonb instance via @PostConstruct and then reuse this for parallel requests? Or Do I need a fresh JsonBuilder for each thread?

Not sure whether I simply missed that in the docs/api javadocs or if it’s not yet defined?

txs and LieGrue,
strub