diff options
4 files changed, 38 insertions, 39 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/FutureResult.java b/container-search/src/main/java/com/yahoo/search/searchchain/FutureResult.java index 453b49cfe71..e02f7ea0e37 100644 --- a/container-search/src/main/java/com/yahoo/search/searchchain/FutureResult.java +++ b/container-search/src/main/java/com/yahoo/search/searchchain/FutureResult.java @@ -16,7 +16,7 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * Extends a {@code FutureTask<Result>}, with some added error handling + * Extends a {@code FutureTask<Result>}, with some added error handling * * @author bratseth */ diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java index f802914d291..b82d3f1a8e9 100644 --- a/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/searchchain/test/FutureDataTestCase.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.searchchain.test; -import com.google.common.util.concurrent.AbstractFuture; -import com.google.common.util.concurrent.ListenableFuture; import com.yahoo.component.ComponentId; import com.yahoo.processing.response.*; import com.yahoo.search.Query; @@ -34,23 +32,25 @@ import com.yahoo.component.chain.Chain; public class FutureDataTestCase { @Test - public void testAsyncFederation() throws InterruptedException, ExecutionException, TimeoutException { + public void testAsyncFederation() throws InterruptedException, ExecutionException { // Setup environment AsyncProviderSearcher asyncProviderSearcher = new AsyncProviderSearcher(); Searcher syncProviderSearcher = new SyncProviderSearcher(); - Chain<Searcher> asyncSource = new Chain<Searcher>(new ComponentId("async"),asyncProviderSearcher); - Chain<Searcher> syncSource = new Chain<>(new ComponentId("sync"),syncProviderSearcher); + Chain<Searcher> asyncSource = new Chain<>(new ComponentId("async"), asyncProviderSearcher); + Chain<Searcher> syncSource = new Chain<>(new ComponentId("sync"), syncProviderSearcher); SearchChainResolver searchChainResolver= - new SearchChainResolver.Builder().addSearchChain(new ComponentId("sync"),new FederationOptions().setUseByDefault(true)). - addSearchChain(new ComponentId("async"),new FederationOptions().setUseByDefault(true)). + new SearchChainResolver.Builder().addSearchChain(new ComponentId("sync"), new FederationOptions().setUseByDefault(true)). + addSearchChain(new ComponentId("async"), new FederationOptions().setUseByDefault(true)). build(); - Chain<Searcher> main = new Chain<Searcher>(new FederationSearcher(new ComponentId("federator"),searchChainResolver)); + Chain<Searcher> main = new Chain<>(new FederationSearcher(new ComponentId("federator"), searchChainResolver)); SearchChainRegistry searchChainRegistry = new SearchChainRegistry(); searchChainRegistry.register(main); searchChainRegistry.register(syncSource); searchChainRegistry.register(asyncSource); - Result result = new Execution(main, Execution.Context.createContextStub(searchChainRegistry,null)).search(new Query()); + Query query = new Query(); + query.setTimeout(5000); + Result result = new Execution(main, Execution.Context.createContextStub(searchChainRegistry,null)).search(query); assertNotNull(result); HitGroup syncGroup = (HitGroup)result.hits().get("source:sync"); @@ -59,29 +59,29 @@ public class FutureDataTestCase { HitGroup asyncGroup = (HitGroup)result.hits().get("source:async"); assertNotNull(asyncGroup); - assertEquals("Got all sync data",3,syncGroup.size()); - assertEquals("sync:0",syncGroup.get(0).getId().toString()); - assertEquals("sync:1",syncGroup.get(1).getId().toString()); - assertEquals("sync:2",syncGroup.get(2).getId().toString()); + assertEquals("Got all sync data", 3, syncGroup.size()); + assertEquals("sync:0", syncGroup.get(0).getId().toString()); + assertEquals("sync:1", syncGroup.get(1).getId().toString()); + assertEquals("sync:2", syncGroup.get(2).getId().toString()); assertTrue(asyncGroup.incoming()==asyncProviderSearcher.incomingData); - assertEquals("Got no async data yet",0,asyncGroup.size()); + assertEquals("Got no async data yet", 0, asyncGroup.size()); asyncProviderSearcher.simulateOneHitIOComplete(new Hit("async:0")); - assertEquals("Got no async data yet, as we haven't completed the incoming buffer and there is no data listener",0,asyncGroup.size()); + assertEquals("Got no async data yet, as we haven't completed the incoming buffer and there is no data listener", 0, asyncGroup.size()); asyncProviderSearcher.simulateOneHitIOComplete(new Hit("async:1")); asyncProviderSearcher.simulateAllHitsIOComplete(); - assertEquals("Got no async data yet, as we haven't pulled it",0,asyncGroup.size()); + assertEquals("Got no async data yet, as we haven't pulled it", 0, asyncGroup.size()); asyncGroup.complete().get(); - assertEquals("Completed, so we have the data",2,asyncGroup.size()); - assertEquals("async:0",asyncGroup.get(0).getId().toString()); - assertEquals("async:1",asyncGroup.get(1).getId().toString()); + assertEquals("Completed, so we have the data", 2, asyncGroup.size()); + assertEquals("async:0", asyncGroup.get(0).getId().toString()); + assertEquals("async:1", asyncGroup.get(1).getId().toString()); } @Test public void testFutureData() throws InterruptedException, ExecutionException, TimeoutException { // Set up - AsyncProviderSearcher futureDataSource=new AsyncProviderSearcher(); - Chain<Searcher> chain=new Chain<>(Collections.<Searcher>singletonList(futureDataSource)); + AsyncProviderSearcher futureDataSource = new AsyncProviderSearcher(); + Chain<Searcher> chain = new Chain<>(Collections.<Searcher>singletonList(futureDataSource)); // Execute Query query = new Query(); @@ -102,7 +102,7 @@ public class FutureDataTestCase { // Results with future hit groups will be passed to rendering directly and start rendering immediately. // For this test we block and wait for the data instead: result.hits().complete().get(1000, TimeUnit.MILLISECONDS); - assertEquals(2,result.hits().getConcreteSize()); + assertEquals(2, result.hits().getConcreteSize()); } /** @@ -117,7 +117,7 @@ public class FutureDataTestCase { public Result search(Query query, Execution execution) { if (incomingData != null) throw new IllegalArgumentException("This test searcher is one-time use only"); - HitGroup hitGroup=HitGroup.createAsync("Async source"); + HitGroup hitGroup = HitGroup.createAsync("Async source"); this.incomingData = hitGroup.incoming(); // A real implementation would do query.properties().get("jdisc.request") here // to get the jDisc request and use it to spawn a child request to the backend diff --git a/documentapi/src/main/java/com/yahoo/documentapi/SyncSession.java b/documentapi/src/main/java/com/yahoo/documentapi/SyncSession.java index c254df3ba02..418c0374193 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/SyncSession.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/SyncSession.java @@ -11,8 +11,8 @@ import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; import java.time.Duration; /** - * <p>A session for synchronous access to a document repository. This class - * provides simple document access where throughput is not a concern.</p> + * A session for synchronous access to a document repository. This class + * provides simple document access where throughput is not a concern. * * @author Simon Thoresen Hult * @author bjorncs @@ -20,16 +20,15 @@ import java.time.Duration; public interface SyncSession extends Session { /** - * <p>Puts a document. When this method returns, the document is safely - * received. This enables setting condition compared to using Document.</p> + * Puts a document. When this method returns, the document is safely + * received. This enables setting condition compared to using Document. * * @param documentPut The DocumentPut operation */ void put(DocumentPut documentPut); /** - * <p>Puts a document. When this method returns, the document is safely - * received.</p> + * Puts a document. When this method returns, the document is safely received. * * @param documentPut The DocumentPut operation * @param priority The priority with which to perform this operation. @@ -39,7 +38,7 @@ public interface SyncSession extends Session { } /** - * <p>Gets a document.</p> + * Gets a document. * * @param id The id of the document to get. * @return The known document having this id, or null if there is no @@ -65,7 +64,7 @@ public interface SyncSession extends Session { } /** - * <p>Gets a document with timeout.</p> + * Gets a document with timeout. * * @param id The id of the document to get. * @param timeout Timeout. If timeout is null, an unspecified default will be used. @@ -77,7 +76,7 @@ public interface SyncSession extends Session { Document get(DocumentId id, Duration timeout); /** - * <p>Gets a document with timeout. </p> + * Gets a document with timeout. * * @param id The id of the document to get. * @param fieldSet A comma-separated list of fields to retrieve @@ -93,12 +92,12 @@ public interface SyncSession extends Session { /** * <p>Removes a document if it is present and condition is fulfilled.</p> * @param documentRemove document to delete - * @return true If the document with this id was removed, false otherwise. + * @return true if the document with this id was removed, false otherwise. */ boolean remove(DocumentRemove documentRemove); /** - * <p>Removes a document if it is present.</p> + * Removes a document if it is present. * * @param documentRemove Document remove operation * @param priority The priority with which to perform this operation. @@ -109,7 +108,7 @@ public interface SyncSession extends Session { boolean remove(DocumentRemove documentRemove, DocumentProtocol.Priority priority); /** - * <p>Updates a document.</p> + * Updates a document. * * @param update The updates to perform. * @return True, if the document was found and updated. @@ -119,7 +118,7 @@ public interface SyncSession extends Session { boolean update(DocumentUpdate update); /** - * <p>Updates a document.</p> + * Updates a document. * * @param update The updates to perform. * @param priority The priority with which to perform this operation. diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RemoveDocumentReply.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RemoveDocumentReply.java index 167183acec6..d3c29e5a7be 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RemoveDocumentReply.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RemoveDocumentReply.java @@ -18,7 +18,7 @@ public class RemoveDocumentReply extends WriteDocumentReply { /** * Returns whether or not the document was found and removed. * - * @return True if document was found. + * @return true if document was found. */ public boolean wasFound() { return found; @@ -27,7 +27,7 @@ public class RemoveDocumentReply extends WriteDocumentReply { /** * Set whether or not the document was found and removed. * - * @param found True if the document was found. + * @param found true if the document was found. */ public void setWasFound(boolean found) { this.found = found; |