Skip to content

Commit

Permalink
Don't create a separate ObjectMapper all the time, as it's thread safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekim committed Apr 8, 2011
1 parent 1ddb848 commit dae0b5e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
public class Configuration {
private Node node;
private Jdbc jdbc;
private static final ObjectMapper mapper;

static {
mapper = new ObjectMapper();
}

public static Configuration parseJson(String json) {
try {
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(json, Configuration.class);
} catch (JsonParseException exception) {
throw new NodeJdbcException("Failed to parse JSON " + json, exception);
Expand Down

0 comments on commit dae0b5e

Please sign in to comment.