diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-07-04 16:22:59 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-07-04 16:22:59 +0200 |
commit | 8dc4851d9a6fdc495d78a0bbc7fd34d4fdab4317 (patch) | |
tree | 36bfe2529ff92975752063b2ee178567ac6f9b0c | |
parent | 1758e64338c4076c222e6c04b8c481f33bb462fc (diff) |
sameThreadExecutor -> directExecutor
The former is deprecated and will be removed in "August 2016"
12 files changed, 15 insertions, 14 deletions
diff --git a/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java b/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java index 8e0c1d99a81..3980ec80423 100644 --- a/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java +++ b/container-core/src/main/java/com/yahoo/processing/rendering/AsynchronousSectionedRenderer.java @@ -238,7 +238,7 @@ public abstract class AsynchronousSectionedRenderer<RESPONSE extends Response> e * inadvertently work ends up in async data producing threads in some cases. */ Executor getExecutor() { - return beforeHandoverMode ? MoreExecutors.sameThreadExecutor() : renderingExecutor; + return beforeHandoverMode ? MoreExecutors.directExecutor() : renderingExecutor; } /** For inspection only; use getExecutor() for execution */ Executor getRenderingExecutor() { return renderingExecutor; } diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FastContentWriterTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FastContentWriterTestCase.java index e3bedaf5c2a..2c2b19c6f23 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FastContentWriterTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FastContentWriterTestCase.java @@ -188,7 +188,7 @@ public class FastContentWriterTestCase { ReadableContentChannel buf = new ReadableContentChannel(); FastContentWriter out = new FastContentWriter(buf); RunnableLatch listener = new RunnableLatch(); - out.addListener(listener, MoreExecutors.sameThreadExecutor()); + out.addListener(listener, MoreExecutors.directExecutor()); out.write(new byte[] { 6, 9 }); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureCompletionTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureCompletionTestCase.java index e886d663a72..d282c3d89f4 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureCompletionTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureCompletionTestCase.java @@ -91,14 +91,14 @@ public class FutureCompletionTestCase { public void requireThatCompletionCanBeListenedTo() throws InterruptedException { FutureCompletion completion = new FutureCompletion(); RunnableLatch listener = new RunnableLatch(); - completion.addListener(listener, MoreExecutors.sameThreadExecutor()); + completion.addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); completion.completed(); assertTrue(listener.await(600, TimeUnit.SECONDS)); completion = new FutureCompletion(); listener = new RunnableLatch(); - completion.addListener(listener, MoreExecutors.sameThreadExecutor()); + completion.addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); completion.failed(new Throwable()); assertTrue(listener.await(600, TimeUnit.SECONDS)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureConjunctionTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureConjunctionTestCase.java index 3916eb7ffd6..e0c94ee21e2 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureConjunctionTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureConjunctionTestCase.java @@ -118,7 +118,7 @@ public class FutureConjunctionTestCase { public void requireThatConjunctionCanBeListenedTo() throws InterruptedException { FutureConjunction conjunction = new FutureConjunction(); RunnableLatch listener = new RunnableLatch(); - conjunction.addListener(listener, MoreExecutors.sameThreadExecutor()); + conjunction.addListener(listener, MoreExecutors.directExecutor()); assertTrue(listener.await(600, TimeUnit.SECONDS)); conjunction = new FutureConjunction(); @@ -127,7 +127,7 @@ public class FutureConjunctionTestCase { FutureBoolean bar = new FutureBoolean(); conjunction.addOperand(bar); listener = new RunnableLatch(); - conjunction.addListener(listener, MoreExecutors.sameThreadExecutor()); + conjunction.addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); foo.set(true); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); @@ -140,7 +140,7 @@ public class FutureConjunctionTestCase { bar = new FutureBoolean(); conjunction.addOperand(bar); listener = new RunnableLatch(); - conjunction.addListener(listener, MoreExecutors.sameThreadExecutor()); + conjunction.addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); bar.set(true); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureResponseTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureResponseTestCase.java index 925c09f763d..9cc453faef1 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureResponseTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/FutureResponseTestCase.java @@ -73,7 +73,7 @@ public class FutureResponseTestCase { public void requireThatResponseCanBeListenedTo() throws InterruptedException { FutureResponse response = new FutureResponse(); RunnableLatch listener = new RunnableLatch(); - response.addListener(listener, MoreExecutors.sameThreadExecutor()); + response.addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); response.handleResponse(new Response(Response.Status.OK)); assertTrue(listener.await(600, TimeUnit.SECONDS)); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/RequestDispatchTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/RequestDispatchTestCase.java index f13473a1660..dbce93c8f98 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/RequestDispatchTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/RequestDispatchTestCase.java @@ -218,7 +218,7 @@ public class RequestDispatchTestCase { protected Request newRequest() { return new Request(driver, URI.create("http://localhost/")); } - }.dispatch().addListener(listener, MoreExecutors.sameThreadExecutor()); + }.dispatch().addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); ContentChannel responseContent = ResponseDispatch.newInstance(Response.Status.OK) .connect(requestHandler.responseHandler); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/ResponseDispatchTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/ResponseDispatchTestCase.java index 92fc0f90c07..0dd1e7657fe 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/handler/ResponseDispatchTestCase.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/handler/ResponseDispatchTestCase.java @@ -179,7 +179,7 @@ public class ResponseDispatchTestCase { ReadableContentChannel responseContent = new ReadableContentChannel(); ResponseDispatch.newInstance(6, ByteBuffer.allocate(9)) .dispatch(new MyResponseHandler(responseContent)) - .addListener(listener, MoreExecutors.sameThreadExecutor()); + .addListener(listener, MoreExecutors.directExecutor()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); assertNotNull(responseContent.read()); assertFalse(listener.await(100, TimeUnit.MILLISECONDS)); diff --git a/processing/src/main/java/com/yahoo/processing/Response.java b/processing/src/main/java/com/yahoo/processing/Response.java index 3805311efba..44fbc7678fd 100644 --- a/processing/src/main/java/com/yahoo/processing/Response.java +++ b/processing/src/main/java/com/yahoo/processing/Response.java @@ -59,7 +59,7 @@ public class Response extends ListenableFreezableClass { if (freezeListener != null) { if (freezeListener instanceof ResponseReceiver) ((ResponseReceiver)freezeListener).setResponse(this); - data.addFreezeListener(freezeListener, MoreExecutors.sameThreadExecutor()); + data.addFreezeListener(freezeListener, MoreExecutors.directExecutor()); } } diff --git a/processing/src/main/java/com/yahoo/processing/test/ProcessorLibrary.java b/processing/src/main/java/com/yahoo/processing/test/ProcessorLibrary.java index fe1e0d75ee3..ea6f451b41b 100644 --- a/processing/src/main/java/com/yahoo/processing/test/ProcessorLibrary.java +++ b/processing/src/main/java/com/yahoo/processing/test/ProcessorLibrary.java @@ -383,7 +383,7 @@ public class ProcessorLibrary { // TODO: Consider for to best provide helpers for this response.data().complete().addListener(new RunnableExecution(request, new ExecutionWithResponse(asyncChain, response, execution)), - MoreExecutors.sameThreadExecutor()); + MoreExecutors.directExecutor()); return response; } diff --git a/processing/src/test/java/com/yahoo/processing/execution/test/StreamingTestCase.java b/processing/src/test/java/com/yahoo/processing/execution/test/StreamingTestCase.java index 6002c1993e2..8f0bc4a585d 100644 --- a/processing/src/test/java/com/yahoo/processing/execution/test/StreamingTestCase.java +++ b/processing/src/test/java/com/yahoo/processing/execution/test/StreamingTestCase.java @@ -55,7 +55,7 @@ public class StreamingTestCase { assertEquals("New data is not consumed", 1, response.data().asList().size()); // start listening on incoming data - this is what a renderer will do - incomingData.addNewDataListener(new MockNewDataListener(incomingData), MoreExecutors.sameThreadExecutor()); + incomingData.addNewDataListener(new MockNewDataListener(incomingData), MoreExecutors.directExecutor()); assertEquals("We got a data add event for the data which was already added", 2, streamProcessor.invocationCount); assertEquals("New data is consumed", 2, response.data().asList().size()); diff --git a/processing/src/test/java/com/yahoo/processing/test/documentation/AsyncDataProcessingInitiator.java b/processing/src/test/java/com/yahoo/processing/test/documentation/AsyncDataProcessingInitiator.java index afda8a7fe96..93b88bf4bb5 100644 --- a/processing/src/test/java/com/yahoo/processing/test/documentation/AsyncDataProcessingInitiator.java +++ b/processing/src/test/java/com/yahoo/processing/test/documentation/AsyncDataProcessingInitiator.java @@ -23,7 +23,7 @@ public class AsyncDataProcessingInitiator extends Processor { Response response=execution.process(request); response.data().complete().addListener(new RunnableExecution(request, new ExecutionWithResponse(asyncChain, response, execution)), - MoreExecutors.sameThreadExecutor()); + MoreExecutors.directExecutor()); return response; } diff --git a/vespajlib/src/main/java/com/yahoo/net/HostName.java b/vespajlib/src/main/java/com/yahoo/net/HostName.java index 3fb1fe49efd..9dff33e1f5f 100644 --- a/vespajlib/src/main/java/com/yahoo/net/HostName.java +++ b/vespajlib/src/main/java/com/yahoo/net/HostName.java @@ -20,6 +20,7 @@ public class HostName { * * @return the name of localhost. * @throws RuntimeException if executing the command 'hostname' fails. + * @see LinuxInetAddress if you need a host name/address which is reachable */ public static synchronized String getLocalhost() { if (myHost == null) { |