From 95eef77ad4eacb90d20ffc140a1c030eb5d354b6 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Wed, 9 Jan 2019 10:55:52 -0800 Subject: [PATCH] [Style] Fix line length violations for threadpool, indexing, and script packages (#37205) --- .../src/main/resources/checkstyle_suppressions.xml | 13 +++++-------- .../org/elasticsearch/threadpool/ThreadPool.java | 12 +++++++----- .../org/elasticsearch/indexing/IndexActionIT.java | 13 ++++++++----- .../elasticsearch/script/ScriptServiceTests.java | 9 ++++++--- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 923e9e882b8..4d587263948 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -21,6 +21,9 @@ configuration of classes that aren't in packages. --> + + + - - - - + + diff --git a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index bae801492e1..e4eaf20725b 100644 --- a/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -189,9 +189,11 @@ public class ThreadPool implements Scheduler, Closeable { builders.put(Names.REFRESH, new ScalingExecutorBuilder(Names.REFRESH, 1, halfProcMaxAt10, TimeValue.timeValueMinutes(5))); builders.put(Names.WARMER, new ScalingExecutorBuilder(Names.WARMER, 1, halfProcMaxAt5, TimeValue.timeValueMinutes(5))); builders.put(Names.SNAPSHOT, new ScalingExecutorBuilder(Names.SNAPSHOT, 1, halfProcMaxAt5, TimeValue.timeValueMinutes(5))); - builders.put(Names.FETCH_SHARD_STARTED, new ScalingExecutorBuilder(Names.FETCH_SHARD_STARTED, 1, 2 * availableProcessors, TimeValue.timeValueMinutes(5))); + builders.put(Names.FETCH_SHARD_STARTED, + new ScalingExecutorBuilder(Names.FETCH_SHARD_STARTED, 1, 2 * availableProcessors, TimeValue.timeValueMinutes(5))); builders.put(Names.FORCE_MERGE, new FixedExecutorBuilder(settings, Names.FORCE_MERGE, 1, -1)); - builders.put(Names.FETCH_SHARD_STORE, new ScalingExecutorBuilder(Names.FETCH_SHARD_STORE, 1, 2 * availableProcessors, TimeValue.timeValueMinutes(5))); + builders.put(Names.FETCH_SHARD_STORE, + new ScalingExecutorBuilder(Names.FETCH_SHARD_STORE, 1, 2 * availableProcessors, TimeValue.timeValueMinutes(5))); for (final ExecutorBuilder builder : customBuilders) { if (builders.containsKey(builder.name())) { throw new IllegalArgumentException("builder with name [" + builder.name() + "] already exists"); @@ -335,9 +337,9 @@ public class ThreadPool implements Scheduler, Closeable { * it to this method. * * @param delay delay before the task executes - * @param executor the name of the thread pool on which to execute this task. SAME means "execute on the scheduler thread" which changes the - * meaning of the ScheduledFuture returned by this method. In that case the ScheduledFuture will complete only when the command - * completes. + * @param executor the name of the thread pool on which to execute this task. SAME means "execute on the scheduler thread" which changes + * the meaning of the ScheduledFuture returned by this method. In that case the ScheduledFuture will complete only when the + * command completes. * @param command the command to run * @return a ScheduledFuture who's get will return when the task is has been added to its target thread pool and throw an exception if * the task is canceled before it was added to its target thread pool. Once the task has been added to its target thread pool diff --git a/server/src/test/java/org/elasticsearch/indexing/IndexActionIT.java b/server/src/test/java/org/elasticsearch/indexing/IndexActionIT.java index 0bf8fa698f4..36488addb37 100644 --- a/server/src/test/java/org/elasticsearch/indexing/IndexActionIT.java +++ b/server/src/test/java/org/elasticsearch/indexing/IndexActionIT.java @@ -70,8 +70,9 @@ public class IndexActionIT extends ESIntegTestCase { logger.debug("running search with all types"); SearchResponse response = client().prepareSearch("test").get(); if (response.getHits().getTotalHits().value != numOfDocs) { - final String message = "Count is " + response.getHits().getTotalHits().value + " but " + numOfDocs + " was expected. " - + ElasticsearchAssertions.formatShardStatus(response); + final String message = + "Count is " + response.getHits().getTotalHits().value + " but " + numOfDocs + " was expected. " + + ElasticsearchAssertions.formatShardStatus(response); logger.error("{}. search response: \n{}", message, response); fail(message); } @@ -85,8 +86,9 @@ public class IndexActionIT extends ESIntegTestCase { logger.debug("running search with a specific type"); SearchResponse response = client().prepareSearch("test").setTypes("type").get(); if (response.getHits().getTotalHits().value != numOfDocs) { - final String message = "Count is " + response.getHits().getTotalHits().value + " but " + numOfDocs + " was expected. " - + ElasticsearchAssertions.formatShardStatus(response); + final String message = + "Count is " + response.getHits().getTotalHits().value + " but " + numOfDocs + " was expected. " + + ElasticsearchAssertions.formatShardStatus(response); logger.error("{}. search response: \n{}", message, response); fail(message); } @@ -183,7 +185,8 @@ public class IndexActionIT extends ESIntegTestCase { createIndex("test"); ensureGreen(); - BulkResponse bulkResponse = client().prepareBulk().add(client().prepareIndex("test", "type", "1").setSource("field1", "value1_1")).execute().actionGet(); + BulkResponse bulkResponse = client().prepareBulk().add( + client().prepareIndex("test", "type", "1").setSource("field1", "value1_1")).execute().actionGet(); assertThat(bulkResponse.hasFailures(), equalTo(false)); assertThat(bulkResponse.getItems().length, equalTo(1)); IndexResponse indexResponse = bulkResponse.getItems()[0].getResponse(); diff --git a/server/src/test/java/org/elasticsearch/script/ScriptServiceTests.java b/server/src/test/java/org/elasticsearch/script/ScriptServiceTests.java index 271007f9978..f49bb70dc7f 100644 --- a/server/src/test/java/org/elasticsearch/script/ScriptServiceTests.java +++ b/server/src/test/java/org/elasticsearch/script/ScriptServiceTests.java @@ -152,10 +152,12 @@ public class ScriptServiceTests extends ESTestCase { public void testNotSupportedDisableDynamicSetting() throws IOException { try { - buildScriptService(Settings.builder().put(ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING, randomUnicodeOfLength(randomIntBetween(1, 10))).build()); + buildScriptService(Settings.builder().put( + ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING, randomUnicodeOfLength(randomIntBetween(1, 10))).build()); fail("script service should have thrown exception due to non supported script.disable_dynamic setting"); } catch(IllegalArgumentException e) { - assertThat(e.getMessage(), containsString(ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING + " is not a supported setting, replace with fine-grained script settings")); + assertThat(e.getMessage(), containsString(ScriptService.DISABLE_DYNAMIC_SCRIPTING_SETTING + + " is not a supported setting, replace with fine-grained script settings")); } } @@ -338,7 +340,8 @@ public class ScriptServiceTests extends ESTestCase { private void assertCompileRejected(String lang, String script, ScriptType scriptType, ScriptContext scriptContext) { try { scriptService.compile(new Script(scriptType, lang, script, Collections.emptyMap()), scriptContext); - fail("compile should have been rejected for lang [" + lang + "], script_type [" + scriptType + "], scripted_op [" + scriptContext + "]"); + fail("compile should have been rejected for lang [" + lang + "], " + + "script_type [" + scriptType + "], scripted_op [" + scriptContext + "]"); } catch (IllegalArgumentException | IllegalStateException e) { // pass }