• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Callback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.ipc.invalidation.external.client.types.Callback的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Callback类属于com.google.ipc.invalidation.external.client.types包,在下文中一共展示了Callback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: scheduleStartAfterReadingStateBlob

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
/** Reads the Ticl state from persistent storage (if any) and calls {@code startInternal}. */
private void scheduleStartAfterReadingStateBlob() {
  storage.readKey(CLIENT_TOKEN_KEY, new Callback<SimplePair<Status, byte[]>>() {
    @Override
    public void accept(final SimplePair<Status, byte[]> readResult) {
      Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
      final byte[] serializedState = readResult.getFirst().isSuccess() ?
          readResult.getSecond() : null;
      // Call start now.
      if (!readResult.getFirst().isSuccess()) {
        statistics.recordError(ClientErrorType.PERSISTENT_READ_FAILURE);
        logger.warning("Could not read state blob: %s", readResult.getFirst().getMessage());
      }
      startInternal(serializedState);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:InvalidationClientCore.java


示例2: writeKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void writeKey(final String key, final byte[] value, final Callback<Status> callback) {
  // Need to schedule immediately because C++ locks aren't reentrant, and
  // C++ locking code assumes that this call will not return directly.

  // Schedule the write even if the resources are started since the
  // scheduler will prevent it from running in case the resources have been
  // stopped.
  scheduler.schedule(Scheduler.NO_DELAY,
      new NamedRunnable("MemoryStorage.writeKey") {
    @Override
    public void run() {
      ticlPersistentState.put(key, value);
      callback.accept(Status.newInstance(Status.Code.SUCCESS, ""));
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:MemoryStorageImpl.java


示例3: readKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readKey(final String key, final Callback<SimplePair<Status, byte[]>> done) {
  scheduler.schedule(Scheduler.NO_DELAY,
      new NamedRunnable("MemoryStorage.readKey") {
    @Override
    public void run() {
      byte[] value = TypedUtil.mapGet(ticlPersistentState, key);
      final SimplePair<Status, byte[]> result;
      if (value != null) {
        result = SimplePair.of(Status.newInstance(Status.Code.SUCCESS, ""), value);
      } else {
        String error = "No value present in map for " + key;
        result = SimplePair.of(Status.newInstance(Status.Code.PERMANENT_FAILURE, error), null);
      }
      done.accept(result);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:MemoryStorageImpl.java


示例4: readKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readKey(final String key, final Callback<SimplePair<Status, byte[]>> done) {
  scheduler.execute(new NamedRunnable("AndroidStorage.readKey") {
    @Override
    public void run() {
        byte [] value = properties.get(key);
        if (value != null) {
          done.accept(SimplePair.of(SUCCESS, value));
        } else {
          Status status =
              Status.newInstance(Status.Code.PERMANENT_FAILURE, "No value in map for " + key);
          done.accept(SimplePair.of(status, (byte []) null));
        }
    }
  });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:AndroidStorage.java


示例5: deleteKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void deleteKey(String key, Callback<Boolean> done) {
  // We only support the CLIENT_TOKEN_KEY.
  if (!key.equals(InvalidationClientCore.CLIENT_TOKEN_KEY)) {
    done.accept(false);
    return;
  }
  if (!context.getFileStreamPath(STATE_FILENAME).exists()) {
    // Deletion "succeeds" if the key didn't exist.
    done.accept(true);
  } else {
    // Otherwise it succeeds based on whether the IO operation succeeded.
    done.accept(context.deleteFile(STATE_FILENAME));
  }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:AndroidStorage.java


示例6: readAllKeys

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readAllKeys(Callback<SimplePair<Status, String>> keyCallback) {
  // If the state file exists, supply the CLIENT_TOKEN_KEY as a present key.
  if (context.getFileStreamPath(STATE_FILENAME).exists()) {
    Status status = Status.newInstance(Status.Code.SUCCESS, "");
    keyCallback.accept(SimplePair.of(status, InvalidationClientCore.CLIENT_TOKEN_KEY));
  }
  keyCallback.accept(null);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:AndroidStorage.java


示例7: writeKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void writeKey(String key, byte[] value, final Callback<Status> done) {
  delegate.writeKey(key, value, new Callback<Status>() {
    @Override
    public void accept(final Status status) {
      scheduler.schedule(NO_DELAY, new NamedRunnable("SafeStorage.writeKey") {
        @Override
        public void run() {
          done.accept(status);
        }
      });
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:SafeStorage.java


示例8: readKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readKey(String key, final Callback<SimplePair<Status, byte[]>> done) {
  delegate.readKey(key, new Callback<SimplePair<Status, byte[]>>() {
    @Override
    public void accept(final SimplePair<Status, byte[]> result) {
      scheduler.schedule(NO_DELAY, new NamedRunnable("SafeStorage.readKey") {
        @Override
        public void run() {
          done.accept(result);
        }
      });
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:SafeStorage.java


示例9: deleteKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void deleteKey(String key, final Callback<Boolean> done) {
  delegate.deleteKey(key, new Callback<Boolean>() {
    @Override
    public void accept(final Boolean success) {
      scheduler.schedule(NO_DELAY, new NamedRunnable("SafeStorage.deleteKey") {
        @Override
        public void run() {
          done.accept(success);
        }
      });
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:SafeStorage.java


示例10: readAllKeys

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readAllKeys(final Callback<SimplePair<Status, String>> keyCallback) {
  delegate.readAllKeys(new Callback<SimplePair<Status, String>>() {
    @Override
    public void accept(final SimplePair<Status, String> keyResult) {
      scheduler.schedule(NO_DELAY, new NamedRunnable("SafeStorage.readAllKeys") {
        @Override
        public void run() {
          keyCallback.accept(keyResult);
        }
      });
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:SafeStorage.java


示例11: deleteKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void deleteKey(final String key, final Callback<Boolean> done) {
  scheduler.schedule(Scheduler.NO_DELAY,
      new NamedRunnable("MemoryStorage.deleteKey") {
    @Override
    public void run() {
      TypedUtil.remove(ticlPersistentState, key);
      done.accept(true);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:12,代码来源:MemoryStorageImpl.java


示例12: readAllKeys

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readAllKeys(final Callback<SimplePair<Status, String>> done) {
  scheduler.schedule(Scheduler.NO_DELAY,
      new NamedRunnable("MemoryStorage.readAllKeys") {
    @Override
    public void run() {
      Status successStatus = Status.newInstance(Status.Code.SUCCESS, "");
      for (String key : ticlPersistentState.keySet()) {
        done.accept(SimplePair.of(successStatus, key));
      }
      done.accept(null);
    }
  });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:15,代码来源:MemoryStorageImpl.java


示例13: deleteKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void deleteKey(final String key, final Callback<Boolean> done) {
  scheduler.execute(new NamedRunnable("AndroidStorage.deleteKey") {
    @Override
    public void run() {
      properties.remove(key);
      store();
      done.accept(true);
    }
  });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidStorage.java


示例14: readAllKeys

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void readAllKeys(final Callback<SimplePair<Status, String>> keyCallback) {
  scheduler.execute(new NamedRunnable("AndroidStorage.readAllKeys") {
    @Override
    public void run() {
      for (String key : properties.keySet()) {
        keyCallback.accept(SimplePair.of(SUCCESS, key));
      }
    }
  });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidStorage.java


示例15: writeKey

import com.google.ipc.invalidation.external.client.types.Callback; //导入依赖的package包/类
@Override
public void writeKey(final String key, final byte[] value, final Callback<Status> done) {
  scheduler.execute(new NamedRunnable("AndroidStorage.writeKey") {
    @Override
    public void run() {
      properties.put(key, value);
      store();
      done.accept(SUCCESS);
    }
  });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidStorage.java



注:本文中的com.google.ipc.invalidation.external.client.types.Callback类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlobStoreIndexShardRepository类代码示例发布时间:2022-05-22
下一篇:
Java PixelFormat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap