Commit Graph

1365 Commits

Author SHA1 Message Date
Steven Parkes 385d61ac4e add a little detail about thread safety / fix typo (#1643) 2016-04-07 17:29:43 -07:00
Carl Mastrangelo 2c3a63fe75 Remove some array copies in metadata 2016-04-07 12:58:44 -07:00
Eric Anderson 996f30f43d Include protobuf-lite in javadoc and test coverage reporting 2016-04-06 15:28:26 -07:00
Kun Zhang 6a55e2990b Force thread group on threads created by Netty's DefaultThreadFactory.
As a workaround for https://github.com/netty/netty/issues/5084
2016-04-06 14:30:21 -07:00
Eric Anderson bd87b3f739 Allow nanoTime to wrap around in Deadline
A nanoTime result must be subtracted from another result to be useful;
you must do t1 - t2 < 0 instead of t1 < t2.
2016-04-06 12:08:31 -07:00
Eric Anderson d36a03c7b1 Use ticker in Deadline testing to remove flakes 2016-04-06 12:05:14 -07:00
Carl Mastrangelo b3bc7fc499 Try out using Truth library 2016-04-05 11:33:20 -07:00
buchgr c9de5d8d00 Update Netty dependency to 4.1CR6. 2016-04-04 21:49:56 +02:00
buchgr f561c33e00 Update Netty dependency to 4.1CR5. 2016-04-04 16:59:36 +02:00
Carl Mastrangelo 5c4ff7ad08 Remove unused method 2016-04-01 14:04:55 -07:00
Carl Mastrangelo f64a02f2ef Remove Flakes caused by assertEquals 2016-03-31 16:20:40 -07:00
Eric Anderson 2a5a41b600 Fix UNAVAILABLE codes missing descriptions
All status codes we generate from the library should have more
information available, either in the description or as a cause.
2016-03-31 09:51:33 -07:00
Eric Anderson 0a01b3cf42 Simplify nano flag to codegen to just 'nano' from 'nano=true'
'nano=true' still works, but any value is now ignored. This is to align
with our lite flag, but also just because It's Cleaner.

Note that this is counter to what javanano does. Javanano requires all
flags have a value and uses true/false for many values.
2016-03-30 09:34:22 -07:00
Kun Zhang 877e1e11eb Provide default implementation for NameResolver.refresh().
It is an optional operation anyway. In a pushing name system, refresh()
wouldn't be necessary.
2016-03-29 17:07:55 -07:00
Eric Anderson b22bcdfd18 Use lite argument in codegen instead of LITE_RUNTIME
This allows using the same proto file for both client and server without
forcing the server to use lite.
2016-03-29 16:19:56 -07:00
Kun Zhang 2d15af53c7 Retry DNS resolution when there is an error. 2016-03-29 16:15:39 -07:00
Kun Zhang 575df76a8f Trigger name resolution when a live connection closed.
In addition to when all addresses have failed to connect. This is to
cover the case where some addresses have changed in the name system
while some are still there and usable. Without this change, the client
would try to connect old addresses each time it reconnects.
2016-03-29 13:50:25 -07:00
Kun Zhang 49b462784f Raise visibility of NettyTransportFactory to protected.
It's needed by internal code.
2016-03-29 12:06:18 -07:00
Carl Mastrangelo d4615ff251 Fix flaky deadline test 2016-03-29 11:20:32 -07:00
Kun Zhang 7d49990783 Add RunWith annotation to AbstractStubTest.
It got an error when built internally.
2016-03-28 11:19:03 -07:00
Lukasz Strzalkowski 3ea153634f Retrun InProcessSocketAddr for InProcess server streams 2016-03-25 16:17:45 -07:00
Eric Anderson d77314ae68 Include sources for all files in 'fat' binary jar
Fixes #1420
2016-03-25 14:37:07 -07:00
Eric Anderson 5c4817723e Warn users shutdownNow doesn't behave as documented
This just places back a warning that was mistakenly removed in b687bdc.

Fixes #1500
2016-03-25 14:34:16 -07:00
buchgr 6e679401ea Allow Deadline.timeRemaining() to return a negative time offset. 2016-03-25 22:15:30 +01:00
buchgr 32ddf9f381 Make CallOptions and AbstractStub use Deadline.
- Made CallOptions use the Deadline type instead of a
  long to represent a deadline.
- Added new methods CallOptions.withDeadline(Deadline) and
  AbstractStub.withDeadline(Deadline). The methods are
  marked experimental, as the Deadline class is marked
  experimental. These methods are meant to replace
  CallOptions.withDeadlineNanoTime(Long) and
  AbstractStub.withDeadlineNanoTime(Long), which have
  been deprecated.
- Updated CallOptions.toString() to include all fields.
2016-03-25 22:15:22 +01:00
Eric Anderson 13f0122b2f Clean up bitrot from Android example
Bump version of gRPC used, remove copy of gradle wrapper, and use
updated proto.

Fixes #1493
2016-03-25 13:52:03 -07:00
Eric Anderson a40b686891 Revert "Refactor ExponentialBackoffPolicy"
This reverts commit a98f8afbbe.

There was no expectation across the languages that we would support
other policies for connection retry (changing a parameter would be on
the table, though).
2016-03-25 10:23:58 -07:00
Carl Mastrangelo e63bbaf8fb Merge pull request #1587 from lukaszx0/add-backoff-to-builder
Add backoffPolicyProvider to managed chan builder
2016-03-24 16:58:33 -07:00
Lukasz Strzalkowski a98f8afbbe Refactor ExponentialBackoffPolicy
This will allow new, custom, providers in the future.

We're also moving it out of internal package because it'll be
intended to use by users for providing their custom backoff
policies - `backoffPolicyProvider` method was added in order to do
that.
2016-03-25 00:12:18 +01:00
Kun Zhang 3be48b42e3 Refresh name resolution if all addresses failed to connect. 2016-03-24 14:37:49 -07:00
buchgr 88d31748c4 Update Netty dependency to 4.1CR4. 2016-03-24 21:17:04 +01:00
Eric Anderson c480cdf62f Remove cancel(Status) since it is now unused 2016-03-24 10:52:46 -07:00
Eric Anderson 3ead41141e Use stream.cancel() instead of cancel() in ClientCallImpl
Using cancel() sets cancelCalled=true which causes methods like
sendMessage() to throw IllegalStateException. This results in spurious
exceptions that are impossible to avoid. The API was designed to only
throw IllegalStateException when the caller called methods in the wrong
order, which is not the case here.

Fixes #1531
2016-03-24 10:44:50 -07:00
Carl Mastrangelo 65d3847d14 Remove references to Throwable.propagate 2016-03-22 15:47:52 -07:00
Eric Anderson 99a6d8de27 Add native support for Protobuf Lite
Lite already worked by using the protobuf project, but would bring in
extra dependencies that are not intended to work with lite. Although
protobuf is not yet providing a lite package on Maven Central, we will
be able to swap to it once it is available.

There isn't any new original code in the Java portion, except for a new
overload in ProtoUtils that accepts Message instead of MessageLite.
Depending on Message in ProtoUtils allows us to support extra features
out-of-the-box without any changes to the generated code. For example,
JSON encoding could be supported in this way if Marshaller is enhanced.

However, now codegen must be aware of Lite in order to choose with Util
class to use. That is new code.
2016-03-22 15:40:51 -07:00
buchgr 1ff6ecbb21 Fix flaky DeadlineTest.runOnEventualExpirationIsExecuted()
The test fails frequently on my MBP. I ran the test 10
times and the deadline took at most 63ms to expire. So I
bumped the timeout to 70ms.
2016-03-22 17:46:53 +01:00
Xiao Hang 37f45e332f Add idempotent related getter and setter to MethodDescriptor 2016-03-21 15:43:26 -07:00
buchgr fcda0bb9f7 Fix javadoc in MetadataUtils 2016-03-21 13:59:07 +01:00
Eric Anderson 3a920cdcca Add missing generics to some ServerCall usages 2016-03-17 17:05:25 -07:00
Lukasz Strzalkowski 14bc16e8eb Update Attributes.Key conventions
We don't need to require namespacing it's not necessery anymore
since object is used by the key, not key name.
2016-03-17 19:46:26 -04:00
Lukasz Strzalkowski c3011b0798 Move server call keys to ServerCall class 2016-03-17 19:46:26 -04:00
buchgr d927180a63 Use Netty's DefaultThreadFactory instead of Guava's ThreadFactoryBuilder.
So far, we have passed a custom Executor to the NioEventLoopGroup constructor,
in order to get custom thread names and be compatible with both Netty 4 and
Netty 5. However, Netty 5 is no more (RIP) and Netty's DefaultThreadFactory
includes some optimizations around thread local storage, that Guava's executor
does not have.

The thread names will be a bit different, as DefaultThreadExecutor additionally
puts in the thread pool id after the name prefix.

For example:

Before:
grpc-default-boss-ELG-0
grpc-default-worker-ELG-0
grpc-default-worker-ELG-1

After:
grpc-default-boss-ELG-0-0
grpc-default-worker-ELG-1-0
grpc-default-worker-ELG-1-1
2016-03-17 00:43:26 +01:00
buchgr 3c68c053f7 Remove ReferenceCounted and add close() to ClientTransportFactory. Fixes #927 2016-03-17 00:31:04 +01:00
Lukasz Strzalkowski 6a67a97a73 Add attributes to ServerCall 2016-03-16 15:39:42 -07:00
Lukasz Strzalkowski b37ebd6482 Add Key#of and Key#keys, use key object as map key, add tests 2016-03-16 15:39:42 -07:00
Carl Mastrangelo 12dfecba62 Chnage mispeling of jvaadoc in wihtLogiD 2016-03-16 10:38:27 -07:00
buchgr 8e3f375e95 Add null check for channel and calloptions when creating stub. Fixes #1438 2016-03-16 15:33:30 +01:00
Louis Ryan 7902017b07 Add CallStreamObserver and ServerCallStreamObserver which allow for application level interaction with flow control
while still allowing stubs to be used.
Currently these APIs are only useful on the server side, a separate proposal will be made for adding client support
An example of usage is in TestServiceImpl.streamingOutputCallManualFlowControl which listens for flow-control 'onReady' events and produces messages to the client.
Added some unit testing for ServerCalls
2016-03-15 16:45:45 -07:00
Louis Ryan de7ec3c682 Synchronize benchmarking protos with grpc/grpc 2016-03-15 14:05:07 -07:00
elandau 053a18e209 Use Attributes as the affinity data for LB.
- Remove RequestKey.
- Rename withRequestKey() to withAffinity(), which accepts an Attributes.
2016-03-14 15:13:42 -07:00