Esempio n. 1
0
  public void stop() throws RecorderException {
    try {
      _recorder.stop();

      TxtQuery query = new TxtQuery();
      query.open(_uri, null, null, null, null, DTFConstants.DEFAULT_ENCODING);
      Cursor cursor = new Cursor(query);
      int count = 0;

      if (DTFNode.getOwner() != null) {
        String ownerId = DTFNode.getOwner().getOwner();

        Sequence seq = new Sequence();
        seq.setThreadID(_threadId);

        while (true) {
          HashMap<String, String> map = cursor.next(false);

          if (map == null) break;

          Event event = CLIUtil.hashMapToEvent(map);
          seq.addAction(event);
          count++;

          if (count > 100) {
            Action.getComm().sendAction(ownerId, seq);
            seq.clearChildren();
            count = 0;
          }
        }

        if (seq.children().size() != 0) Action.getComm().sendAction(ownerId, seq);
      }
    } catch (StorageException e) {
      throw new RecorderException("Error handling remote events.", e);
    } catch (DTFException e) {
      throw new RecorderException("Error handling remote events.", e);
    } finally {
      try {
        RemoteStorage.delete(_uri);
      } catch (StorageException e) {
        throw new RecorderException("Error cleaning up event file.", e);
      }
    }
  }
Esempio n. 2
0
 public void record(Event event) throws RecorderException {
   _recorder.record(event);
 }