• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence-java-client / 2476

13 Aug 2024 05:39PM CUT coverage: 61.985% (-0.04%) from 62.021%
2476

push

buildkite

web-flow
Removing fossa as it is migrated to snyk (#919)

12089 of 19503 relevant lines covered (61.99%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/src/main/java/com/uber/cadence/internal/worker/BlockCallerPolicy.java
1
/*
2
 *  Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
 *
4
 *  Modifications copyright (C) 2017 Uber Technologies, Inc.
5
 *
6
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
7
 *  use this file except in compliance with the License. A copy of the License is
8
 *  located at
9
 *
10
 *  http://aws.amazon.com/apache2.0
11
 *
12
 *  or in the "license" file accompanying this file. This file is distributed on
13
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
 *  express or implied. See the License for the specific language governing
15
 *  permissions and limitations under the License.
16
 */
17

18
package com.uber.cadence.internal.worker;
19

20
import java.util.concurrent.RejectedExecutionException;
21
import java.util.concurrent.RejectedExecutionHandler;
22
import java.util.concurrent.ThreadPoolExecutor;
23

24
class BlockCallerPolicy implements RejectedExecutionHandler {
1✔
25

26
  @Override
27
  public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
28
    // Without this check the call hangs forever on the queue put.
29
    if (executor.isShutdown()) {
1✔
30
      throw new RejectedExecutionException("Executor is shutdown");
×
31
    }
32
    try {
33
      // block until there's room
34
      executor.getQueue().put(r);
1✔
35
    } catch (InterruptedException e) {
×
36
      throw new RejectedExecutionException("Unexpected InterruptedException", e);
×
37
    }
1✔
38
  }
1✔
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc