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; } }
@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); }
private synchronized boolean init(int count, int maxFailCount, PaPeer peer) { if (stat != Stat.READY) { logger.error("aleady start." + stat); // queueManager.complete(chId, null); return false; } if (this.peer != null) { this.peer.unref(); } if (peer != null) { peer.ref(); } this.peer = peer; this.count = count; this.maxFailCount = maxFailCount; this.failCount = 0; // this.paManager=config.getAdminPaManager(); if (count > 0) { stat = Stat.INC; } else { stat = Stat.KEEP; } return true; }