Esempio n. 1
0
  public void run() {
    try {
      System.out.println("console connector started");
      ChunkQueue eventQueue = DataFactory.getInstance().getEventQueue();
      if (!silent) System.out.println("-------------------");

      while (!shutdown) {
        List<Chunk> evts = new ArrayList<Chunk>();
        eventQueue.collect(evts, 1);

        for (Chunk e : evts) {
          if (!silent) {
            System.out.println("Console out connector got event at offset " + e.getSeqID());
            System.out.println("data type was " + e.getDataType());
            if (e.getData().length > 1000)
              System.out.println("data length was " + e.getData().length + ", not printing");
            else System.out.println(new String(e.getData(), Charset.forName("UTF-8")));
          }

          agent.reportCommit(e.getInitiator(), e.getSeqID());

          if (!silent) System.out.println("-------------------");
        }
      }
    } catch (InterruptedException e) {
    } // thread is about to exit anyway
  }
 @Override
 public void collect(List<Chunk> chunks, int count) throws InterruptedException {
   defaultQueue.collect(chunks, count);
   for (Chunk chunk : chunks) {
     ChunkDumper.dump("sender", chunk);
   }
 }
 @Override
 public int size() {
   return defaultQueue.size();
 }
 @Override
 public void add(Chunk chunk) throws InterruptedException {
   ChunkDumper.dump("adaptor", chunk);
   defaultQueue.add(chunk);
 }