Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Watchdog - Refactor - #482

Merged
garrettjonesgoogle merged 4 commits into
googleapis:masterfrom
igorbernstein2:watchdog-context-prep
Feb 24, 2018
Merged

Watchdog - Refactor#482
garrettjonesgoogle merged 4 commits into
googleapis:masterfrom
igorbernstein2:watchdog-context-prep

Conversation

@igorbernstein2

@igorbernstein2igorbernstein2 commented Feb 16, 2018

Copy link
Copy Markdown
Contributor

This is in preparation for #480.

  • when the watchdog moves to ClientContext, it will be on by default, so check interval should be nonnull
  • when the timeouts move to ApiCallContext, they can be disabled via null not zero, so switch to those semantics
  • explicitly annotate everything else in ServerStreamingCallSetting for good measure
  • Convert the watchdog into a Runnable that is scheduled externally
  • Make idleTimeout configureable per watch
  • Rename Watchdog.IdleConnectionException -> WatchdogTimeoutException and make it toplevel
  • pushdown the generics from the Watchdog class to the Watchdog#watch method

Updates:

  • When the watchdog moves to ClientContext, it will need to be nullable to retain backward compatibility with existing builder sof ClientContext, so the watchdog needs to be nullable

This is ready for review. @garrettjonesgoogle PTAL

- when the watchdog moves to ClientContext, it will be always on, so check interval must be nonnull
- when the timeouts move to ApiCallContext, they be disabled via null not zero, so switch to those semantics
- explicitly annotate everything else in ServerStreamingCallSetting for good measure
- Convert the watchdog into a Runnable that is scheduled externally
- Make idleTimeout configureable per watch
- Rename Watchdog.IdleConnectionException -> WatchdogTimeoutException and make it toplevel
- pushdown the generics from the Watchdog class to the Watchdog#watch method
@codecov-io

codecov-io commented Feb 16, 2018

Copy link
Copy Markdown

Codecov Report

Merging #482 into master will decrease coverage by <.01%.
The diff coverage is 56%.

Impacted file tree graph

@@ Coverage Diff @@## master #482 +/- ##
============================================
- Coverage 70.34% 70.33% -0.01% - Complexity 773 775 +2 
============================================
Files 162 163 +1 Lines 3672 3668 -4 Branches 275 273 -2 ============================================
- Hits 2583 2580 -3 
Misses 973 973 + Partials 116 115 -1
Impacted FilesCoverage ΔComplexity Δ
...e/api/gax/rpc/RetryingServerStreamingCallable.java0% <0%> (ø)0 <0> (ø)⬇️
...rc/main/java/com/google/api/gax/rpc/Callables.java59.57% <0%> (-4.07%)6 <0> (ø)
...oogle/api/gax/rpc/ServerStreamingCallSettings.java71.42% <57.14%> (+2.57%)7 <0> (ø)⬇️
...m/google/api/gax/rpc/WatchdogTimeoutException.java66.66% <66.66%> (ø)2 <2> (?)
...le/api/gax/rpc/ServerStreamingAttemptCallable.java84.25% <75%> (-3.25%)17 <0> (ø)
...src/main/java/com/google/api/gax/rpc/Watchdog.java79.59% <80%> (+5.01%)6 <0> (ø)⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e8b4666...5e4b4fb. Read the comment docs.

@garrettjonesgooglegarrettjonesgoogle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach seems reasonable.

@garrettjonesgoogle

Copy link
Copy Markdown
Contributor

@vam-google PTAL also


Duration rpcTimeout = outerRetryingFuture.getAttemptSettings().getRpcTimeout();
if (rpcTimeout.isZero()) {
rpcTimeout = null;

This comment was marked as spam.

public class Watchdog<ResponseT> {
public class Watchdog implements Runnable {
// Dummy value to convert the ConcurrentHashMap into a Set
private static Object VALUE_MARKER = new Object();

This comment was marked as spam.

@igorbernstein2

Copy link
Copy Markdown
ContributorAuthor

Updated, PTAL

@vam-googlevam-google left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@igorbernstein2

Copy link
Copy Markdown
ContributorAuthor

@garrettjonesgoogle PTAL and if it looks ok, please merge and I will rebase #480

@garrettjonesgooglegarrettjonesgoogle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@garrettjonesgoogle
garrettjonesgoogle merged commit 2abf430 into googleapis:masterFeb 24, 2018
@igorbernstein2
igorbernstein2 deleted the watchdog-context-prep branch March 18, 2018 06:30
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@igorbernstein2@codecov-io@garrettjonesgoogle@vam-google