mirror of https://github.com/apache/druid.git
Use ExecutorService variables to assign ExecutorService Instances (#11373)
* Added inspection rule to prohibit ExecutorService assignment to Executor * Use ExecutorService type variable to assign ExecutorService * Changed : Variable => variable * Removed unused Executor import
This commit is contained in:
parent
df9b57aa1a
commit
af2ab98574
|
@ -372,6 +372,16 @@
|
|||
<constraint name="l" within="" contains="" />
|
||||
<constraint name="y" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Assign an ExecutorService instance to an ExecutorService variable, not an Executor variable" text="$x$ = $y$;" recursive="true" caseInsensitive="true" type="JAVA" >
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="x" nameOfExprType="java\.util\.concurrent\.Executor" within="" contains="" />
|
||||
<constraint name="y" nameOfExprType="java\.util\.concurrent\.ExecutorService" exprTypeWithinHierarchy="true" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Intialize an ExecutorService instance to an ExecutorService variable, not an Executor variable" text="Executor $x$ = $y$;" recursive="true" caseInsensitive="true" type="JAVA" >
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="x" within="" contains="" />
|
||||
<constraint name="y" nameOfExprType="java\.util\.concurrent\.ExecutorService" exprTypeWithinHierarchy="true" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="Create a simple ExecutorService (not scheduled)" text="$x$ = $y$;" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="x" nameOfExprType="java\.util\.concurrent\.ExecutorService" within="" contains="" />
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.security.PrivilegedExceptionAction;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
public class KerberosHttpClient extends AbstractHttpClient
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ public class KerberosHttpClient extends AbstractHttpClient
|
|||
|
||||
private final HttpClient delegate;
|
||||
private final CookieManager cookieManager;
|
||||
private final Executor exec = Execs.singleThreaded("test-%s");
|
||||
private final ExecutorService exec = Execs.singleThreaded("test-%s");
|
||||
private final String internalClientPrincipal;
|
||||
private final String internalClientKeytab;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ import java.util.EnumSet;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -268,7 +268,7 @@ public class JettyTest extends BaseJettyTest
|
|||
public void testTimeouts() throws Exception
|
||||
{
|
||||
// test for request timeouts properly not locking up all threads
|
||||
final Executor executor = Executors.newFixedThreadPool(100);
|
||||
final ExecutorService executor = Executors.newFixedThreadPool(100);
|
||||
final AtomicLong count = new AtomicLong(0);
|
||||
final CountDownLatch latch = new CountDownLatch(1000);
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
|
|
Loading…
Reference in New Issue