}
}
}
} else {
// need to render again and cache the output
buffer = new SAX2BufferImpl ();
buffer.startBuffering();
channel.renderXML(buffer);
// save cache
if(key!=null) {
if(key.getKeyScope()==ChannelCacheKey.SYSTEM_KEY_SCOPE) {
systemCache.put(key.getKey(),new ChannelCacheEntry(buffer,key.getKeyValidity()));
if (log.isDebugEnabled()) {
log.debug("ChannelRenderer.Worker::run() : recorded system cache based on a key \""+key.getKey()+"\"");
}
} else {
getChannelCache().put(key.getKey(),new ChannelCacheEntry(buffer,key.getKeyValidity()));
if (log.isDebugEnabled()) {
log.debug("ChannelRenderer.Worker::run() : recorded instance cache based on a key \""+key.getKey()+"\"");
}
}
}
}
}
} else {
if (ccacheable && channel instanceof ICharacterChannel) {
StringWriter sw = new StringWriter(100);
PrintWriter pw = new PrintWriter(sw);
((ICharacterChannel)channel).renderCharacters(pw);
pw.flush();
cbuffer = sw.toString();
} else {
buffer = new SAX2BufferImpl ();
buffer.startBuffering();
channel.renderXML(buffer);
}
}
} else {
// in the case when channel cache is not enabled
buffer = new SAX2BufferImpl ();
buffer.startBuffering();
channel.renderXML (buffer);
}
successful = true;
} catch (Exception e) {