diff options
Diffstat (limited to 'vespa-http-client')
23 files changed, 57 insertions, 116 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java index fc6605eeba0..c5af7a49570 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java @@ -17,6 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger; * * @author dybis * @see FeedClientFactory + * @see com.yahoo.text.Text#stripInvalidCharacters(String) to remove invalid characters from string fields before feeding */ public interface FeedClient extends AutoCloseable { diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SimpleLoggerResultCallback.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SimpleLoggerResultCallback.java index 85e6baec9f7..0b6917d9960 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SimpleLoggerResultCallback.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/SimpleLoggerResultCallback.java @@ -32,6 +32,7 @@ public class SimpleLoggerResultCallback implements FeedClient.ResultCallback { /** * Constructor + * * @param sentDocumentCounter a counter that is increased outside this class, but can be nice to print here. * @param printStatsForEveryXDocument how often to print stats. */ diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Document.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Document.java index d725f1df233..88d8d702d7c 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Document.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Document.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.vespa.http.client.core; -import com.google.common.annotations.Beta; - import java.io.IOException; import java.math.BigInteger; import java.nio.ByteBuffer; @@ -11,13 +9,11 @@ import java.nio.charset.CharacterCodingException; import java.nio.charset.StandardCharsets; import java.util.concurrent.ThreadLocalRandom; - /** -* @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a> -* @since 5.1.20 -*/ -@Beta + * @author Einar M R Rosenvinge + */ final public class Document { + private final String documentId; private final ByteBuffer data; private final long createTimeMillis = System.currentTimeMillis(); @@ -88,4 +84,5 @@ final public class Document { } return operationId; } + } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Encoder.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Encoder.java index 51488997ec6..135b2021a16 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Encoder.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Encoder.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.vespa.http.client.core; -import com.google.common.annotations.Beta; - /** * Simple encoding scheme to remove space, linefeed, control characters and * anything outside ISO 646.irv:1991 from strings. The scheme is supposed to be @@ -10,10 +8,10 @@ import com.google.common.annotations.Beta; * used as quoting characters, the output is by definition US-ASCII only * characters. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ -@Beta public final class Encoder { + /** * ISO 646.irv:1991 safe quoting into a StringBuilder instance. * @@ -23,10 +21,9 @@ public final class Encoder { * the destination buffer * @return the destination buffer given as input */ - public static StringBuilder encode(final String input, - final StringBuilder output) { + public static StringBuilder encode(String input, StringBuilder output) { for (int i = 0; i < input.length(); i = input.offsetByCodePoints(i, 1)) { - final int c = input.codePointAt(i); + int c = input.codePointAt(i); if (c <= '~') { if (c <= ' ') { encode(c, output); @@ -58,52 +55,46 @@ public final class Encoder { * @throws IllegalArgumentException * if the input string contains unexpected or invalid data */ - public static StringBuilder decode(final String input, - final StringBuilder output) { + public static StringBuilder decode(String input, StringBuilder output) { for (int i = 0; i < input.length(); i = input.offsetByCodePoints(i, 1)) { - final int c = input.codePointAt(i); + int c = input.codePointAt(i); if (c > '~') { - throw new IllegalArgumentException( - "Input contained character above printable ASCII."); + throw new IllegalArgumentException("Input contained character above printable ASCII."); } switch (c) { - case '{': - i = decode(input, i, output); - break; - default: - output.append((char) c); - break; + case '{': + i = decode(input, i, output); + break; + default: + output.append((char) c); + break; } } return output; } - private static int decode(final String input, final int offset, - final StringBuilder output) { + private static int decode(String input, int offset, StringBuilder output) { char c = 0; int end = offset; - final int start = offset + 1; + int start = offset + 1; int codePoint; while ('}' != c) { if (++end >= input.length()) { - throw new IllegalArgumentException( - "Unterminated quoted character or empty quoting."); + throw new IllegalArgumentException("Unterminated quoted character or empty quoting."); } c = input.charAt(end); } try { codePoint = Integer.parseInt(input.substring(start, end), 16); - } catch (final NumberFormatException e) { - throw new IllegalArgumentException("Unexpected quoted data: [" - + input.substring(start, end) + "]", e); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Unexpected quoted data: [" + input.substring(start, end) + "]", e); } if (Character.charCount(codePoint) > 1) { try { output.append(Character.toChars(codePoint)); - } catch (final IllegalArgumentException e) { - throw new IllegalArgumentException("Unexpected quoted data: [" - + input.substring(start, end) + "]", e); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Unexpected quoted data: [" + input.substring(start, end) + "]", e); } } else { output.append((char) codePoint); @@ -112,7 +103,7 @@ public final class Encoder { } - private static void encode(final int c, final StringBuilder output) { + private static void encode(int c, StringBuilder output) { output.append("{").append(Integer.toHexString(c)).append("}"); } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ErrorCode.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ErrorCode.java index 445ad5295c1..08926d529c5 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ErrorCode.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ErrorCode.java @@ -1,15 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.http.client.core; -import com.google.common.annotations.Beta; - /** * Return types for the server. * * @author Einar M R Rosenvinge * @author Steinar Knutsen */ -@Beta public enum ErrorCode { OK(true, true), diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Exceptions.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Exceptions.java index ce93aecac8e..1388effcec3 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Exceptions.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Exceptions.java @@ -1,14 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.http.client.core; -import com.google.common.annotations.Beta; - /** * Helper methods for handling exceptions * * @author bratseth */ -@Beta public abstract class Exceptions { /** diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Headers.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Headers.java index 50c96bafcf4..3791ddc5462 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Headers.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/Headers.java @@ -1,15 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.http.client.core; -import com.google.common.annotations.Beta; - /** * Wrapper for shared constants used by both client and server. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ -@Beta public final class Headers { + private Headers() { } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/JsonReader.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/JsonReader.java index 9b301351626..f5db2af216d 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/JsonReader.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/JsonReader.java @@ -13,6 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger; /** * Reads a stream of json documents and sends them to feedClient. + * * @author dybis */ public class JsonReader { diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/OperationStatus.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/OperationStatus.java index 7aec207e0ab..f3e2c8669e9 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/OperationStatus.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/OperationStatus.java @@ -1,18 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.http.client.core; -import com.google.common.annotations.Beta; import com.google.common.base.Splitter; - import java.util.Iterator; - /** * Serialization/deserialization class for the result of a single document operation against Vespa. * * @author Steinar Knutsen */ -@Beta public final class OperationStatus { public static final String IS_CONDITION_NOT_MET = "IS-CONDITION-NOT-MET"; diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ServerResponseException.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ServerResponseException.java index ef41a04f7c7..e3b0a0ab2cf 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ServerResponseException.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ServerResponseException.java @@ -1,15 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.http.client.core; -import com.google.common.annotations.Beta; - /** * The request was not processed properly on the server. * * @author Einar M R Rosenvinge */ @SuppressWarnings("serial") -@Beta public class ServerResponseException extends Exception { private final int responseCode; diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ThrottlePolicy.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ThrottlePolicy.java index 0239396cdd4..a4bd5d51496 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ThrottlePolicy.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/ThrottlePolicy.java @@ -24,13 +24,8 @@ public class ThrottlePolicy { * @param messagesQueued if any messages where queued. * @return The new value to be used for max-in-flight (should be cropped externally to fit max/min values). */ - public int calcNewMaxInFlight( - final double maxPerformanceChange, - final int numOk, - final int previousNumOk, - final int previousMaxInFlight, - final int maxInFlightNow, - final boolean messagesQueued) { + public int calcNewMaxInFlight(double maxPerformanceChange, int numOk, int previousNumOk, int previousMaxInFlight, + int maxInFlightNow, boolean messagesQueued) { double difference = calculateRuleBasedDifference( maxPerformanceChange, numOk, previousNumOk, previousMaxInFlight, maxInFlightNow); @@ -56,12 +51,8 @@ public class ThrottlePolicy { return maxInFlightNow + delta; } - private static double calculateRuleBasedDifference( - final double maxPerformanceChange, - final double numOk, - final double previousNumOk, - final double previousMaxInFlight, - final double maxInFlightNow) { + private static double calculateRuleBasedDifference(double maxPerformanceChange, double numOk, double previousNumOk, + double previousMaxInFlight, double maxInFlightNow) { double difference = min( maxPerformanceChange, abs((numOk - previousNumOk) / safeDenominator(previousNumOk))); @@ -78,4 +69,5 @@ public class ThrottlePolicy { private static double safeDenominator(double x) { return x == 0.0 ? 1.0 : x; } + } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/XmlFeedReader.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/XmlFeedReader.java index 30070f89502..ba89ed550de 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/XmlFeedReader.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/XmlFeedReader.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.http.client.core; import com.yahoo.vespa.http.client.FeedClient; import org.xml.sax.Attributes; import org.xml.sax.InputSource; -import org.xml.sax.SAXException; import org.xml.sax.ext.DefaultHandler2; import javax.xml.parsers.SAXParser; @@ -22,7 +21,7 @@ public class XmlFeedReader { // Static class. private XmlFeedReader() {} - public static void read(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent) throws Exception{ + public static void read(InputStream inputStream, FeedClient feedClient, AtomicInteger numSent) throws Exception { SAXParserFactory parserFactor = SAXParserFactory.newInstance(); parserFactor.setValidating(false); @@ -46,6 +45,7 @@ public class XmlFeedReader { * Streams XML and sends each document operation to feeder. */ class SAXClientFeeder extends DefaultHandler2 { + public static final String CDATA_START = "<![CDATA["; public static final String CDATA_STOP = "]]>"; private final FeedClient feedClient; @@ -62,25 +62,23 @@ class SAXClientFeeder extends DefaultHandler2 { } @Override - public void startCDATA () throws SAXException { + public void startCDATA() { content.append(CDATA_START); isCData = true; } @Override - public void endCDATA () throws SAXException { + public void endCDATA() { content.append(CDATA_STOP); isCData = false; } @Override - public void comment(char[] ch, int start, int length) throws SAXException { - - } + public void comment(char[] ch, int start, int length) { } @SuppressWarnings("fallthrough") @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + public void startElement(String uri, String localName, String qName, Attributes attributes) { switch(qName){ case "vespafeed": vespaIndent++; @@ -110,7 +108,7 @@ class SAXClientFeeder extends DefaultHandler2 { } @Override - public void endElement(String uri, String localName, String qName) throws SAXException { + public void endElement(String uri, String localName, String qName) { content.append("</") .append(qName) .append(">"); @@ -133,8 +131,7 @@ class SAXClientFeeder extends DefaultHandler2 { } @Override - public void characters (char buf [], int offset, int len) - throws SAXException { + public void characters (char buf [], int offset, int len) { if (isCData) { content.append(buf, offset, len); return; @@ -153,4 +150,5 @@ class SAXClientFeeder extends DefaultHandler2 { } } } + } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java index 903c1ad4842..eaf869bdcdc 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/api/FeedClientImpl.java @@ -53,7 +53,7 @@ public class FeedClientImpl implements FeedClient { charsetEncoder.onMalformedInput(CodingErrorAction.REPORT); charsetEncoder.onUnmappableCharacter(CodingErrorAction.REPORT); - final Document document = new Document(documentId, documentData, context); + Document document = new Document(documentId, documentData, context); operationProcessor.sendDocument(document); } diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java index 7cdd260285f..d48a86eea61 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java @@ -1,7 +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.vespa.http.client.core.communication; -import com.google.common.annotations.Beta; import com.yahoo.component.Vtag; import com.yahoo.vespa.http.client.config.ConnectionParams; import com.yahoo.vespa.http.client.config.Endpoint; @@ -46,7 +45,6 @@ import java.util.zip.GZIPOutputStream; /** * @author Einar M R Rosenvinge */ -@Beta class ApacheGatewayConnection implements GatewayConnection { private static Logger log = Logger.getLogger(ApacheGatewayConnection.class.getName()); @@ -83,7 +81,7 @@ class ApacheGatewayConnection implements GatewayConnection { this.httpClientFactory = httpClientFactory; this.connectionParams = connectionParams; this.httpClient = null; - final boolean isJson = feedParams.getDataFormat() == FeedParams.DataFormat.JSON_UTF8; + boolean isJson = feedParams.getDataFormat() == FeedParams.DataFormat.JSON_UTF8; if (isJson) { startOfFeed = START_OF_FEED_JSON; endOfFeed = END_OF_FEED_JSON; @@ -379,6 +377,7 @@ class ApacheGatewayConnection implements GatewayConnection { * On re-connect we want to recreate the connection, hence we need a factory. */ public static class HttpClientFactory { + final ConnectionParams connectionParams; final boolean useSsl; diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ByteBufferInputStream.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ByteBufferInputStream.java index 56a525502a5..d951666090a 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ByteBufferInputStream.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ByteBufferInputStream.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.vespa.http.client.core.communication; -import com.google.common.annotations.Beta; - import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; @@ -11,10 +9,7 @@ import java.util.Deque; /** * @author Einar M R Rosenvinge - * - * @since 5.1.20 */ -@Beta class ByteBufferInputStream extends InputStream { private final Deque<ByteBuffer> currentBuffers = new ArrayDeque<>(); diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java index cbc80466dd5..67011a24b45 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ClusterConnection.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.http.client.core.communication; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.annotations.Beta; import com.yahoo.vespa.http.client.config.Cluster; import com.yahoo.vespa.http.client.config.ConnectionParams; import com.yahoo.vespa.http.client.config.Endpoint; @@ -24,7 +23,6 @@ import java.util.concurrent.TimeUnit; /** * @author Einar M R Rosenvinge */ -@Beta public class ClusterConnection implements AutoCloseable { private final OperationProcessor operationProcessor; diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/EndpointResultQueue.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/EndpointResultQueue.java index c7731f5ab48..cd146cf0e87 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/EndpointResultQueue.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/EndpointResultQueue.java @@ -1,9 +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.vespa.http.client.core.communication; -import com.google.common.annotations.Beta; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; import com.yahoo.vespa.http.client.FeedEndpointException; import com.yahoo.vespa.http.client.config.Endpoint; import com.yahoo.vespa.http.client.core.operationProcessor.EndPointResultFactory; @@ -11,7 +8,6 @@ import com.yahoo.vespa.http.client.core.EndpointResult; import com.yahoo.vespa.http.client.core.operationProcessor.OperationProcessor; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; @@ -21,7 +17,6 @@ import java.util.logging.Logger; /** * @author Einar M R Rosenvinge */ -@Beta class EndpointResultQueue { private static Logger log = Logger.getLogger(EndpointResultQueue.class.getName()); @@ -112,7 +107,6 @@ class EndpointResultQueue { operationProcessor.resultReceived(endpointResult, clusterId); } - @Beta private class DocumentTimerTask implements Runnable { private final String operationId; @@ -126,7 +120,6 @@ class EndpointResultQueue { } } - @Beta private class TimerFuture { private final ScheduledFuture<?> future; diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java index 26dc1d1bd73..f3cb0b7bcf7 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/IOThread.java @@ -1,7 +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.vespa.http.client.core.communication; -import com.google.common.annotations.Beta; import com.yahoo.vespa.http.client.FeedConnectException; import com.yahoo.vespa.http.client.FeedProtocolException; import com.yahoo.vespa.http.client.Result; @@ -29,7 +28,6 @@ import java.util.logging.Logger; * * @author Einar M R Rosenvinge */ -@Beta class IOThread implements Runnable, AutoCloseable { private static Logger log = Logger.getLogger(IOThread.class.getName()); diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java index 129e3ca245b..95df465c7ca 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/EndPointResultFactory.java @@ -1,7 +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.vespa.http.client.core.operationProcessor; -import com.google.common.annotations.Beta; import com.yahoo.vespa.http.client.Result; import com.yahoo.vespa.http.client.config.Endpoint; import com.yahoo.vespa.http.client.core.EndpointResult; @@ -20,7 +19,6 @@ import java.util.logging.Logger; /** * @author Einar M R Rosenvinge */ -@Beta public final class EndPointResultFactory { private static Logger log = Logger.getLogger(EndPointResultFactory.class.getName()); diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java index 4b95f367485..cff6ad2ed48 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationProcessor.java @@ -1,7 +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.vespa.http.client.core.operationProcessor; -import com.google.common.annotations.Beta; import com.google.common.collect.ArrayListMultimap; import com.yahoo.vespa.http.client.FeedClient; import com.yahoo.vespa.http.client.FeedEndpointException; @@ -33,7 +32,6 @@ import java.util.logging.Logger; * * @author dybis */ -@Beta public class OperationProcessor { private static final Logger log = Logger.getLogger(OperationProcessor.class.getName()); diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationStats.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationStats.java index a28c2f9805f..014bcf41951 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationStats.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/operationProcessor/OperationStats.java @@ -1,7 +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.vespa.http.client.core.operationProcessor; - import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.ObjectMapper; @@ -10,7 +9,6 @@ import com.yahoo.vespa.http.client.core.communication.ClusterConnection; import java.io.IOException; import java.io.StringWriter; -import java.io.Writer; import java.util.List; public class OperationStats { @@ -30,8 +28,8 @@ public class OperationStats { } private String generateSessionParamsAsXmlString(final SessionParams sessionParams) { - final ObjectMapper objectMapper = new ObjectMapper(); - final StringWriter stringWriter = new StringWriter(); + ObjectMapper objectMapper = new ObjectMapper(); + StringWriter stringWriter = new StringWriter(); try { JsonGenerator jsonGenerator = jsonFactory.createGenerator(stringWriter); objectMapper.writeValue(jsonGenerator, sessionParams); @@ -43,7 +41,7 @@ public class OperationStats { public String getStatsAsJson() { try { - final StringWriter stringWriter = new StringWriter(); + StringWriter stringWriter = new StringWriter(); JsonGenerator jsonGenerator = jsonFactory.createGenerator(stringWriter); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("clusters"); diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java index 48d7916b34e..279735cdd08 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/CommandLineArguments.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.vespa.http.client.runner; -import com.google.common.annotations.Beta; - import com.google.common.base.Splitter; import com.yahoo.vespa.http.client.config.Cluster; import com.yahoo.vespa.http.client.config.ConnectionParams; @@ -22,7 +20,6 @@ import java.util.concurrent.TimeUnit; * * @author dybis */ -@Beta @Command(name = "vespa-http-client", description = "This is a tool for feeding xml or json data to a Vespa application.") public class CommandLineArguments { diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/Runner.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/Runner.java index 0983d893ecc..6ed6cae7346 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/Runner.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/Runner.java @@ -58,8 +58,8 @@ public class Runner { } - public static void main(String[] args) throws IOException, InterruptedException { - final CommandLineArguments commandLineArgs = CommandLineArguments.build(args); + public static void main(String[] args) throws IOException { + CommandLineArguments commandLineArgs = CommandLineArguments.build(args); if (commandLineArgs == null) { return; } @@ -73,10 +73,10 @@ public class Runner { int intervalOfLogging = commandLineArgs.getVerbose() ? commandLineArgs.getWhenVerboseEnabledPrintMessageForEveryXDocuments() : Integer.MAX_VALUE; - final AtomicInteger numSent = new AtomicInteger(0); - final SimpleLoggerResultCallback callback = new SimpleLoggerResultCallback(numSent, intervalOfLogging); + AtomicInteger numSent = new AtomicInteger(0); + SimpleLoggerResultCallback callback = new SimpleLoggerResultCallback(numSent, intervalOfLogging); - final FeedClient feedClient = FeedClientFactory.create( + FeedClient feedClient = FeedClientFactory.create( commandLineArgs.createSessionParams(formatInputStream.getFormat()== FormatInputStream.Format.JSON), callback); long sendTotalTimeMs = send( @@ -89,11 +89,12 @@ public class Runner { double transferTimeSec = ((double) sendTotalTimeMs) / 1000.0; System.err.println("Sent " + fileSizeMb + " MB in " + transferTimeSec + " seconds."); System.err.println("Speed: " + ((fileSizeMb / transferTimeSec) * 8.0) + " Mbits/sec, + HTTP overhead " + - "(not taking compression into account)"); + "(not taking compression into account)"); if (transferTimeSec > 0) { System.err.printf("Docs/sec %.3f%n\n", numSent.get() / transferTimeSec); } } callback.printProgress(); } + } |