コード例 #1
0
 @Override
 public void run() {
   try {
     try {
       Peer peer = Peers.getAnyPeer(Peer.State.CONNECTED, true);
       if (peer == null) {
         return;
       }
       JSONObject response = peer.send(getUnconfirmedTransactionsRequest);
       if (response == null) {
         return;
       }
       JSONArray transactionsData = (JSONArray) response.get("unconfirmedTransactions");
       if (transactionsData == null || transactionsData.size() == 0) {
         return;
       }
       processPeerTransactions(transactionsData, false);
     } catch (Exception e) {
       Logger.logDebugMessage("Error processing unconfirmed transactions from peer", e);
     }
   } catch (Throwable t) {
     Logger.logMessage("CRITICAL ERROR. PLEASE REPORT TO THE DEVELOPERS.\n" + t.toString());
     t.printStackTrace();
     System.exit(1);
   }
 }
コード例 #2
0
ファイル: Users.java プロジェクト: andriybobyr/lnk
 static int getIndex(Peer peer) {
   Integer index = peerIndexMap.get(peer.getHost());
   if (index == null) {
     index = peerCounter.incrementAndGet();
     peerIndexMap.put(peer.getHost(), index);
     peerAddressMap.put(index, peer.getHost());
   }
   return index;
 }
コード例 #3
0
 @Inject
 @Optional
 private void onPeerEvent(@UIEventTopic(INxtService.TOPIC_PEER) Peer peer) {
   if (peer.isWellKnown()
       && peerTableViewer != null
       && !peerTableViewer.getControl().isDisposed()) {
     peerTableViewer.refresh();
   }
 }