Esempio n. 1
0
    protected Object getNextMessage(Object resource) throws Exception {
      Object readMsg = null;
      try {
        readMsg = protocol.read(dataIn);

        if (dataIn.isStreaming()) {
          moreMessages = false;
        }

        return readMsg;
      } catch (SocketTimeoutException e) {
        if (!socket.getKeepAlive()) {
          return null;
        }
      } finally {
        if (readMsg == null) {
          // Protocols can return a null object, which means we're done
          // reading messages for now and can mark the stream for closing later.
          // Also, exceptions can be thrown, in which case we're done reading.
          dataIn.close();
        }
      }

      return null;
    }
Esempio n. 2
0
 // @Override
 protected void handleResults(List messages) throws Exception {
   // should send back only if remote synch is set or no outbound endpoints
   if (endpoint.isRemoteSync() || !service.getOutboundRouter().hasEndpoints()) {
     for (Iterator iterator = messages.iterator(); iterator.hasNext(); ) {
       Object o = iterator.next();
       protocol.write(dataOut, o);
       dataOut.flush();
     }
   }
 }