Skip to content

Commit

Permalink
jackson: performane improvements - static xmlutil and XmlMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
derTobsch committed Nov 11, 2024
1 parent 5f49bb6 commit 3ee13ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class JacksonConfigurationService implements ConfigurationService {

private final XMLUtil xmlUtil = new XMLUtil();
private static final XMLUtil xmlUtil = new XMLUtil();

@Override
public Configuration getConfiguration(ManagerParameter parameter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class XMLUtil {

private final JacksonMapperCreator mapper = new JacksonMapperCreator();
private static final XmlMapper mapper = new JacksonMapperCreator().create();

/**
* Unmarshalls the configuration from the stream. Uses <code>jackson</code> for
Expand All @@ -22,7 +22,7 @@ public class XMLUtil {
*/
public Configuration unmarshallConfiguration(InputStream stream) {
try {
return mapper.create().readValue(stream, Configuration.class);
return mapper.readValue(stream, Configuration.class);
} catch (Exception e) {
throw new IllegalStateException("Cannot parse holidays XML file.", e);
}
Expand Down

0 comments on commit 3ee13ce

Please sign in to comment.