Commit Graph

940 Commits

Author SHA1 Message Date
Eric Anderson 521c55e9bd Avoid request threads on AppEngine Java 8
While the code had correctly determined full threads were available, the
call to MoreExecutors returned a request thread factory, which has
limitations.

Note that Async stub users may not be able to call GAE APIs in
callbacks. This is because the threads aren't request threads. They can
override the individual call's executor with
com.google.appengine.api.ThreadManager.currentRequestThreadFactory() in
an interceptor via callOptions.withExecutor().

Fixes #3296
2017-08-24 15:47:45 -07:00
John Hume 5c902c9384 Fix gson / opencensus bazel naming mixup
In 72b9ee2, gson kept its old name while opencensus got what should have
become gson's new name instead of a fixed opencensus name.
2017-08-23 15:48:08 -07:00
ZHANG Dapeng dafea0100a core: ForwardingChannelBuilder
Introduced `ForwardingChannelBuilder`, in the same pattern as `ForwardingClientCall` etc.
2017-08-23 12:48:12 -07:00
Kun Zhang 8d6ff4c9b4 core: enable Census trace context propagation. (#3361)
Note a Census tracing implementation, which is not included in gRPC,
is still required for tracing to work.
2017-08-18 17:19:52 -07:00
Kun Zhang 34857580ff core/test: remove ineffective assertions. (#3352)
The assertions are actually wrong and fail every time.  It doesn't
cause test failures because SharedResourceHolder calls them in a
scheduled executor because of its delayed close feature.

It's better to remove them, rather than leaving them there deceiving
us.
2017-08-16 15:59:48 -07:00
Kun Zhang 41410345e6 core: pass status to ManagedClientTransport.shutdown() (#3351)
This aligns with shutdownNow(), which is already accepting a status.
The status will be propagated to application when RPCs failed because
of transport shutdown, which will become useful information for debug.
2017-08-16 10:23:07 -07:00
ZHANG Dapeng c71e2919de all: fix typo of overridden
s/overriden/overridden/g
2017-08-11 16:53:53 -07:00
ZHANG Dapeng 8e0cf27822 core: use static imports for repeated state enums 2017-08-11 16:53:16 -07:00
Eric Gribkoff 9b74f8e756 core,netty,okhttp: add option to deframe in app thread 2017-08-11 16:52:45 -07:00
Eric Gribkoff a446b5388f core: switch to scheduled closing of MessageDeframer 2017-08-11 16:52:45 -07:00
Eric Gribkoff 16575d01a3 core,netty,okhttp,testing: switch to StreamListener.messagesAvailable 2017-08-11 16:52:45 -07:00
Paul Gross 72b9ee22b8 all: Fix mismatch in naming Bazel Maven jars
This commit aligns the naming of the Bazel Maven jars with the names
used by Bazel's migration-tooling project:

https://github.com/bazelbuild/migration-tooling

Unfortunately, we can't fix @com_google_protobuf_java because it's
required by Bazel itself.

Fixes #3328
2017-08-11 16:39:43 -07:00
myPrecious 13ef2261d6 core: Use bulk operation instead of iteration 2017-08-11 15:42:14 -07:00
ZHANG Dapeng 65ea0bde5d core,grpclb: deprecate LoadBalancer.Helper.updatePicker() 2017-08-10 17:05:54 -07:00
ZHANG Dapeng e5ef92c57c core: implement Channel State API for RoundRobin 2017-08-09 18:00:01 -07:00
ZHANG Dapeng 04fd4bc9b1 core: implement Channel State API for PickFirst 2017-08-09 17:59:34 -07:00
Eric Anderson c16edb3c90 core: Providers should consider Robolectric as Android
null class loader means to use the bootstrap class loader, which would
normally make sense. However, Robolectric tests run on OpenJDK and
provide the Android environment as part of the application, so "Android"
won't be present in the bootstrap class loader.
2017-08-09 11:01:15 -07:00
myPrecious f46280ae9f core: Java Refactor
Duplicate throws exception, and Javadoc issues: ManagedChannelImplTransportManagerTest.java has been deleted.
2017-08-09 09:11:19 -07:00
Kun Zhang 16f4de4636 core/stats: report message count metrics to Census. (#3312) 2017-08-04 15:58:21 -07:00
Carl Mastrangelo 02cb718767 testing,core: don't use mocks for stream tracers (#3305)
This is a big, but mostly mechanical change.  The newly added Test*StreamTracer classes are designed to be extended which is why they are non final and have protected fields.  There are a few notable things in this:

1.  verifyNoMoreInteractions is gone.   The API for StreamTracers doesn't make this guarantee.  I have recovered this behavior by failing duplicate calls.  This has resulted in a few bugs in the test code being fixed.

2.  StreamTracers cannot be mocked anymore.  Tracers need to be thread safe, which mocks simply are not.  This leads to a HUGE number of reports when trying to find real races in gRPC.

3.  If these classes are useful, we can promote them out of internal.  I just put them here out of convenience.
2017-08-03 16:59:06 -07:00
Eric Anderson c4f91272d2 all: Remove unused variables and squelch incorrect ErrorProne warning 2017-08-02 15:48:23 -07:00
Stephen Haberman db9b7ed8c0 Don't schedule multiple pings.
If onTransportActive ran while SendPing was already scheduled, we would
schedule another SendPing, which seems fine, but the server might observe
us sending pings too quickly, and make us GOAWAY.

Fixes #3274.
2017-08-01 11:25:24 -07:00
ZHANG Dapeng 18970e6ef3 core: fix ConnectivityStateManager is already disabled bug 2017-08-01 10:26:02 -07:00
Kun Zhang a3a306fd4e core: enable Census tags propagation by default. (#3294)
According to Census team, the tag wire format is now stable.
2017-07-31 14:55:48 -07:00
Eric Anderson 9be41ba0e8 core,auth: Stabilize auth flow using CallCredentials
As discussed in #1914, we need CallCredentials and MoreCallCredentials
to be stable, but there's less of a strong need for the contents of
CallCredentials to be stable. We're willing to commit to the name,
without needing to commit to the plumbing.
2017-07-27 18:07:18 -07:00
Kun Zhang 04e0450304 core: pass CallOptions to newClientStreamTracer(). (#3276)
Resolves #3256
2017-07-27 12:07:25 -07:00
Eric Anderson bd743f3afd core: Channel uses transport's ScheduledExecutorService
Coupled with the similar change on server-side, this removes the need for a
thread when using Netty. For InProcess and OkHttp, it would allow us to let the
user to provide the scheduler for tests or application-wide thread sharing.
2017-07-25 14:26:16 -07:00
ZHANG Dapeng 883a85ee93 core,netty,okhttp: remove 2-arg ClientTransport.newStream()
to keep only one `newStream()` method in the `ClientTransport` interface
2017-07-25 14:12:36 -07:00
Kun Zhang 0fb0fda3e1 core: Override SubchannelImpl.toString() (#3265)
LoadBalancer may log subchannels. This makes the logs more informative.
2017-07-21 17:13:35 -07:00
ZHANG Dapeng 946c29ac32 core: not to expose ClientCallImpl#cancelled() 2017-07-19 12:08:57 -07:00
ZHANG Dapeng 7e9e5a55b1 channel state API plumbing
This is only implementing how subchannel state changes are hooked up to channel state APIs. Debates in state semantics and transition rules for loadbalanced channel such as #2873 are not addressed. Any changes in state semantics and transition rules in the future can be easily adapted.
2017-07-19 11:56:00 -07:00
Eric Anderson 994f200d15 core: Server uses transport's ScheduledExecutorService
For Netty, this reduces the number of threads necessary for servers (although
until channel is converted, actual number of threads isn't impacted) and
naturally reduces contention and timeout latency.

For InProcess, this gets us closer to allowing applications to provide all
executors, which is especially useful during tests.
2017-07-19 10:31:26 -07:00
Eric Anderson d325919f62 core: Use Class.forName(String) in provider for Android
Class.forName(String) is understood by ProGuard, removing the need for
manual ProGuard configuration and allows ProGuard to rename the provider
classes. Previously the provider classes could not be renamed.

Fixes #2633
2017-07-19 10:15:03 -07:00
Carl Mastrangelo 84fce477c2 all: fix minor lint warnings 2017-07-17 17:21:07 -07:00
Carl Mastrangelo e60a179772 core: hide access to pseudo headers
Previously anyone could create metadata keys with a leading ":", due to not having a way to prevent it. This change effectively only allows internal code to make use of this.
2017-07-17 11:00:53 -07:00
ZHANG Dapeng 1661b51272 core: refactor SubchannelImpl
* refactor SubchannelImpl -> AbstractSubchannel

The old `SubchannelImpl` is actually not implementing anything, and the old `SubchannelImplImpl` has a weird name.
2017-07-14 11:05:09 -07:00
zpencer 26caa488a5 core: update javadocs regarding ClientCall mocks (#3140)
Change the @DoNotMock message to refer to InProcessServerBuilder, and include some usage examples that users may find useful.

fixes #3124
2017-07-13 08:19:29 -07:00
Bogdan Drutu 482b651605 core: Change gRPC to use io.opencensus:opencensus-api:0.5.1. (#3204) 2017-07-11 10:13:23 -07:00
Carl Mastrangelo 3a5f115dbc core: clarify security methods on channel and server 2017-07-07 10:56:54 -07:00
Eric Anderson c637b42b71 core: Stop using context ClassLoader in Providers
currentThread().getContextClassLoader() was originally used to match
ServiceLoader's default. ServiceLoader is mostly used with SPIs that
exist in the bootclasspath and so the class's ClassLoader would not
work. But in gRPC we have a library in the application's ClassLoader.

Context ClassLoader has been causing problems in any case more than one
application ClassLoader exists, like in Servlet containers, Android, and
plugins. To my knowledge, in every case the context class loader is
different from the provider's class loader, the context class loader has
caused breakage, not success. In addition, since we use static fields
for storing the provider results, using anything but the provider's
class loader is asking to have results that vary simply depending on
which thread called gRPC first.

Fixes #2375
2017-07-06 11:02:31 -07:00
Eric Anderson 7384ea9da1 core: Simplify ServerImpl constructor; testable Builder 2017-07-04 20:20:04 -07:00
Eric Anderson c436561fc5 all: Use fixed version number for java 6/7 signatures
This is important for stable builds, as if the signature changes the old source
may no longer validate.
2017-06-30 15:25:34 -07:00
Eric Anderson 6d8a66f3e3 core: Mark InternalNotifyOnServerBuilder @Internal
It is misnamed if it is @ExperimentalApi. Even being @Internal is
strange, since nothing in io.grpc actually uses it and so it could
actually be in io.grpc.internal.

I'm not trying to fix the API, but just make it slightly more
consistent.
2017-06-29 21:46:20 -07:00
Eric Anderson a3ac64a883 core: Move client-side decompressor selection to stream
Previously ClientCallImpl's stream listener would call
stream.setDecompressor(), but this has always been a bit strange as the
only case where the call listener calls the stream and forms a bit of a
loop. It also turned out to be racy in the presence of
DelayedClientStream since DelayedClientStream does not guarantee that
the listener has processed before returning.

Now we let the stream handle decompressor selection itself. Compressor
selection on client and server and decompressor selection on server
remain unchanged. Nothing prevents them from being changed, other than
it is currently unnecessary to fix the severe compressionTest flake.

Fixes #2865
Fixes #2157
2017-06-29 18:12:53 -07:00
Carl Mastrangelo 45085c3ce4 core: minor cleanup of 859d211b6e 2017-06-28 12:36:33 -07:00
Kun Zhang 4b94237bb9 core: stop spying ServerCall in UtilServerInterceptorsTest. (#3146)
Per our internal checker, DoNotMock applies to spy() too.
2017-06-27 17:15:43 -07:00
Eric Anderson 418c8846d0 core: Fix Bazel building for :util
It is now using io.grpc.internal.SerializingExecutor.
2017-06-27 11:10:34 -07:00
ZHANG Dapeng b7e50ddd05 testing: move NoopClientCall & NoopServerCall to internal
one step for #3105
2017-06-22 15:10:58 -07:00
Simon Horlick 6d9e149dcb build: Add Bazel java_grpc_library rule
Bazel third party dependencies are specified in repositories.bzl which
gives the consumer the ability to opt-out of any dependencies they use
directly in their own project.

Fixes #2756
2017-06-22 13:06:49 -07:00
Carl Mastrangelo 51ce204f53 inprocess: mark all classes final 2017-06-22 12:25:32 -07:00