Commit Graph

915 Commits

Author SHA1 Message Date
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
Xudong Ma 7faeab6b45 Make NanoProtoInputStream package private 2015-08-06 11:12:32 -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 7d1e65c111 Switch ALPN/NPN to advertise only h2 2015-08-05 11:25:05 -07:00
Eric Anderson 2f799ed465 OkHttp should use plaintext in TransportBenchmark
Otherwise, OkHttp fails because it is connecting to a plaintext server.
2015-08-05 09:17:41 -07:00
Xudong Ma d1e15ab859 Fix serviceAccountCreds test and computeEngineCreds test.
See #702 for details.
2015-08-04 18:11:59 -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
Xudong Ma 512134b095 Android-Interop-test: fix lint errors/warnings, enable proguard. 2015-08-04 10:52:20 -07:00
Eric Anderson 41d875c7e3 Notify transportReady() in Netty 2015-08-03 16:50:05 -07:00
Kun Zhang 137b2ef8c3 Upgrade protobuf-gradle-plugin to 0.6.1 2015-08-03 13:41:48 -07:00
Xudong Ma c55657e3c5 Make new stream call asynchronous when the MAX_CONCURRENT_STREAMS is reached. 2015-08-03 11:38:18 -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 c86b547dd3 Forcibly cast in interop test 2015-07-31 15:22:09 -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
Xudong Ma abfdbf69e5 OkHttp: sync error map with gRpc spec. 2015-07-29 08:29:31 -07:00
nmittler a36f4af138 Fix flaky test 2015-07-28 16:35:52 -07:00
Xudong Ma dde1e809a7 Adjust @GuardedBy to pass internal GuardedBy Checking.
This is required by our internal sync.
2015-07-28 09:49:18 -07:00
Carl Mastrangelo 4d2b3e3d06 Remove Intrinsic locking in ChannelImpl. 2015-07-28 07:16:03 -07:00
Xudong Ma e36a64e6a6 Correctly handle unknown http2 error code. 2015-07-27 15:49:28 -07:00
Carl Mastrangelo 6f7c5143f1 Stop using intrinsic locks in ServerImpl 2015-07-27 15:40:03 -07:00
Xudong Ma 750f6265e2 Simplify locking model of OkHttp Transport, avoid potential deadlock.
1. Remove the stream lock, use transport lock instead.
2. Protected streams map with the transport lock instead of using synchronized map.
2015-07-27 08:13:19 -07:00
Jack Coughlin 1ac64bd09d Remove ServerDelayInterceptor from AbstractTransportTest 2015-07-27 07:25:41 -07:00
Eric Anderson eba12fb514 Add missing generics to Context internals 2015-07-23 13:25:39 -07:00
Kun Zhang 60cf5eb5da Use mutation methods for stub reconfiguration.
This makes the reconfiguration code more concise.

- Remove configureNewStub().
- Add mutation methods withDeadlineNanoTime(), withChannel() etc that
  returns the reconfigured stub.
2015-07-23 11:17:35 -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
Xudong Ma 659c4b1cbf Benchmark: Enable/Disable TLS for okhttp accordingly 2015-07-22 15:56:32 -07:00
Eric Anderson bf53a0e2e4 Add transport benchmark using JMH
The only benchmark method measures latency of a unary call in an
unloaded environment.
2015-07-22 15:54:41 -07:00