コード例 #1
0
 @Override
 public synchronized void onSuccess(BaseClientPutter state, ObjectContainer container) {
   try {
     if (logDEBUG)
       Logger.debug(this, "Successfully inserted WoTOwnMessageList at " + state.getURI());
     mMessageManager.onMessageListInsertSucceeded(state.getURI());
   } catch (Exception e) {
     Logger.error(this, "WoTOwnMessageList insert succeeded but onSuccess() failed", e);
   } finally {
     removeInsert(state);
     Closer.close(((ClientPutter) state).getData());
   }
 }
コード例 #2
0
ファイル: InsertCallback.java プロジェクト: ktogias/wsFreenet
 @Override
 public void onSuccess(BaseClientPutter bcp) {
   JSONObject response = insertObject.getHandler().createJSONReplyMessage("success");
   response.put("requestURI", bcp.getURI().toString());
   insertObject.getHandler().getWebSocket().send(response.toJSONString());
   bucket.free();
   unsubscribeFromContextEvents();
   insertObject.getHandler().getDataInserts().remove(insertObject);
 }
コード例 #3
0
 public void onSuccess(BaseClientPutter state, ObjectContainer container) {
   FreenetURI uri = state.getURI();
   if (logMINOR) Logger.minor(this, darknetOpennetString + " ARK insert succeeded: " + uri);
   synchronized (this) {
     inserter = null;
     if (!shouldInsert) return;
     shouldInsert = false;
   }
   startInserter();
 }
コード例 #4
0
  @Override
  public synchronized void onFailure(
      InsertException e, BaseClientPutter state, ObjectContainer container) {
    try {
      if (e.getMode() == InsertException.COLLISION) {
        Logger.warning(
            this, "WoTOwnMessageList insert collided, trying to insert with higher index ...");
        try {
          synchronized (mMessageManager) {
            // We must call getOwnMessageList() before calling onMessageListInsertFailed() because
            // the latter will increment the message list's
            // index, resulting in the ID of the message list changing - getIDFromURI would fail
            // with the old state.getURI() if we called it after
            // onMessageListInsertFailed()
            WoTOwnMessageList list =
                (WoTOwnMessageList)
                    mMessageManager.getOwnMessageList(
                        MessageListID.construct(state.getURI()).toString());
            mMessageManager.onMessageListInsertFailed(state.getURI(), true);
            insertMessageList(list);
          }
        } catch (Exception ex) {
          Logger.error(this, "Inserting WoTOwnMessageList with higher index failed", ex);
        }
      } else {
        if (e.isFatal()) Logger.error(this, "WoTOwnMessageList insert failed", e);
        else Logger.warning(this, "WoTOwnMessageList insert failed non-fatally", e);

        mMessageManager.onMessageListInsertFailed(state.getURI(), false);
      }
    } catch (Exception ex) {
      Logger.error(this, "WoTOwnMessageList insert failed and failure handling threw", ex);
    } finally {
      removeInsert(state);
      Closer.close(((ClientPutter) state).getData());
    }
  }