Commit Graph

298 Commits

Author SHA1 Message Date
Eric Anderson 5b838e5284 Apply maven-publish plugin explicitly when needed 2019-09-13 09:42:17 -07:00
Eric Anderson 55ac6f08af Apply JMH plugin explicitly when needed 2019-09-13 09:42:17 -07:00
edr 132e8bc8dd core: Add Attributes.Key for authority in EquivalentAddressGroup (#6126)
This enables NameResolvers to dynamically provide authority for each
Subchannel

Fixes #4469
2019-09-11 20:35:18 -07:00
Kun Zhang f9509694b9
context: allow creating Deadline with custom Ticker. (#6031)
This makes Deadline more test-friendly. Next step is to allow
ServerBuilder to take a custom Ticker and use it for creating
incoming Deadlines. With both changes in, application logic will be
able to verify the Deadlines they set.
2019-07-31 11:26:51 -07:00
ZHANG Dapeng 4114433674
doc: Add hint to users who want an experimental API to be stabilized 2019-07-26 09:22:53 -07:00
Mike Kobit 6615f2fc9d Add `@Nullable` to getter for trailers on `StatusRuntimeException` since the constructors allows it to be null 2019-07-09 15:56:42 -07:00
ZHANG Dapeng ea08150551
doc: Update javadoc that hedging is supported 2019-06-20 14:46:44 -07:00
Carl Mastrangelo 74e945ceb4
core,netty: block server shutdown until the socket is unbound 2019-06-19 17:23:08 -07:00
Kun Zhang c92c9e71bb
core: SubchannelStateListener continues to receive updates after LoadBalancer is shutdown. (#5883)
No more methods on the `LoadBalancer` will be called after
`LoadBalancer#shutdown()` is called.  This includes
`LoadBalancer#handleSubchannelState()` too.  `SubchannelStateListener`
inherited this restriction.  However, this special case makes
`onSubchannelState(SHUTDOWN)` an unreliable way of being notified
about `Subchannel` SHUTDOWN, and may confuse/complicate a
wrapping `LoadBalancer` that expects the full notification (e.g., #5875).

The javadoc isn't clear whether this restriction applies.  I think
it's more useful to make it no apply.
2019-06-14 14:43:54 -07:00
ZHANG Dapeng b69b15fddb
javadoc: exclude internal APIs
Fixes #5858 in master
2019-06-10 13:36:21 -07:00
Carl Mastrangelo 7657523b28
all: update to error prone 2.3.3 2019-06-05 15:28:43 -07:00
Manuel Kollus e526891a2b api,protobuf-lite: solve code style issues 2019-05-31 12:49:30 -07:00
Eric Anderson 3c931b40b0 api: Mention similarity of synccontext to a dedicated thread
This is the conceptual model we use. Document it to help aid others'
understanding and make it easier to understand when it is appropriate to
use.
2019-05-30 10:52:22 -07:00
Kun Zhang af2c16d301
api: deprecate Helper.updateSubchannelAddresses() and add equivalent on Subchannel (#5802)
Resolves #5676
2019-05-30 09:16:38 -07:00
Eric Anderson bc2e1764f6 api,stub: Clarify isReady()/onReady() interaction semantics 2019-05-29 17:28:45 -07:00
Tim van der Lippe ad0893737e Migrate org.mockito.Matchers#any* to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2.
However, there is a functional difference: ArgumentMatchers will reject
`null` and check the type if the matcher specified a type (e.g.
`any(Class)` or `anyInt()`). `any()` will remain to accept anything.
2019-05-29 16:53:01 -07:00
Chengyuan Zhang d86d3dd363
all: fix lint and revert redundant lint fixes in #5570 (#5787)
* Revert "all: fix lint (#5770)"

This reverts commit 00d4cc29ad.

* all: fix lint and revert redundant lint fix in #5570
2019-05-24 01:02:12 -07:00
Carl Mastrangelo cdeafcf6e0
core: add discard method for Attributes 2019-05-23 10:34:04 -07:00
Chengyuan Zhang 00d4cc29ad
all: fix lint (#5770)
* fixed lint warnings

* remove unused arg for subchannel
2019-05-23 01:05:22 -07:00
Kun Zhang f8fffeff12
api: add Subchannel.getInternalSubchannel(). (#5773)
Previously PickResult's Subchannel must be the actual implementation
returned from the Channel's Helper, and Channel would cast it to the
implementation class in order to use it.  This will be broken if
Subchannel is wrapped in the case of hierarchical LoadBalancers.

getInternalSubchannel() is the guaranteed path for the Channel to get
the InternalSubchannel implementation.  It is friendly for wrapping.

Background: #5676
2019-05-22 13:52:28 -07:00
Eric Anderson b6720c9fe6 api: Don't yet deprecate NameResolver.Listener
We think NameResolver.Listener2 may still change, so don't yet encourage
people to migrate.

Fixes #5764
2019-05-21 17:49:08 -07:00
Eric Anderson 15a453d9ef api: Fix doc for default value of idleTimeout()
It appears the docs were not updated when this was changed in d74091f5, which
was first released in v1.1.
2019-05-21 13:48:57 -07:00
Kun Zhang a2595d9e7d
api/core/grpclb: add warning about calling Subchannel.requestConnection() outside of sync-context (#5757)
The pick_first policies in core and grpclb previously would call
Subchannel.requestConnection() from data-path.  They now will schedule
that call in the sync-context to avoid the warning.  They will only
call it for the first pick of each picker, to prevent storming the
sync-context.
2019-05-20 11:39:02 -07:00
Kun Zhang 7934594dfe
api: pass Subchannel state updates to SubchannelStateListener rather than LoadBalancer (take 2) (#5722)
This is a revised version of #5503 (62b03fd), which was rolled back in f8d0868. The newer version passes SubchannelStateListener to Subchannel.start() instead of SubchannelCreationArgs, which allows us to remove the Subchannel argument from the listener, which works as a solution for #5676.

LoadBalancers that call the old createSubchannel() will get start() implicitly called with a listener that passes updates to the deprecated LoadBalancer.handleSubchannelState(). Those who call the new createSubchannel() will have to call start() explicitly.

GRPCLB code is still using the old API, because it's a pain to migrate the SubchannelPool to the new API.  Since CachedSubchannelHelper is on the way, it's easier to switch to it when it's ready. Keeping
GRPCLB with the old API would also confirm the backward compatibility.
2019-05-17 16:37:41 -07:00
Kun Zhang ae14c8d061
api: temporarily remove the warning about sync-context in requestConnection(). (#5738) (#5752)
Contrary to #5736, we will still keep the sync-context requirement of
requestConnection(), because it prevents API fragmentation.
PickFirstLoadBalancer is the only known violator.  We will fix it on
master, but we don't want to make that change on 1.21.x because the
release is soon.  We simply remove the warning in this release so that
users won't be annoyed.

This supersedes #5736
2019-05-16 13:07:10 -07:00
Kun Zhang cec9ee368d
api: move SubchannelPicker.requestConnection() to LoadBalancer. (#5751)
We will require Subchannel.requestConnection() to be called from
sync-context (#5722), but SubchannelPicker.requestConnection() is
currently calling it with the assumption of thread-safety.  Actually
SubchannelPicker.requestConnection() is called already from
sync-context by ChannelImpl, it makes more sense to move this method
to LoadBalancer where all other methods are sync-context'ed, rather than
making SubchannelPicker.requestConnection() sync-context'ed and fragmenting
the SubchannelPicker API because pickSubchannel() is thread-safe.

C++ also has the requestConnection() equivalent on their LoadBalancer
interface.
2019-05-16 09:50:23 -07:00
Kun Zhang 0c17c4c995
api: make LoadBalancer.Helper and Subchannel further non-thread-safe. (#5718)
I see more cases of wrapping Helper and Subchannel during the work of
XdsLoadBalancer, we will require that all methods that involve mutable
state to be called from the Synchronization Context.  We will start
logging warnings first, and make them throw in a future release.

Helper.createSubchannel() is already doing so.  This change adds
warnings to the other eligible methods.

https://github.com/grpc/grpc-java/issues/5015
2019-05-09 18:13:46 -07:00
Kun Zhang 175a423c10
api: add getters for NameResolver.Args and NameResolverRegistry in LoadBalancer.Helper (#5685)
Hierarchical LoadBalancers such as xDS will need this to create NameResolvers to resolve locality target names.
2019-05-09 15:55:18 -07:00
Eric Anderson 980dd9671d api: Rename NameResolver.Observer to Listener2
This follows the sort of changes we've done in the past, where the '2'
implies "version 2." We can end up reclaiming the original name if we
wish in the future.

The main reason for this change is to avoid changing to Observer since
the rest of io.grpc consistently uses Listener.
2019-05-08 20:00:35 -07:00
Kun Zhang f8d0868e1d
Revert "core: pass Subchannel state updates to SubchannelStateListener rather than LoadBalancer (#5503)" (#5684)
This reverts commit 62b03fd7e6.

Effectively reverts its follow-up commits:
dc218b6d4d
405d8c3865
44840fe813
2019-05-08 09:01:45 -07:00
Eric Anderson 257bb546fd api: Discourage using ClientInterceptor for credentials 2019-05-06 17:03:44 -07:00
ZHANG Dapeng 72553433b3
api: fix LoadBalancer javadoc links 2019-05-06 11:17:35 -07:00
Kun Zhang 63f636b4b6
api: NameResolver.Args deprecates NameResolver.Helper. (#5664)
Having two Helpers (the other being LoadBalancer.Helper) is proven to
be confusing, and the one in NameResolver is fundamentally different
from the one from LoadBalancer, as the latter mutates the states while
the former doesn't. Renaming it to Args make it less awkward to
expose it to LoadBalancer, which is needed for creating NameResolvers
for per-locality routing in the XdsLoadBalancer.
2019-05-03 16:45:38 -07:00
Kun Zhang 973885457f
core: change ClientStreamTracer.StreamInfo to a final class with a builder (#5648)
As we are now endorsing the wrapping of ClientStreamTracers by
providing ForwardingClientStreamTracer, there is a need for altering
StreamInfo, especially CallOptions before it's passed onto the
delegate.  A Builder class and a toBuilder() provides a robust way
to copy the rest of the fields.

This is a breaking change for anybody who creates StreamInfo, which is
unlikely in non-test code, because StreamInfo was added as late as
1.20.0.
2019-04-30 09:10:56 -07:00
Chengyuan Zhang 44840fe813
api: fix bugs of missing to copy customOptions when converting to a new builder, also trash hashCode/equals (#5647)
* api: fix bugs of missing out customOptions in CreateSubchannelArgs toBuider, hashCode, equals

* trash equals/hashCode for CreateSubchannelArgs as they are problematic
2019-04-29 18:40:11 -07:00
Chengyuan Zhang 405d8c3865
api: patch CreateSubchannelArgs toString() with customOptions (#5646) 2019-04-29 14:54:59 -07:00
Chengyuan Zhang dc218b6d4d
api: augment CreateSubchannelArgs with custom options (#5640)
* api: augment CreateSubchannelArgs with custom options

* added unit tests

* added ExperimentalApi anntation with tracking issue
2019-04-26 13:59:37 -07:00
Kun Zhang d530641097
core: annotate experimental API's inner classes. (#5643)
Annotations on outer class don't show on the javadoc of inner classes.
2019-04-26 11:28:48 -07:00
Carl Mastrangelo 53a3f12666
api: expose if waitForReady has been set on CallOptions 2019-04-25 10:56:40 -07:00
Carl Mastrangelo ce6358e57f
core: add getService to MethodDescriptor 2019-04-24 17:45:41 -07:00
Eric Anderson 187fe9e146 Lint fixes 2019-04-23 14:51:34 -07:00
Carl Mastrangelo 04e07034f3
all: update to truth 0.44 2019-04-23 10:50:49 -07:00
Eric Anderson f4d48fec62
core: Add NameResolverRegistry
NameResolverRegistry takes on all the logic previously in
NameResolverProvider. But it also allows manual registration of
NameResolvers, which is useful when the providers have complex
construction or need objects injected into them.

This also avoids a circular dependency during class loading since
previously loading any Provider searched for all Providers via
ClassLoader since ClassLoader handling was static within the parent
class.

Fixes #5562
2019-04-22 10:22:46 -07:00
Jean de Klerk b363f80764 docs: add note about retrying UNAVAILABLE 2019-04-19 14:29:13 -07:00
Eric Anderson 7c0e14318e api: Stabilize MethodDescriptor.Marshaller
Fixes #1777
2019-04-19 10:32:42 -07:00
Kun Zhang 39e66fa22b
core: delete ManagedChannelBuilder.loadBalancerFactory() and all deprecated factories (#5480)
This has been deprecated since 1.18.0
2019-04-17 14:46:19 -07:00
Carl Mastrangelo a395eec4a3
core: update LB and NR API names
Updates #1770
2019-04-17 12:45:29 -07:00
Eric Anderson 80c3c992a6 core: Move io.grpc to grpc-api
io.grpc has fewer dependencies than io.grpc.internal. Moving it to a
separate artifact lets users use the API without bringing in the deps.
If the library has an optional dependency on grpc, that can be quite
convenient.

We now version-pin both grpc-api and grpc-core, since both contain
internal APIs.

I had to change a few tests in grpc-api to avoid FakeClock. Moving
FakeClock to grpc-api was difficult because it uses
io.grpc.internal.TimeProvider, which can't be moved since it is a
production class. Having grpc-api's tests depend on grpc-core's test
classes would be weird and cause a circular dependincy. Having
grpc-api's tests depend on grpc-core is likely possible, but weird and
fairly unnecessary at this point. So instead I rewrote the tests to
avoid FakeClock.

Fixes #1447
2019-04-16 21:45:40 -07:00