Commit Graph

462 Commits

Author SHA1 Message Date
Eric Anderson f894339923 request() is thread-safe
It is typically used for receiving, but is on the sending object. It
would be a pain for users to coordinate, and the implementation is
already thread-safe because we always thought it would be thread-safe.
So make it part of the documentation.
2015-09-11 17:36:23 -07:00
Eric Anderson 9cb36c6e20 Mark some APIs codegen uses experimental to allow for optimizations
Fixes #975
2015-09-11 11:13:27 -07:00
Carl Mastrangelo f6582d822d Add a hook to set TLS 2015-09-11 10:03:30 -07:00
Eric Anderson 538cf215f0 Add usePlaintext to ManagedChannelBuilder 2015-09-11 09:57:42 -07:00
Eric Anderson 5b2a03a02e Add overrideAuthority to ManagedChannelBuilder
We want to allow overriding authority in the ManagedChannelBuilder for
testing. In doing that, we basically require that all Channels support
authority. In reality, this simplifies things and is already being done
by the C implementation, as their unix domain socket support uses
"localhost" just like our in-process transport now does.

We can debate some whether "localhost" is really the most appropriate
authority for the in-process transport, but that should probably happen
later since "localhost" is "good enough" for now.
2015-09-11 09:37:49 -07:00
Eric Anderson 3ae18eaef1 Add overrideAuthority to NettyChannelBuilder
Although the functionality is currently available by passing a
manually-created InetAddress, that requires that the user do I/O before
calling our API and does not work with naming in the future.
2015-09-11 09:37:43 -07:00
Eric Anderson a6621daca2 Private ServerMethodDefinition constructor; avoid create() in codegen
There is no need to use ServerMethodDefinition in codegen. The create()
method itself could be helpful to a dynamic HandlerRegistry
implementation, so we won't remove it.
2015-09-11 09:25:24 -07:00
Carl Mastrangelo 416b745d8d Add a Server Provider 2015-09-10 12:23:17 -07:00
Eric Anderson df7bf44687 Enable license header checking in checkstyle 2015-09-10 11:29:00 -07:00
Carl Mastrangelo e969a900a0 Add proper generics to ManagedChannelProvider 2015-09-10 09:52:13 -07:00
Eric Anderson 31394aa9df Let transports be channel service providers for generic usage
This provides an API for applications to use gRPC without using
ExperimentalApis. It also allows swapping out a transport implementation
in the future.
2015-09-09 11:06:35 -07:00
Carl Mastrangelo 3cf76326a2 Move decompressor setting to Server Impl 2015-09-08 13:03:27 -07:00
Carl Mastrangelo 950fe1d108 Use ReqT and RespT for generics 2015-09-08 12:51:03 -07:00
Kun Zhang ae4ee40711 Fix flow-control documentation on Stream 2015-09-08 10:20:07 -07:00
Carl Mastrangelo 1ad2bf9eda Add a way to distinguish between advertised message encodings, and add tests 2015-09-04 14:42:45 -07:00
Carl Mastrangelo ebe8a0d703 Remove Metadata.Headers and Metadata.Trailers 2015-09-03 15:22:45 -07:00
Carl Mastrangelo f612746b97 Update comment in MethodDescriptor.Marshaller 2015-09-03 15:10:18 -07:00
Carl Mastrangelo 28d51c5e3e Add an authority header to HandlerRegistry.lookupMethod 2015-09-03 15:03:02 -07:00
Carl Mastrangelo 5d34599390 Daemonize InProcess threads 2015-09-03 14:57:20 -07:00
Louis Ryan 6a782a035e Use Executor in stable builder APIs instead of ExecutorService 2015-09-03 14:38:13 -07:00
Carl Mastrangelo f641e081a0 Daemonize shared threads, and make sure each thread has a name 2015-09-03 14:25:53 -07:00
Eric Anderson 6122dafee0 Add a missing channel builder methods not copied in b687bdc 2015-09-03 12:21:47 -07:00
nmittler b687bdc742 Refactoring channel API.
Client:
* New ManagedChannel abstract class.
* Adding ping to Channel.
* Moving builders and implementations to internal.

Server:
* Added lifecycle management API to Server (mirroring ManagedChannel).
* Moved ServerImpl, AbstractServerBuilder and handler registries to internal.
* New ServerBuilder abstract class (mirroring ManagedChannelBuilder).

Fixes #545
2015-09-03 11:22:29 -07:00
Kun Zhang 65b4e0b1f2 Document valid characters allowed in metadata keys 2015-09-03 10:49:04 -07:00
Xudong Ma 00e024c684 Fix Travis breakage caused by checkStyle failure. 2015-09-03 09:46:22 -07:00
Kun Zhang 609f31a578 Document valid characters for AsciiMarshaller 2015-09-02 15:57:07 -07:00
Carl Mastrangelo f8a87eecce Remove HandlerRegistry.Method 2015-09-02 14:37:44 -07:00
Eric Anderson 01ba973dd4 Prevent status from impacting how ServerCall.Listener is invoked
Fixes #639
2015-09-02 09:48:05 -07:00
Eric Anderson 210114d4a2 Ease use of JWT by passing URI to auth library
The URI no longer needs to be provided to the Credential explicitly,
which prevents needing to know a magic string and allows using the same
Credential with multiple services.
2015-09-01 15:42:58 -07:00
nmittler 6a526ecc93 Adding missing RunWith annotation for tests. 2015-09-01 11:40:17 -07:00
nmittler d3ab427fca Enforce content-type on client and server.
Fixes #360
2015-09-01 06:59:46 -07:00
Eric Anderson 949b6d7da8 Fields in MethodDescriptor can't be null 2015-08-31 17:48:05 -07:00
Carl Mastrangelo 396f0606f3 Add test to prove RST closes stream, and remove hack from transport to force closure. 2015-08-31 13:26:49 -07:00
Carl Mastrangelo d678498ca7 Add unit tests for AbstractServerStream 2015-08-28 13:00:27 -07:00
Stanley Cheung e4987cd1f2 update reference to grpc-common to examples 2015-08-27 16:10:33 -07:00
Carl Mastrangelo 080190c753 Make ServerCall.Listener methods Nops 2015-08-27 13:13:42 -07:00
Carl Mastrangelo 5ade1b726f Make ClientCall listener methods noops 2015-08-27 11:36:59 -07:00
nmittler bcdef34c52 Removing unused method in ServerImpl 2015-08-27 10:26:56 -07:00
nmittler 15f02ba19c Adding maxMessageSize config option
Fixes #832
2015-08-26 15:32:33 -07:00
Carl Mastrangelo 4221f5a81c Change ExperimentalApi field 'comment' to 'value' 2015-08-26 13:40:11 -07:00
Carl Mastrangelo cb734e3049 Document equals and hashCode on Status 2015-08-26 13:31:13 -07:00
Carl Mastrangelo b5eaaf378e Add @ExperimentalApi annotation to compression methods 2015-08-26 13:25:21 -07:00
Kun Zhang 8225d2a6a6 Add comment field to ExperimentalApi 2015-08-26 10:42:08 -07:00
Carl Mastrangelo 0d9ac41bdd Minor cleanup in deframer 2015-08-26 09:58:15 -07:00
nmittler 777e928536 Removing transport shutdown hooks from channel builder
The current process of building a channel is a bit complicated in that transports have to provide a own shutdown hook to the channel builder in order to close shared executors. This somewhat entagled creation pattern makes it difficult to separate the process of channel building from transport building. Better separating these two should make the code more readable and maintainable moving forward.
2015-08-25 08:38:39 -07:00
Xudong Ma 2247ad2a2b Makes application-provided string comes first in User-Agent 2015-08-24 19:42:16 -07:00
Kun Zhang 68c82bc2f3 Make ServerImpl constructor pakcage-private 2015-08-24 15:13:25 -07:00
Xudong Ma c5ea5c78cf Update Java doc for a508c1d4f5 2015-08-24 13:49:51 -07:00
Carl Mastrangelo a508c1d4f5 Remove Headers 2015-08-24 11:41:10 -07:00
Kun Zhang 7b6a498eff Annotate ServerEssentials, buildEssentials() and ServerImpl's constructor with @Internal 2015-08-24 10:17:00 -07:00
nmittler e2f88fa904 Moving a few common utilities to GrpcUtil. 2015-08-24 07:53:32 -07:00
nmittler aeae7a8e74 Rename HttpUtil to GrpcUtil.
It's not really just for HTTP, it has becoming a dumping ground for many internal constants/utilities.
2015-08-21 14:02:26 -07:00
Kun Zhang d68c101a55 Fix documentation on ClientCall.request().
request() is allowed after halfClose(), and is not necessarily forbidden
after cancel() (current implementation does not).
2015-08-21 08:59:49 -07:00
Carl Mastrangelo 701bbe509f Add unit tests to AbstractClientStream 2015-08-20 17:14:08 -07:00
Kun Zhang 042b278256 Remove the first MethodDescriptor constructor.
that takes the service name and method name separately.

Also fix tests that are still using the old full qualified method name
format.
2015-08-20 14:19:50 -07:00
Carl Mastrangelo 6ebf9b1373 fix comment 2015-08-20 13:19:16 -07:00
Xudong Ma 75f71c845b Avoid deprecation warning on import 2015-08-20 09:47:03 -07:00
Kun Zhang 1a0ee96423 Improve documentation for ClientCall. 2015-08-20 09:15:23 -07:00
Kun Zhang 687a6f4814 Skip io.grpc.internal in javadoc.
Also move ExperimentalApi and Internal to io.grpc, so that they appear
in javadoc.
2015-08-20 08:48:44 -07:00
Carl Mastrangelo 0b3fa8eece Remove unnecessary instanceof check 2015-08-17 15:49:33 -07:00
Carl Mastrangelo 77b00e050b Add Part 1 of compression 2015-08-17 11:32:52 -07:00
Eric Anderson e72332ce5d Add missing Generic param to Answers 2015-08-14 14:53:11 -07:00
Eric Anderson d12f454e1f Change Metadata.Trailers to Metadata in JavaDoc 2015-08-14 08:36:37 -07:00
Carl Mastrangelo 572f4332a7 Remove Trailers 2015-08-13 17:11:29 -07:00
Carl Mastrangelo 68fe049e35 Remove Deprecated newCall method on Channel 2015-08-13 13:24:37 -07:00
Xudong Ma ca7587f641 Change some error status usages to be consistent with other gRPC implementations. 2015-08-13 13:14:21 -07:00
Kun Zhang 0eb98621ed Annotations for unstable and internal interfaces.
- Add `@Internal` and `@ExperimentalApi`, both are annotated `@Internal`
- Annotate `@Internal` to `package io.grpc.internal`
- AbstractChannelBuilder.ChannelEssentials is annotated `@Internal`
- ChannelImpl.ping() is annotated `@ExperimentalApi`
- Context is annotated `@ExperimentalApi`
- Add `package-info.java` to `io.grpc.inprocess` and `io.grpc.internal`.
2015-08-12 15:03:23 -07:00
Kun Zhang e1bd6ef45f Clean up the left-over of the transport package reorganization 2015-08-11 12:48:02 -07:00
Kun Zhang f681b5f8be Move Marshaller into MethodDescriptor 2015-08-11 10:53:38 -07:00
Kun Zhang d2929cd1a3 Reorganize packages.
Reserve io.grpc for public API only, and all internal stuff in core to
io.grpc.internal, including the non-stable transport API.

Raise the netty/okhttp/inprocess subpackages one level up to io.grpc,
because they are public API and entry points for most users.

Details:

- Rename io.grpc.transport to io.grpc.internal;
- Move SharedResourceHolder and SerializingExecutor to io.grpc.internal
- Rename io.grpc.transport.{netty|okhttp|inprocess} to
  io.grpc.{netty|okhttp|inprocess}
2015-08-10 15:04:29 -07:00
Carl Mastrangelo 4b4f76da8c Remove deprecated classes from ServerInterceptors 2015-08-07 11:39:00 -07:00
Carl Mastrangelo 7d3d80e69f Add a javadoc for AbstractChannelBuilder.buildEssentials 2015-08-07 11:09:26 -07:00
Carl Mastrangelo 9b733b57e0 Add a javadoc for AbstractServerBuilder.buildEssentials 2015-08-07 10:01:48 -07:00
Carl Mastrangelo b141093b3b Make serverInterceptor use MethodDescriptor 2015-08-07 09:28:29 -07:00
Eric Anderson 6ff7b220b6 Improve generics in {Client,Server}Interceptors 2015-08-06 17:34:17 -07:00
Kun Zhang fc85a4085a Add more documentation for transports.
- Add package descriptions for transport, netty and okhttp.
- Describe transports (netty, okhttp and inprocess) in README
2015-08-06 17:24:42 -07:00
Xudong Ma b737435d0d Tighten up some access limit 2015-08-06 15:25:51 -07:00
Carl Mastrangelo aebb58b200 Change awaitTerminated to awaitTermination 2015-08-06 13:52:17 -07:00
Carl Mastrangelo a947178698 Remove deprecated ClientInterceptors classes 2015-08-06 13:46:02 -07:00
Carl Mastrangelo b7822e8f88 Fix javadoc, and remove deprecated classes 2015-08-06 12:27:45 -07:00
Kun Zhang 9992156bd8 Add available() to KnownLength 2015-08-06 10:04:31 -07:00
Carl Mastrangelo e76b8e7ee8 Renamed Server payload to message 2015-08-05 17:10:37 -07:00
Carl Mastrangelo 67fc45d036 Rename Duplex to Bidi 2015-08-05 17:05:47 -07:00
Eric Anderson e45c0c53d0 Fix shutting down a never-started ServerImpl 2015-08-05 16:56:55 -07:00
Xudong Ma ef106e0593 Make the change on status effective. 2015-08-04 18:06:25 -07:00
Eric Anderson f68c10baab Don't hold channel/server lock when shutting down transport
Holding the lock while calling the transport can cause a deadlock, as
shown in #696. In previous auditing for deadlock prevention I considered
heavily Call interactions, but failed to consider shutdown() and realize
it was holding a lock while calling transport.shutdown().

We still hold a lock when calling transport.start(). Although it is
conceivable that this could cause a deadlock as the code evolves over
time, I don't believe it can cause a deadlock today or that the risk is
very high. In addition, it would require more effort to solve.
2015-08-04 16:51:24 -07:00
Carl Mastrangelo 2c2c48a592 Implement Transport reconnect 2015-08-04 13:19:35 -07:00
Eric Anderson 248f575a59 Make any lib-generated UNKNOWN have description
Note that even more importantly, this translates a RST_STREAM error code
to a gRPC status code. This is generally useful, but also necessary for
DEADLINE_EXCEEDED to be more reliable in 0eae0d9.

Fixes #687
2015-08-03 11:15:02 -07:00
Carl Mastrangelo 384a80593d Remove all support for Payload 2015-08-03 10:04:01 -07:00
Carl Mastrangelo 88945e00f3 Make ServerImpl Use the common Scheduled Executor Service 2015-08-03 08:53:30 -07:00
Carl Mastrangelo 89db769d2d Rename sendPayload to sendMessage 2015-07-31 15:28:06 -07:00
Carl Mastrangelo d2b1b37ed7 Add a transport ready for use with retry 2015-07-31 15:24:44 -07:00
Carl Mastrangelo 14e774130d Rename onPayload to onMessage 2015-07-31 15:11:18 -07:00
Eric Anderson 8fe667676c Remove serializable distinction for Metadata
This does make use of the fact we are no longer using Multimap. Doing
entries() for ArrayListMultimap must create a new Map.Entry for every
entry. Since we are now using HashMap, we are able to use entries() with
no extra cost.

Merging particular Keys no longer needs to deserialize.
2015-07-30 14:09:21 -07:00
Eric Anderson a2292faf43 Optimize Metadata for reduced allocation count
Multimap creates at least one new object for every access, because all
the objects it returns are "live" and when mutated they need to update
the multimap's size. Many common operations thus require at least an
object allocation per key.

Note that previously remove() was non-functional as it removed the wrong
type from the multimap. The type system did not catch this because
remove() is passed an Object for all collection types.

The return type of removeAll() was changed to Iterable to prevent the
need of converting to Key if the caller doesn't consume the return
value.

Although it appears serialize() is now more expensive in terms of
allocations because it first accumulates into an ArrayList, the memory
usage is approximately the same since Multimap.values() makes an
Iterator for each key. The new code would allocate fewer bytes overall
and in fewer allocations, but the older code retained less memory while
processing. If we want to optimize serialize() we can track the number
of entries without needing to do any wrapping like Multimap does. I
didn't bother because the ArrayList is a fraction of the cost compared
to actually serializing the values.
2015-07-30 14:08:48 -07:00
Eric Anderson 50e28c2ca0 Make docs more strict for byte[] methods in Metadata 2015-07-30 14:07:04 -07:00
Eric Anderson 5698ccaee6 Fix invalid data sharing in Metadata.merge() 2015-07-30 14:07:03 -07:00
Carl Mastrangelo bd8987af1a Add a status to Transport shutdown 2015-07-29 15:35:38 -07:00
Carl Mastrangelo 4d2b3e3d06 Remove Intrinsic locking in ChannelImpl. 2015-07-28 07:16:03 -07:00
Carl Mastrangelo 6f7c5143f1 Stop using intrinsic locks in ServerImpl 2015-07-27 15:40:03 -07:00
Eric Anderson eba12fb514 Add missing generics to Context internals 2015-07-23 13:25:39 -07:00
Eric Anderson afdbe19937 Minor fixes/improvements
Cancel was the only method for implementing ClientStream that was not
final, even though it isn't really any different from the other methods.
2015-07-23 11:13:50 -07:00
Eric Anderson 5abe321b81 Fix deframing error handling
CANCELLED is certainly not the right status code. Communicating the
exception to the client removes the need for logging, which also makes
it more clear which call experienced the problem.
2015-07-23 11:13:48 -07:00
Eric Anderson 26d77ecd2e Minor readability changes
Improved some consistency. writeHeaders was the only non-final
implementation method of ServerStream, even though it is really no
different than the others.
2015-07-23 10:57:00 -07:00
Carl Mastrangelo 9a5c733ce9 Move CallImpl 2015-07-23 09:33:48 -07:00
Eric Anderson d11e9be127 Add in-process transport
Resolves #518
2015-07-22 15:54:37 -07:00
Eric Anderson 0df3d5e72a Add ClientInterceptors "inside" ChannelImpl
Fixes #538
2015-07-22 15:49:06 -07:00
Eric Anderson 3ce15b50b2 Reverse interceptor execution order
The previous order was unintuitive as the following would execute in the
reverse order:

Channel channel;
channel = ClientInterceptors.intercept(channel, interceptor1,
                                                interceptor2);
// vs
channel = ClientInterceptors.intercept(channel, interceptor1);
channel = ClientInterceptors.intercept(channel, interceptor2);

After this change, they have equivalent behavior. With this change,
there are no more per-invocation allocations and so calling 'next' twice
is no longer prohibited.

Resolves #570
2015-07-22 15:45:58 -07:00
Carl Mastrangelo 7b63909caf removed unused field 2015-07-22 15:22:01 -07:00
Carl Mastrangelo fe21e2799a Added copyright 2015-07-22 15:20:30 -07:00
Carl Mastrangelo 2eaeacafe8 Added basic unit test and reorg how onready calls are made
Forgot to add this last file

updated method name

Remove unused function

Remove helper function for threshold edge detection

Remove helper function for threshold edge detection

Re make listener abstract
2015-07-22 14:45:23 -07:00
Eric Anderson f81ed8e87b Clarify/improve transport interface requirements 2015-07-22 09:30:45 -07:00
Eric Anderson 7d22c09b2c Add Call state-checking enforcement to ChannelImpl and ServerImpl
The CallImpls in ChannelImpl and ServerImpl implement the Call
interfaces; they should be the ones ensuring that inappropriate calling
of methods is handled as the interface describes.
2015-07-22 09:30:44 -07:00
Eric Anderson dff29759a7 Fix reentrancy bug in ServerImpl during shutdown
Previously if the transport shut down immediately and during the
shutdown() call, the ServerImpl would never become terminated.
2015-07-22 09:30:42 -07:00
Eric Anderson 0eae0d9264 Make DEADLINE_EXCEEDED more reliable
The client can race with the server in cancelling due to deadline. If
server cancels we don't get DEADLINE_EXCEEDED, so double-check on
client-side to reduce the chances of losing the race.

Generally we expect the client to lose the race because of coarse timer
granularity for timer expirary. This change does little to help if the
server's clock runs noticably "fast" relative to the client.
2015-07-22 09:30:41 -07:00
Eric Anderson f48bc3b3eb Specify locale for toLowerCase in Metadata 2015-07-21 16:56:00 -07:00
Louis Ryan f6121165f9 Implementation of context API to allow for propagation of a limited amount of state through the
call stack and across thread boundaries.

Strongly modeled after the Go context API https://blog.golang.org/context with support for
- cancellation propagation & cancellation listeners
- typed value binding
- timeout/deadline

The major difference with Go is that ThreadLocal is used for propagation instead of parameter
passing as this is considered more idiomatic for Java.
2015-07-21 10:22:59 -07:00
Kun Zhang a6585e36ed Replace DeferredInputStream with interface Drainable.
- Rename flushTo() to drainTo().
- Remove flushTo() from DeferredNanoProtoInputStream (which is renamed
  to NanoProtoInputStream), because the optimization is not implemented.
- Rename DeferredProtoInputStream to ProtoInputStream.

 #529
2015-07-20 17:04:49 -07:00
Carl Mastrangelo 0003e44886 Add simple server timeout support
Reintroduce throws

Add timeoutExecutor shutdown

Use a default future

Move timeout cancellation

Cancel the timeout in error cases
2015-07-15 09:33:16 -07:00
Jack Coughlin 3e26b993ce Enforce request deadline
Use a ScheduledExecutorService in the ChannelImpl to terminate the
request by closing the ClientStream with status DEADLINE_EXCEEDED
2015-07-14 16:47:45 -07:00
Carl Mastrangelo 3ee5b5a752 Try to simplify server method definition 2015-07-09 14:06:47 -07:00
Kun Zhang 73acc73dbf Remove Method and switch its users to MethodDescriptor.
Resolves #511.

- In generated code, make CONFIG private and METHOD_* fields public.
  METHOD_* fields are MethodDescriptors now, users of the CONFIG field
  should switch to using the METHOD_* fields.
- Move MethodType into MethodDescriptor (#529).
- Unify the fully qualified method name. It is fully qualified service
  name + slash + short method name. It doesn't have the leading slash.
- HandlerRegistry switches the key from short method name to fully
  qualified method name.
2015-07-09 09:29:03 -07:00
nmittler a6c51e7e14 Fixing some compiler warnings. 2015-07-08 16:10:54 -07:00
nmittler 8c1d38a0d8 Adding default User-Agent for netty and okhttp. 2015-07-08 15:56:54 -07:00
Eric Anderson 35ff624eb2 Metadata.Key's name is non-null; don't check for null
There is a Preconditions.checkNotNull guaranteeing name is not null.
2015-07-08 15:10:02 -07:00
Eric Anderson d27cbc8aa3 Improve docs to describe close as being last method called
This isn't changing any of the semantics we already had, but more
informing users of the guarantees we provide.
2015-07-08 15:08:26 -07:00
Kun Zhang 7fff088e19 Fix a javadoc warning 2015-07-07 16:02:47 -07:00
Kun Zhang d3c5b00827 Add CallOptions.
- Pass CallOptions to Channel.newCall() and
  ClientInterceptor.interceptCall().
- Remove timeout from AbstractStub.StubConfigBuilder and add deadline,
  which is stored in a CallOptions inside the stub.
- Deadline is in nanoseconds in the clock defined by System.nanoTime().
  It is converted to timeout before transmitting on the wire. Fail the
  call with DEADLINE_EXCEEDED if it's already expired.
2015-07-07 14:28:38 -07:00
Eric Anderson 30455fd2f4 Remove unused variables 2015-07-06 16:27:22 -07:00
Eric Anderson a479c9116a Move timeout marshaller tests to ChannelImplTest
Now that ChannelImplTest exists, it makes more sense for them to be
there, since the implementation is in ChannelImpl.
2015-06-26 12:19:42 -07:00
Eric Anderson 45da9c5766 Add a few ChannelImpl tests and improve error status 2015-06-26 12:19:41 -07:00
Eric Anderson 9a2db9d7d9 Make ChannelImpl.obtainActiveTransport's fast path lock-free
Resolves #479
2015-06-26 12:19:41 -07:00
Eric Anderson c7403127ea Revert swapping to the "canonical HTTP mapping"
The mapping is poorly suited for gRPC. C and Go don't even do any
mapping. We can improve the mapping in the future, but it is very
important that users don't start depending on the current mapping.

This change is "inspired by" the original code, but is even more
conservative.

Fixes #477
2015-06-25 12:15:34 -07:00
Jack Coughlin 77878a04ee Pass timeout header in ChannelImpl 2015-06-17 16:03:13 -07:00
David Connelly 15104cdc69 Make sure we enter terminated state when transport server has been shut down and all server transports have been closed. Previously, we had only been checking if server transports were closed. Also, make sure termination cleanup is performed at most once with an AssertionError if checkForTermination() called when server has already been terminated 2015-06-15 13:04:11 -07:00
Josh Humphries 0d03f89467 add ping 2015-06-10 12:20:08 -04:00
Kun Zhang 2ee4d0228d Rename Call to ClientCalls.
Other classes are already following the convention that ClientFoo for
client-side, and ServerFoo for server-side. Call has been the black
sheep of the family.

- Call -> ClientCall
- Calls -> ClientCalls
- ForwardingCall* -> ForwardingClientCall*
2015-06-04 16:39:25 -07:00
Louis Ryan 641fc288fc Add support for indeterminate length messages. This will make using GRPC easier for non-proto payload types.
Sync to head
2015-05-26 15:44:46 -07:00
Xudong Ma 0d480879e5 okhttp: outbound flow control.
Fixes #371
2015-05-21 23:05:54 -07:00
Eric Anderson eb85d697c7 Set likely final size of array in toHttp2Headers
We know the size won't be more than serializedHeaders.length, is
unlikely to be fewer, and very unlikely to be substantially fewer. This
prevents us from needing to resize the array in all cases.

Resolves #321
2015-05-19 09:58:17 -07:00
Eric Anderson b69c59ce5f Decrease ArrayDeque memory in SerializingExecutor
By default, ArrayDeque will be of size 16, which is an overkill for most
calls. "4" is not a magical number itself, but seems a better guess than
16 since we do have some knowledge of how much it will contain.

Resolves #320
2015-05-19 09:55:25 -07:00
Eric Anderson 1787106cc7 isReady() should return false until stream allocated
isReady() can provide pushback while the call is in progress, but it
can also provide the pushback necessary when the client creates more
streams than permitted by MAX_CONCURRENT_STREAMS.

As part of this commit, OkHttp is now calling onReady() after call
creation (it previously never called onReady()).
2015-05-12 16:41:50 -07:00
nmittler 518b7dbf7c Slight performance improvment for MutableHandlerRegistryImpl 2015-05-12 09:56:45 -07:00
Eric Anderson 3462eb0e72 Handle OkHttp throwing exception during start()
Ideally OKHttp wouldn't do blocking I/O during start(), but it does and
fixing it is non-trivial. OkHttp can either throw an exception when it
encounters an error during start or it can shut itself down. Both
require changes in ChannelImpl, so we just choose to keep OkHttp's
current behavior and deal with it in ChannelImpl.
2015-05-07 18:52:21 -07:00
Eric Anderson 4e82a11311 Make Channel/Server abstract classes
Abstract classes allow us greater ability to change them over time. They
previously were interfaces to allow us to use Guava's AbstractService.
2015-05-07 16:41:52 -07:00
nmittler 1fa11cea1f Adding default implementation of onReady in Call and ServerCall 2015-05-07 10:52:07 -07:00
nmittler 64176d5560 Adding outbound flow control for Netty. 2015-05-04 12:19:57 -07:00
Louis Ryan f2cba89e48 Update Netty to 9d70cf3 to pick up https://github.com/netty/netty/commit/8271c8a which eliminates
explicit flushing from Nettys HTTP2 codec.
2015-05-01 13:00:04 -07:00
Eric Anderson 4a05869db7 Replace Operation*Exception with Status*Exception
Operation is a term no longer used in gRPC. StatusException seems clear
and is concise. Moved out of Status class to remove stuttering.

The return types of as*Exception() is now explicitly the
Status.*Exception type.
2015-05-01 08:43:37 -07:00
nmittler 7779b4fddf Cleaning up some warnings. 2015-04-30 13:57:38 -07:00