@Override protected Job handleJobResult(JobResult received, IbisIdentifier from) { // TODO Auto-generated method stub String cluster = from.location().getParent().toString(); System.err.println(from.location().toString() + " " + received.getStats().getRuntime()); /* assumes jobs don't need to be replicated on the same cluster, except on failure */ Job doneJob = schedJobs.remove(received.getJobID()); workers .get(cluster) .get(from.location().getLevel(0)) .addJobStats(received.getStats().getRuntime()); /*create category if it doesn't exist yet * upper duration since we pay in discrete increments of priced time unit*/ doneJobs.put(doneJob.getJobID(), doneJob); if (hosts.get(from.location().toString()).schedJobs.size() == 0) return sayGB(from); Job nextJob = hosts.get(from.location().toString()).schedJobs.remove(0); nextJob.startTime = System.nanoTime(); return nextJob; }
@Override protected void afterJobDone(Object result) { Boolean success = false; Integer totalRecords = null; String elapse = elapsed(); String db = null; if (result != null && result instanceof Object[]) { Object[] args = (Object[]) result; success = (Boolean) args[0]; totalRecords = (Integer) args[1]; db = (String) args[2]; } StringBuilder text = new StringBuilder(); if (success) { mProgressBar.setValue(mProgressBar.getMaximum()); text.append("已将所有日志记录转存到sqlite数据库中") .append("\n") .append("写入日志条数:\t") .append(totalRecords) .append("\n") .append("总耗时:\t") .append(elapse) .append("\n") .append("数据库文件:\t") .append(db) .append("\n"); } else { text.append("已取消转存").append("\n").append("耗时:\t").append(elapse).append("\n"); if (totalRecords != null) text.append("已处理条目数:\t").append(totalRecords).append("\n"); if (db != null) text.append("数据库文件:\t").append(db).append("\n"); } mText.setText(text.toString()); if (mJobResult != null) mJobResult.onDbFileGot(db); }