Skip to content

Commit

Permalink
SynchronizationContextTest checkstyle issues updated for issue10245
Browse files Browse the repository at this point in the history
  • Loading branch information
SreeramdasLavanya committed Sep 23, 2024
1 parent 6a713ed commit db6c21f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 0 additions & 5 deletions api/src/main/java/io/grpc/SynchronizationContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public final ScheduledHandle scheduleWithFixedDelay(
final Runnable task, Duration initialDelay, Duration delay, TimeUnit unit,
ScheduledExecutorService timerService) {
final ManagedRunnable runnable = new ManagedRunnable(task);
System.out.println("Inside Durationcall");
ScheduledFuture<?> future = timerService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
Expand All @@ -214,12 +213,8 @@ public String toString() {
return new ScheduledHandle(runnable, future);
}
static long toNanosSaturated(Duration duration) {

try {
//long delay = TimeUnit.MILLISECONDS.convert(500, TimeUnit.SECONDS); // Converts 500 seconds to milliseconds
return duration.toNanos();
//return TimeUnit.NANOSECONDS.convert(duration);

} catch (ArithmeticException tooBig) {
return duration.isNegative() ? Long.MIN_VALUE : Long.MAX_VALUE;
}
Expand Down
5 changes: 2 additions & 3 deletions api/src/test/java/io/grpc/SynchronizationContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,9 @@ public void schedule() {
@Test
public void testScheduleWithFixedDelay(){
MockScheduledExecutorService executorService = new MockScheduledExecutorService();

ScheduledHandle handle =
syncContext.scheduleWithFixedDelay(task1, Duration.ofNanos(110), Duration.ofNanos(110), TimeUnit.NANOSECONDS, executorService);

syncContext.scheduleWithFixedDelay(task1, Duration.ofNanos(110), Duration.ofNanos(110),
TimeUnit.NANOSECONDS, executorService);
assertThat(executorService.delay)
.isEqualTo(executorService.unit.convert(110, TimeUnit.NANOSECONDS));
assertThat(handle.isPending()).isTrue();
Expand Down

0 comments on commit db6c21f

Please sign in to comment.