Skip to content

Conversation

@ammachado
Copy link
Contributor

No description provided.

@ammachado ammachado requested a review from a team September 11, 2024 15:13
@codecov
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.01%. Comparing base (18d192d) to head (6db18c5).
Report is 42 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #6712 +/- ## ============================================ - Coverage 90.09% 90.01% -0.08%  - Complexity 6390 6482 +92  ============================================ Files 711 719 +8 Lines 19333 19585 +252 Branches 1891 1931 +40 ============================================ + Hits 17418 17630 +212  - Misses 1335 1355 +20  - Partials 580 600 +20 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jkwatson jkwatson left a comment

Choose a reason for hiding this comment

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

This is a good idea. This PR needs some more testing, as there are bunch of uncovered methods in the implementation.

@ammachado ammachado force-pushed the forwarding-scheduled-executor branch from b6c022c to e5d7cc4 Compare September 16, 2024 03:10
@ammachado ammachado requested a review from jkwatson September 16, 2024 14:45
@ammachado ammachado requested a review from a team as a code owner September 18, 2024 22:15
Copy link
Contributor

@shalk shalk left a comment

Choose a reason for hiding this comment

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

private field in CurrentContextScheduledExecutorService.java can be removed

Comment on lines +16 to +21
private final ScheduledExecutorService delegate;

CurrentContextScheduledExecutorService(ScheduledExecutorService delegate) {
super(delegate);
this.delegate = delegate;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private final ScheduledExecutorService delegate;
CurrentContextScheduledExecutorService(ScheduledExecutorService delegate) {
super(delegate);
this.delegate = delegate;
}
CurrentContextScheduledExecutorService(ScheduledExecutorService delegate) {
super(delegate);
}

@Override
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
return delegate.schedule(Context.current().wrap(command), delay, unit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return delegate.schedule(Context.current().wrap(command), delay, unit);
return ((ScheduledExecutorService) delegate())
.schedule(Context.current().wrap(command), delay, unit);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I prefer just keeping a local copy of the delegate rather than having to make this cast everywhere.


@Override
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
return delegate.schedule(Context.current().wrap(callable), delay, unit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return delegate.schedule(Context.current().wrap(callable), delay, unit);
return ((ScheduledExecutorService) delegate())
.schedule(Context.current().wrap(callable), delay, unit);
@Override
public ScheduledFuture<?> scheduleAtFixedRate(
Runnable command, long initialDelay, long period, TimeUnit unit) {
return delegate.scheduleAtFixedRate(command, initialDelay, period, unit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return delegate.scheduleAtFixedRate(command, initialDelay, period, unit);
return ((ScheduledExecutorService) delegate())
.scheduleAtFixedRate(command, initialDelay, period, unit);
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(
Runnable command, long initialDelay, long delay, TimeUnit unit) {
return delegate.scheduleWithFixedDelay(command, initialDelay, delay, unit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return delegate.scheduleWithFixedDelay(command, initialDelay, delay, unit);
return ((ScheduledExecutorService) delegate())
.scheduleWithFixedDelay(command, initialDelay, delay, unit);
@jack-berg jack-berg merged commit eb53fe3 into open-telemetry:main Oct 7, 2024
@ammachado ammachado deleted the forwarding-scheduled-executor branch November 25, 2024 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants