need a advice from any one.
if you look at the below code,every time I am creating the new object for smooks as ftlname dynamically get populated.
try {
Smooks smooks1 = new Smooks("smooks-config.xml");
if (ftlName != null) {
inputStream = new ByteArrayInputStream(xmlMessage.toString()
.getBytes());
outStream = new ByteArrayOutputStream();
smooks1.addVisitor(new FreeMarkerTemplateProcessor(
new TemplatingConfiguration(ftlName)));
smooks1.filterSource(new StreamSource(inputStream),
new StreamResult(outStream));
resultString = outStream.toString();
inputStream.close();
outStream.close();
}
} catch (Exception ee) { }
this is really hitting the performance as every time creating a smooks object, when I have try to use the single smooks instance, getting below error.
java.lang.UnsupportedOperationException: Unsupported call to Smooks instance configuration method after Smooks instance has created an ExecutionContext.
at org.milyn.Smooks.assertIsConfigurable(Smooks.java:588) [milyn-smooks-all-1.5.1.jar:]
at org.milyn.Smooks.addVisitor(Smooks.java:262) [milyn-smooks-all-1.5.1.jar:]
at org.milyn.Smooks.addVisitor(Smooks.java:241) [milyn-smooks-all-1.5.1.jar:]
can you please provide your advice on it.
smooks version :- 1.5.1