Warning
Resource classes are used by multiple threads concurrently. In general, we recommend that resources be stateless/immutable, but it’s important to keep the context in mind.
--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
But does this imply that I need to have a lock around each method body in my resources? If it uses the same instance of the class it would imply that the following is not safe to use:
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<String> getStuff() throws Exception {
List<String> stuff = new ArrayList<String>();
stuff.add("SomeStuff");
stuff.add("SomeStuff2");
stuff.add("SomeStuff3");
return stuff;
}
Is that the case? If not how is the instance of the class shared without sharing the instances' methods?