Examples of toByteString()


Examples of com.google.protobuf.UnittestLite.TestPackedExtensionsLite.toByteString()

  }

  public void testParsePackedExtensionsLite() throws Exception {
    // Ensure that packed extensions can be properly parsed.
    TestPackedExtensionsLite message = TestUtil.getLitePackedExtensionsSet();
    ByteString rawBytes = message.toByteString();

    ExtensionRegistryLite registry = TestUtil.getExtensionRegistryLite();

    TestPackedExtensionsLite message2 =
        TestPackedExtensionsLite.parseFrom(rawBytes, registry);
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.TestProtos.Response.toByteString()

    // Test doBlockingRpc
    SocketRpcProtos.Response rpcResponse =
        rpcForwarder.doBlockingRpc(RPC_REQUEST);
    assertTrue(rpcResponse.getCallback());
    assertEquals(response.toByteString(), rpcResponse.getResponseProto());

    // Test doRpc
    Callback<SocketRpcProtos.Response> rpcCallback =
        new Callback<SocketRpcProtos.Response>();
    rpcForwarder.doRpc(RPC_REQUEST, rpcCallback);
View Full Code Here

Examples of com.taobao.metamorphosis.server.transaction.store.TransactionCommands.AppendMessageCommand.toByteString()

            // ���طţ����put��־
            final AppendMessageCommand appendCmd =
                    AppendMessageCommand.newBuilder().setMessageId(msgId)
                    .setPutCommand(ByteString.copyFrom(putCmd.encode().array())).build();
            final TxCommand txCommand =
                    TxCommand.newBuilder().setCmdType(TxCommandType.APPEND_MSG).setCmdContent(appendCmd.toByteString())
                    .build();
            final Tx tx = this.getInflyTx(putCmd.getTransactionId());
            if (tx != null) {
                location = this.journalStore.write(txCommand, null, tx.location, false);
            }
View Full Code Here

Examples of com.taobao.metamorphosis.server.transaction.store.TransactionCommands.TransactionOperation.toByteString()

        final TransactionOperation to =
                TransactionOperation.newBuilder().setType(TransactionType.XA_PREPARE)
                .setTransactionId(txid.getTransactionKey()).setWasPrepared(false).build();
        // prepare,����force
        final TxCommand msg =
                TxCommand.newBuilder().setCmdType(TxCommandType.TX_OP).setCmdContent(to.toByteString()).setForce(true)
                .build();
        this.journalStore.write(msg, null, tx.location, false);

        synchronized (this.preparedTransactions) {
            this.preparedTransactions.put(txid, tx);
View Full Code Here

Examples of com.taobao.zeus.socket.protocol.Protocol.CancelMessage.toByteString()

    // 如果在运行中 从worker列表中查询正在运行该job的woker,发出取消命令
    // 如果在等待队列,从等待队列删除
    // 如果都不在,抛出异常
    CancelMessage cm=CancelMessage.newBuilder().setEk(ek).setId(id).build();
    final Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.Cancel)
      .setBody(cm.toByteString()).build();
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    Future<Response> f=context.getThreadPool().submit((new Callable<Response>() {
      private Response response;
      public Response call() throws Exception {
        final CountDownLatch latch=new CountDownLatch(1);
View Full Code Here

Examples of com.taobao.zeus.socket.protocol.Protocol.DebugMessage.toByteString()

    // 响应OK 则添加监听器,继续等待任务完成的消息
    // 响应失败,返回失败退出码
    holder.getDebugRunnings().put(id,false);
    DebugMessage dm=DebugMessage.newBuilder().setDebugId(id).build();
    final Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.Debug)
      .setBody(dm.toByteString()).build();
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    Future<Response> f=context.getThreadPool().submit(new Callable<Response>() {
      private Response response;
      public Response call() throws Exception {
        final CountDownLatch latch=new CountDownLatch(1);
View Full Code Here

Examples of com.taobao.zeus.socket.protocol.Protocol.ExecuteMessage.toByteString()

    JobHistory history=context.getJobHistoryManager().findJobHistory(id);
    final String jobId=history.getJobId();
    holder.getRunnings().put(jobId,false);
    ExecuteMessage em=ExecuteMessage.newBuilder().setJobId(jobId).build();
    final Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.Schedule)
      .setBody(em.toByteString()).build();
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    Future<Response> f=context.getThreadPool().submit(new Callable<Response>() {
      private Response response;
      public Response call() throws Exception {
        final CountDownLatch latch=new CountDownLatch(1);
View Full Code Here

Examples of com.taobao.zeus.socket.protocol.Protocol.HeartBeatMessage.toByteString()

    HeartBeatMessage hbm=HeartBeatMessage.newBuilder().setMemRate(((Double)jobContext.getData("mem")).floatValue())
      .addAllDebugRunnings(context.getDebugRunnings().keySet())
      .addAllManualRunnings(context.getManualRunnings().keySet())
      .addAllRunnings(context.getRunnings().keySet())
      .setTimestamp(new Date().getTime()).build();
    Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.HeartBeat).setBody(hbm.toByteString()).build();
   
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    return context.getServerChannel().write(sm);
  }
}
View Full Code Here

Examples of com.taobao.zeus.socket.protocol.Protocol.ManualMessage.toByteString()

    // 响应OK 则添加监听器,继续等待任务完成的消息
    // 响应失败,返回失败退出码
    holder.getManualRunnings().put(historyId,false);
    ManualMessage mm=ManualMessage.newBuilder().setHistoryId(historyId).build();
    final Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.Manual)
      .setBody(mm.toByteString()).build();
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    Future<Response> f=context.getThreadPool().submit(new Callable<Response>() {
      private Response response;
      public Response call() throws Exception {
        final CountDownLatch latch=new CountDownLatch(1);
View Full Code Here

Examples of com.taobao.zeus.socket.protocol.Protocol.Request.toByteString()

    final String jobId=history.getJobId();
    holder.getRunnings().put(jobId,false);
    ExecuteMessage em=ExecuteMessage.newBuilder().setJobId(jobId).build();
    final Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.Schedule)
      .setBody(em.toByteString()).build();
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    Future<Response> f=context.getThreadPool().submit(new Callable<Response>() {
      private Response response;
      public Response call() throws Exception {
        final CountDownLatch latch=new CountDownLatch(1);
        context.getHandler().addListener(new ResponseListener() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.