* Render and return result in String. This method is usually called from API defined in
* {@link RythmEngine}
*/
@Override
public final String render() {
RythmEngine engine = __engine();
boolean engineSet = RythmEngine.set(engine);
try {
long l = 0l;
boolean logTime = __logTime();
if (logTime) {
l = System.currentTimeMillis();
}
__triggerRenderEvent(RythmEvents.ON_RENDER, engine);
__setup();
if (logTime) {
__logger.debug("< preprocess [%s]: %sms", getClass().getName(), System.currentTimeMillis() - l);
l = System.currentTimeMillis();
}
try {
String s = __internalRender();
return s;
} finally {
__triggerRenderEvent(RythmEvents.RENDERED, engine);
if (logTime) {
__logger.debug("<<<<<<<<<<<< [%s] total render: %sms", getClass().getName(), System.currentTimeMillis() - l);
}
}
} catch (ClassReloadException e) {
engine.restart(e);
return render();
} finally {
if (engineSet) {
RythmEngine.clear();
}