Commit Graph

6548 Commits

Author SHA1 Message Date
nathanmittler 63271f4729 Fixing a compatibility issue between the GFE and gRPC java client for the V2 protocol.
The GFE should not be sending DATA frames with endOfStream=true.
However to make things work in the short-term, if we receive one we
still need to process the DATA frame.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80243944
2015-01-08 14:43:09 -08:00
nathanmittler 5d953e840b Updating gRPC code to use the latest Netty with application-level flow control support.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=80230204
2015-01-08 14:43:09 -08:00
ejona 01152e093d Fix workaround in place for GFE's lack of trailers.
A recent refactoring moved code so our previous workaround stopped
producing any effect.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79965647
2015-01-08 14:43:08 -08:00
ejona 0f56c47ac8 Handle exceptions thrown by the application
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79895899
2015-01-08 14:43:08 -08:00
lryan 1f2a1869e5 Fix NullPointerException in AbstractServerStream when deframer reports error and fix error message propagation
Improve detail of deframer error reporting to client

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79799152
2015-01-08 14:43:07 -08:00
zhangkun aa0b7cc9af Forbid calling next more than once in interceptors.
Will throw IllegalStateException.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79717262
2015-01-08 14:43:07 -08:00
lryan 4073a8a1a7 Remove redundant field from AbstractClientStream
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79592498
2015-01-08 14:43:07 -08:00
lryan 669724a588 Rationalize the XXXStream classes to reduce code smear and make Netty/OkHTTP behave more consistently.
More cleanups to follow
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79574504
2015-01-08 14:43:06 -08:00
ejona ff669ac9c2 More precise Builder generics
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79430607
2015-01-08 14:43:06 -08:00
ejona ba653d4bd0 Move StubConfigTest to third_party
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79430433
2015-01-08 14:43:05 -08:00
ejona 2a93c47657 Remove GrpcServer to allow more tests to move to third_party.
GrpcServer had the same restriction that GrpcClient did: it had a
single enum of all transports that prevents using it in third_party.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79428440
2015-01-08 14:43:05 -08:00
ejona 1553aabb2f Advertise h2-15 in ALPN negotiation.
We continue to support h2-14 to prevent having a flag-day. Flag-day
is unnecessary since h2-15 is pretty much the same as h2-14.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79369997
2015-01-08 14:43:05 -08:00
zhangkun a71d887661 Make all transport factories package-private in favor of channel builders.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79367593
2015-01-08 14:43:04 -08:00
zhangkun 776ff86687 Eliminate ForwardingChannel and switch all use cases to client interceptors.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79360027
2015-01-08 14:43:04 -08:00
zhangkun 48e734d7e3 Dedicated ClientInterceptor interface and utilities.
This will replace the channel-wrapping technique as the official
solution of intercepting calls on the client side. It is done in the
same manner as ServerInterceptor.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79280263
2015-01-08 14:43:04 -08:00
ejona 9a148a5022 Remove outbound flow control interface.
We know we don't like the API, but don't yet have the new one in place.
Remove the old one now instead of waiting further, because we are
getting more users who are more likely to try to start using the API.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79090165
2015-01-08 14:43:03 -08:00
ejona 3d4ea0d348 Implement standard integration tests (almost).
Our pre-existing tests were slightly different from the integration
tests to be implemented in each language. Change our implementation to
match.

Unfortunately, the standard tests actually trigger Netty flow control
bugs, so we decrease stream sizes to <64K as a workaround.

Because the tests now compare to golden responses, they detected that
the cpp server was sending all a's instead of all 0s. That is now fixed.

We receive errors hitting CPP server for empty_unary and the various
streaming tests, so java_cpp isn't enabled in interop_scenarios.txt.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=79086882
2015-01-08 14:43:03 -08:00
ejona e813eaae2f [3/3] Use AbstractTransportTest for test case impls in TestServiceClient.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78862990
2015-01-08 14:43:03 -08:00
ejona 97d3ade2ea [2/3] Use transport builders instead of ClientBootstrap.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78861122
2015-01-08 14:43:03 -08:00
ejona 9a5a8de65d [1/3] Move AbstractTransportTest to third_party.
This required making it no longer depend on GrpcClient. Instead, we now
use the builders that make using GrpcClient almost completely obsolete.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78860648
2015-01-08 14:43:02 -08:00
simonma 8b0b46eff5 Move examples to third_party.
Remove FormattingLogger usage.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78798688
2015-01-08 14:43:02 -08:00
nathanmittler ffc18f6c57 Adding MOE configuration for grpc_java.
The TestService proto is temporarily supplied as a generated jar (until the open source protoc compiler supports grpc).

Copies of messages.proto, empty.proto, and message_set.proto are scrubbed and included in the source under integration-testing.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78711468
2015-01-08 14:43:02 -08:00
zhangkun 7dc48e2787 SharedResourceHolder is a utility that manages expensive resources (thread
pools etc) that are shared among channels and servers as default values when
the application doesn't provide its own.

It uses reference counting to shut down resources with a delay.

Changed the channel and server builders to use it for default values of
executors and event loop groups.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78629204
2015-01-08 14:43:01 -08:00
lryan 8fc81f4a37 Fix compile error using new ProtoUtils
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78611659
2015-01-08 14:43:01 -08:00
nathanmittler 29cbef1f9b Renaming gRPC-java "newtransport" package to just "transport".
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78596663
2015-01-08 14:43:00 -08:00
simonma 3c986bbcdb Move protobuf code dependencies to net/stubby/proto
Remove needless proto dependencies from tests

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78593107
2015-01-08 14:42:59 -08:00
ejona 2dbae4d4f2 Use zero-filled payload for UNCOMPRESSED.
Previously we were using English text, but this just adds extra effort for all
the other languages that will need to implement servers. The integration test
case descriptions uses zero-filled bytes.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78477356
2015-01-08 14:42:59 -08:00
nathanmittler 0304b3d6b2 Cleaning up various compiler warnings in preparation for opensource.
overview:
1) Lots of @SuppressWarnings :)

2) Remove dependencies on StandardCharsets.XXX (which is Java 7)

3) Moved testing/utils/ssl/* to .../stubby/util so that the netty transport doesn't depend directly on the testing module.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78460727
2015-01-08 14:42:59 -08:00
ejona 96e6ed9c53 Define threading requirements of StreamObserver
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78404413
2015-01-08 14:42:58 -08:00
ejona df9867def9 Support early-OK from Server.
The semantics in gRPC changed where server sending OK before client
half-closes is now permitted.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78404390
2015-01-08 14:42:58 -08:00
ejona 0a585333ce Pre-serialize status codes, for efficiency
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78401520
2015-01-08 14:42:58 -08:00
nathanmittler 905d387e4f Porting GrpcClient and GrpcServer to third_party.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78372524
2015-01-08 14:42:58 -08:00
ejona 46118bb195 Add server support for TLS.
Note that we don't yet have plumbing to use a particular certificate for tests, so it isn't integration-test worthy yet.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78369023
2015-01-08 14:42:57 -08:00
simonma 988f219b04 Handle Headers and Trailers in OkHttp client transport.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78313233
2015-01-08 14:42:57 -08:00
yangg 8b4ecad497 Use "/" instead of "." as the separator between service name and client name.
Change from /Service.method to /Service/method.

quote from the spec:
Method (required): a path identifying the operation to perform on the
specified host, conforming to RFC 3986 sec 3.3. E.g
“/calendar.v1/ListEvents”
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78288091
2015-01-08 14:42:57 -08:00
simonma 1e55c6e3f1 Remove Deframer and InputStreamDeframer since we are not using them anymore.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78211270
2015-01-08 14:42:57 -08:00
simonma 2ce8215b0c Fix bug 18054433, only register one listener on transport service.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78112905
2015-01-08 14:42:56 -08:00
nathanmittler 28fb46ef49 Updates to migrate to the latest Netty version.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78008410
2015-01-08 14:42:56 -08:00
lryan 28497e3c7e Add support for servers to deliver response headers
Fixes some propagation issues for trailers too
Adds some more testing for metadata exchange

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77979593
2015-01-08 14:42:56 -08:00
simonma 29d8c03636 Support inbound flow control in okhttp transport, and the first step to support V2 protocol.
Will add the header/trailer support in the following cl.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77975189
2015-01-08 14:42:55 -08:00
zhangkun b95c094e7f The client and server usage examples based on stock.proto.
Also add forAddress(String host, int port) to NettyChannelBuilder.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77909737
2015-01-08 14:42:55 -08:00
simonma fcab51cc16 Don't send 0-length data frame.
In V2 protocol, we don't send endOfStream in data frame, so there is no point to send a 0-length data frame.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77864520
2015-01-08 14:42:55 -08:00
zhangkun 8d6d12e4c4 Convenient builders for channels and servers.
Right now only netty-based builders are implemented. OkHttp based
builders will be created separately.

Minimal example of creating a stub:
ChannelImpl channel = NettyChannelBuilder
.newBuilder(new InetSocketAddress("localhost", 8980))
.buildAndWaitForRunning();
StockBlockingStub stub = StockGrpc.newStub(channel);

Minimal example of creating and starting a server:
ServerImpl server = NettyServerBuilder.newBuilder(8980)
.addService(StockGrpc.bindService(new StockServer()))
.buildAndWaitForRunning();
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77787502
2015-01-08 14:42:55 -08:00
ejona 3411fda784 Implement trailer support in Netty transport
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77365751
2015-01-08 14:42:55 -08:00
ejona 8c76c8a1d0 Remove Java 7isms and fix Maven compilation
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77353600
2015-01-08 14:42:54 -08:00
nathanmittler c1f4b7303f Adding shutdown logic to NettyServerTransport.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77349840
2015-01-08 14:42:54 -08:00
ejona de0a16cad3 Use something closer to the appropriate mime-type.
This is necessary for a C client to talk to the Java server.

Technically, we should be using application/grpc+proto, but since the
"proto" portion is marshaller-dependent, we will need more plumbing
before we can use the complete form.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77271620
2015-01-08 14:42:54 -08:00
ejona dd7ba53cf8 gRPC status is always sent as ASCII.
As discovered during integration testing.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77271565
2015-01-08 14:42:54 -08:00
simonma 55892febdd Send connection preface and setting when the okhttp client transport starts, this is required for talking to netty server.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=77104268
2015-01-08 14:42:53 -08:00
lryan 125c1cee69 Delete Session, Operation and ALL of its associated cruft.
This CL also:
- Removes the OkHTTP server implementation
- Switches NanoTest and Http2OkHttpTest to use Netty server. These tests are currently @Suppressed as OkHttp is not yet draft 14 compliant. Simon is fixing
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=76998151
2015-01-08 14:42:53 -08:00