Esempio n. 1
0
 private void publish(int count, int failCount, boolean isComplete) {
   JSONObject eventObj = new JSONObject();
   eventObj.put("kind", "checkConnectProgress");
   eventObj.put("time", (System.currentTimeMillis() - startTime));
   eventObj.put("connectCount", count);
   eventObj.put("failCount", failCount);
   eventObj.put("useMemory", (runtime.totalMemory() - runtime.freeMemory()));
   eventObj.put("stat", stat);
   peer.message(eventObj);
   if (isComplete) {
     peer.unref();
     peer = null;
   }
 }
Esempio n. 2
0
 @Override
 public void onBufferEnd(Object userContext) {
   endBuffer(currentZe);
   Iterator<String> itr = refDigests.iterator();
   while (itr.hasNext()) {
     StoreManager.ref(itr.next());
   }
   itr = addDigests.iterator();
   while (itr.hasNext()) {
     StoreManager.unref(itr.next());
   }
   JSONObject response = new JSONObject();
   response.element("command", "import");
   response.element("result", "success");
   peer.message(response);
 }