while (isRunning() && (message = reader.read()) != null) {
nmessages++;
SessionKey key1 = new SessionKey(message.getMessage().getHeader().getString(SenderCompID.FIELD), message.getMessage().getHeader().getString(TargetCompID.FIELD));
SessionKey key2 = new SessionKey(message.getMessage().getHeader().getString(TargetCompID.FIELD), message.getMessage().getHeader().getString(SenderCompID.FIELD));
FIXSessionBrowserDocumentComponent document = documents.get(key1);
if (document == null) {
document = new FIXSessionBrowserDocumentComponent(messageCache, key1);
documents.put(key1, document);
documents.put(key2, document);
addTaskListener(document) ;
document.addDocumentComponentListener(new DocumentComponetListenerSupport(){
@Override
public void documentComponentClosed(DocumentComponentEvent arg0) {
stop() ;
}
}) ;
}
document.addMessage(message);
}
} catch (Throwable ex) {
log.error("browse stopped: " + ex.getMessage());
} finally {
reader.close();