Exemplo n.º 1
0
  private void initJobs() {
    synchronized (this) {
      _jobs = new HashMap<String, Jobs>();
      ArrayList<Jobs> jobs = _dbc.getJobs();

      int jobSize = jobs.size();
      _jobIDs = new String[jobSize];
      _currentKey = 0;
      for (int i = 0; i < jobSize; i++) {
        Jobs job = jobs.get(i);
        _jobIDs[i] = job.getID();
        _jobs.put(job.getID(), job);
      }
    }
  }
Exemplo n.º 2
0
  public String getData(String jobID) {
    synchronized (jobID) {
      Jobs job = _jobs.get(jobID);
      if (job == null) {
        return "this should never happen";
      }
      if (job.sizeData() <= 0) {
        // Before doing this perform the check to see if all answered
        _dbc.ensureConsistency();

        ArrayList<Data> newData = _dbc.getData(jobID, ServerGlobals.sizeOfLists);
        if (newData != null) job.appendToArrayList(newData);
      }
      return job.getData();
    }
  }