当前位置: 首页>>代码示例>>Java>>正文


Java MemoryRequestChannel类代码示例

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


MemoryRequestChannel类属于org.jetlang.channels包,在下文中一共展示了MemoryRequestChannel类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JetlangPonger

import org.jetlang.channels.MemoryRequestChannel; //导入依赖的package包/类
/** Creates a JetlangPonger. */
public JetlangPonger(final Fiber _fiber) {
    fiber = _fiber;
    channel = new MemoryRequestChannel();
    final Callback<Request> onReq = new Callback<Request>() {
        @Override
        public void onMessage(final Request message) {
            final Object request = message.getRequest();
            if (request instanceof PingRequest) {
                final PingRequest ping = (PingRequest) request;
                message.reply(ping.processRequest(JetlangPonger.this));
            } else {
                throw new IllegalStateException(
                        "Expected PingRequest but got "
                                + request.getClass());
            }
        }
    };
    fiber.start();
    channel.subscribe(fiber, onReq);
}
 
开发者ID:skunkiferous,项目名称:PingPong,代码行数:22,代码来源:JetlangPonger.java

示例2: makeTestInstance

import org.jetlang.channels.MemoryRequestChannel; //导入依赖的package包/类
private ReplicatorInstance makeTestInstance() throws Exception {
  long thisReplicatorId = 1;
  ReplicatorClock info = new InRamSim.StoppableClock(0, Integer.MAX_VALUE / 2L);
  ReplicatorLog proxyLog = getReplicatorLogWhichInvokesMock();

  return new ReplicatorInstance(new ThreadFiber(new RunnableExecutorImpl(batchExecutor), null, true),
      thisReplicatorId,
      QUORUM_ID,
      proxyLog,
      info,
      persistence,
      new MemoryRequestChannel<>(),
      eventChannel,
      commitNotices,
      State.FOLLOWER);
}
 
开发者ID:cloud-software-foundation,项目名称:c5-replicator,代码行数:17,代码来源:ReplicatorAppendEntriesTest.java

示例3: JetlangPinger

import org.jetlang.channels.MemoryRequestChannel; //导入依赖的package包/类
/** Creates a JetlangPinger. */
@SuppressWarnings({ "rawtypes", "unchecked" })
public JetlangPinger(final Fiber _fiber) {
    fiber = _fiber;
    channel = new MemoryRequestChannel();
    final Callback<Request> onReq = new Callback<Request>() {
        @Override
        public void onMessage(final Request message) {
            final Object request = message.getRequest();
            if (request instanceof HammerRequest) {
                final HammerRequest req = (HammerRequest) request;
                try {
                    req.processRequest(JetlangPinger.this);
                    ping(message);
                } catch (final Exception e) {
                    e.printStackTrace();
                    message.reply(-1);
                }
            } else {
                throw new IllegalStateException(
                        "Expected HammerRequest but got "
                                + request.getClass());
            }
        }
    };
    fiber.start();
    channel.subscribe(fiber, onReq);
}
 
开发者ID:skunkiferous,项目名称:PingPong,代码行数:29,代码来源:JetlangPinger.java


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