예제 #1
0
 // we synchronize on ourselves, in case we are executed by several threads
 // from the thread pool.
 public synchronized void run() {
   // go over all complete messages and process them.
   while (_tokenizer.hasMessage()) {
     T msg = _tokenizer.nextMessage();
     String temp = _tokenizer.getLastMessageSend(); // TODO delete
     try {
       this._tokenizer.setConnectionHandler(_handler);
     } catch (Exception e) {
     }
     T response = this._protocol.processMessage(msg);
     if (response != null) {
       try {
         ByteBuffer bytes = _tokenizer.getBytesForMessage(response);
         this._handler.addOutData(bytes);
       } catch (CharacterCodingException e) {
         e.printStackTrace();
       }
     } else {
     }
   }
 }
예제 #2
0
 public void addBytes(ByteBuffer b) {
   _tokenizer.addBytes(b);
 }