测试grpc-java

This commit is contained in:
eson 2022-05-18 00:56:52 +08:00
parent 1d95eaa564
commit 5deaca30ce
5 changed files with 491 additions and 72 deletions

99
pom.xml
View File

@ -12,7 +12,14 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<java.version>11</java.version>
<protobuf.version>3.20.1</protobuf.version>
<protostuff.version>1.7.4</protostuff.version>
<grpc.version>1.45.1</grpc.version>
</properties>
<dependencies>
@ -23,10 +30,92 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.20.1</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-core</artifactId>
<version>${protostuff.version}</version>
</dependency>
<dependency>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-runtime</artifactId>
<version>${protostuff.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<!-- 添加grpc相关依赖包 -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.46.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.46.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.46.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
<version>1.46.0</version>
</dependency>
<!-- proto自动生成java文件所需的编译插件 -->
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration> <protocArtifact>com.google.protobuf:protoc:3.13.0:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.46.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,2 +1,4 @@
#! /bin/bash
protoc src/main/java/com/yuandian/dataflow/rpc/*.proto --java_out=./src/main/java/
OUTPUT_FILE="./src/main/java/"
protoc src/main/java/com/yuandian/dataflow/rpc/*.proto --plugin=protoc-gen-grpc-java --java_out=$OUTPUT_FILE --grpc-java_out=$OUTPUT_FILE

View File

@ -0,0 +1,276 @@
package com.yuandian.dataflow.rpc;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.46.0)",
comments = "Source: scheduler.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class DataFlowGrpc {
private DataFlowGrpc() {}
public static final String SERVICE_NAME = "com.yuandian.dataflow.rpc.DataFlow";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<com.yuandian.dataflow.rpc.Scheduler.State,
com.yuandian.dataflow.rpc.Scheduler.Response> getUpdateMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Update",
requestType = com.yuandian.dataflow.rpc.Scheduler.State.class,
responseType = com.yuandian.dataflow.rpc.Scheduler.Response.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.yuandian.dataflow.rpc.Scheduler.State,
com.yuandian.dataflow.rpc.Scheduler.Response> getUpdateMethod() {
io.grpc.MethodDescriptor<com.yuandian.dataflow.rpc.Scheduler.State, com.yuandian.dataflow.rpc.Scheduler.Response> getUpdateMethod;
if ((getUpdateMethod = DataFlowGrpc.getUpdateMethod) == null) {
synchronized (DataFlowGrpc.class) {
if ((getUpdateMethod = DataFlowGrpc.getUpdateMethod) == null) {
DataFlowGrpc.getUpdateMethod = getUpdateMethod =
io.grpc.MethodDescriptor.<com.yuandian.dataflow.rpc.Scheduler.State, com.yuandian.dataflow.rpc.Scheduler.Response>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Update"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.yuandian.dataflow.rpc.Scheduler.State.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.yuandian.dataflow.rpc.Scheduler.Response.getDefaultInstance()))
.setSchemaDescriptor(new DataFlowMethodDescriptorSupplier("Update"))
.build();
}
}
}
return getUpdateMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static DataFlowStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<DataFlowStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<DataFlowStub>() {
@java.lang.Override
public DataFlowStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new DataFlowStub(channel, callOptions);
}
};
return DataFlowStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static DataFlowBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<DataFlowBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<DataFlowBlockingStub>() {
@java.lang.Override
public DataFlowBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new DataFlowBlockingStub(channel, callOptions);
}
};
return DataFlowBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static DataFlowFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<DataFlowFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<DataFlowFutureStub>() {
@java.lang.Override
public DataFlowFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new DataFlowFutureStub(channel, callOptions);
}
};
return DataFlowFutureStub.newStub(factory, channel);
}
/**
*/
public static abstract class DataFlowImplBase implements io.grpc.BindableService {
/**
*/
public void update(com.yuandian.dataflow.rpc.Scheduler.State request,
io.grpc.stub.StreamObserver<com.yuandian.dataflow.rpc.Scheduler.Response> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getUpdateMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.yuandian.dataflow.rpc.Scheduler.State,
com.yuandian.dataflow.rpc.Scheduler.Response>(
this, METHODID_UPDATE)))
.build();
}
}
/**
*/
public static final class DataFlowStub extends io.grpc.stub.AbstractAsyncStub<DataFlowStub> {
private DataFlowStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected DataFlowStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new DataFlowStub(channel, callOptions);
}
/**
*/
public void update(com.yuandian.dataflow.rpc.Scheduler.State request,
io.grpc.stub.StreamObserver<com.yuandian.dataflow.rpc.Scheduler.Response> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getUpdateMethod(), getCallOptions()), request, responseObserver);
}
}
/**
*/
public static final class DataFlowBlockingStub extends io.grpc.stub.AbstractBlockingStub<DataFlowBlockingStub> {
private DataFlowBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected DataFlowBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new DataFlowBlockingStub(channel, callOptions);
}
/**
*/
public com.yuandian.dataflow.rpc.Scheduler.Response update(com.yuandian.dataflow.rpc.Scheduler.State request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getUpdateMethod(), getCallOptions(), request);
}
}
/**
*/
public static final class DataFlowFutureStub extends io.grpc.stub.AbstractFutureStub<DataFlowFutureStub> {
private DataFlowFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected DataFlowFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new DataFlowFutureStub(channel, callOptions);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<com.yuandian.dataflow.rpc.Scheduler.Response> update(
com.yuandian.dataflow.rpc.Scheduler.State request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getUpdateMethod(), getCallOptions()), request);
}
}
private static final int METHODID_UPDATE = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final DataFlowImplBase serviceImpl;
private final int methodId;
MethodHandlers(DataFlowImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_UPDATE:
serviceImpl.update((com.yuandian.dataflow.rpc.Scheduler.State) request,
(io.grpc.stub.StreamObserver<com.yuandian.dataflow.rpc.Scheduler.Response>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class DataFlowBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
DataFlowBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.yuandian.dataflow.rpc.Scheduler.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("DataFlow");
}
}
private static final class DataFlowFileDescriptorSupplier
extends DataFlowBaseDescriptorSupplier {
DataFlowFileDescriptorSupplier() {}
}
private static final class DataFlowMethodDescriptorSupplier
extends DataFlowBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
DataFlowMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (DataFlowGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new DataFlowFileDescriptorSupplier())
.addMethod(getUpdateMethod())
.build();
}
}
}
return result;
}
}

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/main/java/com/yuandian/dataflow/rpc/scheduler.proto
// source: scheduler.proto
package com.yuandian.dataflow.rpc;
@ -55,7 +55,7 @@ public final class Scheduler {
/**
* Protobuf type {@code com.yuandian.dataflow.rpc.State}
*/
public static final class State extends
public static final class State extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:com.yuandian.dataflow.rpc.State)
StateOrBuilder {
@ -67,6 +67,13 @@ public final class Scheduler {
private State() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new State();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
@ -92,7 +99,7 @@ public final class Scheduler {
done = true;
break;
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
queueMap_ = com.google.protobuf.MapField.newMapField(
QueueMapDefaultEntryHolder.defaultEntry);
mutable_bitField0_ |= 0x00000001;
@ -105,7 +112,7 @@ public final class Scheduler {
break;
}
default: {
if (!parseUnknownFieldProto3(
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
@ -178,6 +185,7 @@ public final class Scheduler {
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public boolean containsQueueMap(
int key) {
@ -186,6 +194,7 @@ public final class Scheduler {
/**
* Use {@link #getQueueMapMap()} instead.
*/
@java.lang.Override
@java.lang.Deprecated
public java.util.Map<java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> getQueueMap() {
return getQueueMapMap();
@ -193,6 +202,7 @@ public final class Scheduler {
/**
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public java.util.Map<java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> getQueueMapMap() {
return internalGetQueueMap().getMap();
@ -200,6 +210,7 @@ public final class Scheduler {
/**
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrDefault(
int key,
@ -212,6 +223,7 @@ public final class Scheduler {
/**
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrThrow(
int key) {
@ -278,11 +290,10 @@ public final class Scheduler {
}
com.yuandian.dataflow.rpc.Scheduler.State other = (com.yuandian.dataflow.rpc.Scheduler.State) obj;
boolean result = true;
result = result && internalGetQueueMap().equals(
other.internalGetQueueMap());
result = result && unknownFields.equals(other.unknownFields);
return result;
if (!internalGetQueueMap().equals(
other.internalGetQueueMap())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
@ -487,35 +498,35 @@ public final class Scheduler {
@java.lang.Override
public Builder clone() {
return (Builder) super.clone();
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
@ -591,6 +602,7 @@ public final class Scheduler {
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public boolean containsQueueMap(
int key) {
@ -599,6 +611,7 @@ public final class Scheduler {
/**
* Use {@link #getQueueMapMap()} instead.
*/
@java.lang.Override
@java.lang.Deprecated
public java.util.Map<java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> getQueueMap() {
return getQueueMapMap();
@ -606,6 +619,7 @@ public final class Scheduler {
/**
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public java.util.Map<java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> getQueueMapMap() {
return internalGetQueueMap().getMap();
@ -613,6 +627,7 @@ public final class Scheduler {
/**
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrDefault(
int key,
@ -625,6 +640,7 @@ public final class Scheduler {
/**
* <code>map&lt;int32, .com.yuandian.dataflow.rpc.QueueState&gt; QueueMap = 1;</code>
*/
@java.lang.Override
public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrThrow(
int key) {
@ -686,7 +702,7 @@ public final class Scheduler {
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
@ -742,13 +758,14 @@ public final class Scheduler {
/**
* <code>int32 Size = 1;</code>
* @return The size.
*/
int getSize();
}
/**
* Protobuf type {@code com.yuandian.dataflow.rpc.QueueState}
*/
public static final class QueueState extends
public static final class QueueState extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:com.yuandian.dataflow.rpc.QueueState)
QueueStateOrBuilder {
@ -758,7 +775,13 @@ public final class Scheduler {
super(builder);
}
private QueueState() {
size_ = 0;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new QueueState();
}
@java.lang.Override
@ -774,7 +797,6 @@ public final class Scheduler {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
@ -791,7 +813,7 @@ public final class Scheduler {
break;
}
default: {
if (!parseUnknownFieldProto3(
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
@ -826,7 +848,9 @@ public final class Scheduler {
private int size_;
/**
* <code>int32 Size = 1;</code>
* @return The size.
*/
@java.lang.Override
public int getSize() {
return size_;
}
@ -876,11 +900,10 @@ public final class Scheduler {
}
com.yuandian.dataflow.rpc.Scheduler.QueueState other = (com.yuandian.dataflow.rpc.Scheduler.QueueState) obj;
boolean result = true;
result = result && (getSize()
== other.getSize());
result = result && unknownFields.equals(other.unknownFields);
return result;
if (getSize()
!= other.getSize()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
@ -1060,35 +1083,35 @@ public final class Scheduler {
@java.lang.Override
public Builder clone() {
return (Builder) super.clone();
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
@ -1137,12 +1160,16 @@ public final class Scheduler {
private int size_ ;
/**
* <code>int32 Size = 1;</code>
* @return The size.
*/
@java.lang.Override
public int getSize() {
return size_;
}
/**
* <code>int32 Size = 1;</code>
* @param value The size to set.
* @return This builder for chaining.
*/
public Builder setSize(int value) {
@ -1152,6 +1179,7 @@ public final class Scheduler {
}
/**
* <code>int32 Size = 1;</code>
* @return This builder for chaining.
*/
public Builder clearSize() {
@ -1162,7 +1190,7 @@ public final class Scheduler {
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
@ -1218,28 +1246,32 @@ public final class Scheduler {
/**
* <code>int32 Code = 1;</code>
* @return The code.
*/
int getCode();
/**
* <code>string Message = 2;</code>
* @return The message.
*/
java.lang.String getMessage();
/**
* <code>string Message = 2;</code>
* @return The bytes for message.
*/
com.google.protobuf.ByteString
getMessageBytes();
/**
* <code>bytes Data = 3;</code>
* @return The data.
*/
com.google.protobuf.ByteString getData();
}
/**
* Protobuf type {@code com.yuandian.dataflow.rpc.Response}
*/
public static final class Response extends
public static final class Response extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:com.yuandian.dataflow.rpc.Response)
ResponseOrBuilder {
@ -1249,11 +1281,17 @@ public final class Scheduler {
super(builder);
}
private Response() {
code_ = 0;
message_ = "";
data_ = com.google.protobuf.ByteString.EMPTY;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new Response();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
@ -1267,7 +1305,6 @@ public final class Scheduler {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
@ -1295,7 +1332,7 @@ public final class Scheduler {
break;
}
default: {
if (!parseUnknownFieldProto3(
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
@ -1330,7 +1367,9 @@ public final class Scheduler {
private int code_;
/**
* <code>int32 Code = 1;</code>
* @return The code.
*/
@java.lang.Override
public int getCode() {
return code_;
}
@ -1339,7 +1378,9 @@ public final class Scheduler {
private volatile java.lang.Object message_;
/**
* <code>string Message = 2;</code>
* @return The message.
*/
@java.lang.Override
public java.lang.String getMessage() {
java.lang.Object ref = message_;
if (ref instanceof java.lang.String) {
@ -1354,7 +1395,9 @@ public final class Scheduler {
}
/**
* <code>string Message = 2;</code>
* @return The bytes for message.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getMessageBytes() {
java.lang.Object ref = message_;
@ -1373,7 +1416,9 @@ public final class Scheduler {
private com.google.protobuf.ByteString data_;
/**
* <code>bytes Data = 3;</code>
* @return The data.
*/
@java.lang.Override
public com.google.protobuf.ByteString getData() {
return data_;
}
@ -1436,15 +1481,14 @@ public final class Scheduler {
}
com.yuandian.dataflow.rpc.Scheduler.Response other = (com.yuandian.dataflow.rpc.Scheduler.Response) obj;
boolean result = true;
result = result && (getCode()
== other.getCode());
result = result && getMessage()
.equals(other.getMessage());
result = result && getData()
.equals(other.getData());
result = result && unknownFields.equals(other.unknownFields);
return result;
if (getCode()
!= other.getCode()) return false;
if (!getMessage()
.equals(other.getMessage())) return false;
if (!getData()
.equals(other.getData())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
@ -1634,35 +1678,35 @@ public final class Scheduler {
@java.lang.Override
public Builder clone() {
return (Builder) super.clone();
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.setField(field, value);
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return (Builder) super.setRepeatedField(field, index, value);
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return (Builder) super.addRepeatedField(field, value);
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
@ -1718,12 +1762,16 @@ public final class Scheduler {
private int code_ ;
/**
* <code>int32 Code = 1;</code>
* @return The code.
*/
@java.lang.Override
public int getCode() {
return code_;
}
/**
* <code>int32 Code = 1;</code>
* @param value The code to set.
* @return This builder for chaining.
*/
public Builder setCode(int value) {
@ -1733,6 +1781,7 @@ public final class Scheduler {
}
/**
* <code>int32 Code = 1;</code>
* @return This builder for chaining.
*/
public Builder clearCode() {
@ -1744,6 +1793,7 @@ public final class Scheduler {
private java.lang.Object message_ = "";
/**
* <code>string Message = 2;</code>
* @return The message.
*/
public java.lang.String getMessage() {
java.lang.Object ref = message_;
@ -1759,6 +1809,7 @@ public final class Scheduler {
}
/**
* <code>string Message = 2;</code>
* @return The bytes for message.
*/
public com.google.protobuf.ByteString
getMessageBytes() {
@ -1775,6 +1826,8 @@ public final class Scheduler {
}
/**
* <code>string Message = 2;</code>
* @param value The message to set.
* @return This builder for chaining.
*/
public Builder setMessage(
java.lang.String value) {
@ -1788,6 +1841,7 @@ public final class Scheduler {
}
/**
* <code>string Message = 2;</code>
* @return This builder for chaining.
*/
public Builder clearMessage() {
@ -1797,6 +1851,8 @@ public final class Scheduler {
}
/**
* <code>string Message = 2;</code>
* @param value The bytes for message to set.
* @return This builder for chaining.
*/
public Builder setMessageBytes(
com.google.protobuf.ByteString value) {
@ -1813,12 +1869,16 @@ public final class Scheduler {
private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>bytes Data = 3;</code>
* @return The data.
*/
@java.lang.Override
public com.google.protobuf.ByteString getData() {
return data_;
}
/**
* <code>bytes Data = 3;</code>
* @param value The data to set.
* @return This builder for chaining.
*/
public Builder setData(com.google.protobuf.ByteString value) {
if (value == null) {
@ -1831,6 +1891,7 @@ public final class Scheduler {
}
/**
* <code>bytes Data = 3;</code>
* @return This builder for chaining.
*/
public Builder clearData() {
@ -1841,7 +1902,7 @@ public final class Scheduler {
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFieldsProto3(unknownFields);
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
@ -1920,8 +1981,7 @@ public final class Scheduler {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n7src/main/java/com/yuandian/dataflow/rp" +
"c/scheduler.proto\022\031com.yuandian.dataflow" +
"\n\017scheduler.proto\022\031com.yuandian.dataflow" +
".rpc\"\241\001\n\005State\022@\n\010QueueMap\030\001 \003(\0132..com.y" +
"uandian.dataflow.rpc.State.QueueMapEntry" +
"\032V\n\rQueueMapEntry\022\013\n\003key\030\001 \001(\005\0224\n\005value\030" +
@ -1930,20 +1990,12 @@ public final class Scheduler {
"Response\022\014\n\004Code\030\001 \001(\005\022\017\n\007Message\030\002 \001(\t\022" +
"\014\n\004Data\030\003 \001(\0142[\n\010DataFlow\022O\n\006Update\022 .co" +
"m.yuandian.dataflow.rpc.State\032#.com.yuan" +
"dian.dataflow.rpc.Responseb\006proto3"
"dian.dataflow.rpc.ResponseB\002P\000b\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
});
internal_static_com_yuandian_dataflow_rpc_State_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_com_yuandian_dataflow_rpc_State_fieldAccessorTable = new

View File

@ -4,7 +4,7 @@ package com.yuandian.dataflow.rpc;
// option java_package = "com.yuandian.dataflow.rpc";
// option java_outer_classname = "com.yuandian.dataflow.rpc";
option java_multiple_files = false;//
service DataFlow {
rpc Update (State) returns (Response);