/**
   * @param session - a non blocking session ie an NIO one that wont block if socket cant read/write
   */
  @Override
  public synchronized void addSession(final NonBlockingSession session) {

    SessionWrapper[] newSessions = new SessionWrapper[_sessions.length + 1];

    int idx = 0;
    while (idx < _sessions.length) {
      newSessions[idx] = _sessions[idx];
      ++idx;
    }

    newSessions[idx] =
        new SessionWrapper(session, session.getSendQueue(), session.getSendSyncQueue());

    _sessions = newSessions;

    _fullyFlushed = false;
  }
 @Override
 public void dispatch(final Message msg) {
   if (msg != null) {
     final MessageHandler handler = msg.getMessageHandler();
     final NonBlockingSession session = (NonBlockingSession) handler;
     final MessageQueue queue = session.getSendQueue();
     if (queue != null) {
       queue.add(msg);
     } else {
       // should NEVER happen
       ReusableString s = TLC.instance().pop();
       s.copy(((Session) handler).getComponentId())
           .append(": Missing Queue, unable to dispatch : ");
       msg.dump(s);
       _log.error(MISSING_HANDLER, s);
       TLC.instance().pushback(s);
     }
   }
 }