HADOOP-15817. Reuse Object Mapper in KMSJSONReader. Contributed by Jonathan Eagles.
This commit is contained in:
parent
39b35036ba
commit
81f635f47f
|
@ -38,6 +38,7 @@ import java.util.Map;
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class KMSJSONReader implements MessageBodyReader<Object> {
|
public class KMSJSONReader implements MessageBodyReader<Object> {
|
||||||
|
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReadable(Class<?> type, Type genericType,
|
public boolean isReadable(Class<?> type, Type genericType,
|
||||||
|
@ -51,7 +52,6 @@ public class KMSJSONReader implements MessageBodyReader<Object> {
|
||||||
Annotation[] annotations, MediaType mediaType,
|
Annotation[] annotations, MediaType mediaType,
|
||||||
MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
|
MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
|
||||||
throws IOException, WebApplicationException {
|
throws IOException, WebApplicationException {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
return MAPPER.readValue(entityStream, type);
|
||||||
return mapper.readValue(entityStream, type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue