summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-12-13 10:01:13 -0800
committerJon Bratseth <bratseth@oath.com>2018-12-13 10:01:13 -0800
commit7b8bb9e7e84c43240457e24bd846291c24221747 (patch)
tree29e73d6a14cce00174f2b4d264c66d8dbd65ea52
parent79d3bf6839460b78623327b82d4374814a8e3e37 (diff)
Nonfunctional changes only
-rw-r--r--documentapi/src/main/java/com/yahoo/documentapi/Session.java6
-rw-r--r--documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java7
-rw-r--r--jrt/src/com/yahoo/jrt/MaybeTlsCryptoEngine.java8
-rwxr-xr-xmessagebus/src/main/java/com/yahoo/messagebus/Routable.java29
-rw-r--r--messagebus/src/main/java/com/yahoo/messagebus/SendProxy.java1
-rw-r--r--messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java2
-rw-r--r--messagebus/src/main/java/com/yahoo/messagebus/SourceSession.java19
-rwxr-xr-xvespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java1
8 files changed, 31 insertions, 42 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/Session.java b/documentapi/src/main/java/com/yahoo/documentapi/Session.java
index 8ab098397de..3f296723079 100644
--- a/documentapi/src/main/java/com/yahoo/documentapi/Session.java
+++ b/documentapi/src/main/java/com/yahoo/documentapi/Session.java
@@ -18,7 +18,7 @@ public interface Session {
*
* @return the next response, or null if no response is ready at this time
*/
- public Response getNext();
+ Response getNext();
/**
* Returns the next response of this session. This will block until a response is ready
@@ -28,12 +28,12 @@ public interface Session {
* @return the next response, or null if no response becomes ready before the timeout expires
* @throws InterruptedException if this thread is interrupted while waiting
*/
- public Response getNext(int timeoutMilliseconds) throws InterruptedException;
+ Response getNext(int timeoutMilliseconds) throws InterruptedException;
/**
* Destroys this session and frees up any resources it has held. Making further calls on a destroyed
* session causes a runtime exception.
*/
- public void destroy();
+ void destroy();
}
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java
index eb71b3cfe47..8a6fa85c68b 100644
--- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java
+++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusAsyncSession.java
@@ -32,7 +32,7 @@ public class MessageBusAsyncSession implements MessageBusSession, AsyncSession {
private static final Logger log = Logger.getLogger(MessageBusAsyncSession.class.getName());
private final AtomicLong requestId = new AtomicLong(0);
- private final BlockingQueue<Response> responses = new LinkedBlockingQueue<Response>();
+ private final BlockingQueue<Response> responses = new LinkedBlockingQueue<>();
private final ThrottlePolicy throttlePolicy;
private final SourceSession session;
private String route;
@@ -120,8 +120,8 @@ public class MessageBusAsyncSession implements MessageBusSession, AsyncSession {
* A convenience method for assigning the internal trace level and route string to a message before sending it
* through the internal mbus session object.
*
- * @param msg The message to send.
- * @return The document api result object.
+ * @param msg the message to send.
+ * @return the document api result object.
*/
public Result send(Message msg) {
try {
@@ -292,4 +292,5 @@ public class MessageBusAsyncSession implements MessageBusSession, AsyncSession {
}
}
}
+
}
diff --git a/jrt/src/com/yahoo/jrt/MaybeTlsCryptoEngine.java b/jrt/src/com/yahoo/jrt/MaybeTlsCryptoEngine.java
index e4355ae793a..d888690c39c 100644
--- a/jrt/src/com/yahoo/jrt/MaybeTlsCryptoEngine.java
+++ b/jrt/src/com/yahoo/jrt/MaybeTlsCryptoEngine.java
@@ -9,7 +9,7 @@ import java.nio.channels.SocketChannel;
* auto-detected using clever heuristics. The use of tls for outgoing
* connections is controlled by the useTlsWhenClient flag given to the
* constructor.
- **/
+ */
public class MaybeTlsCryptoEngine implements CryptoEngine {
private final TlsCryptoEngine tlsEngine;
@@ -20,7 +20,8 @@ public class MaybeTlsCryptoEngine implements CryptoEngine {
this.useTlsWhenClient = useTlsWhenClient;
}
- @Override public CryptoSocket createCryptoSocket(SocketChannel channel, boolean isServer) {
+ @Override
+ public CryptoSocket createCryptoSocket(SocketChannel channel, boolean isServer) {
if (isServer) {
return new MaybeTlsCryptoSocket(channel, tlsEngine);
} else if (useTlsWhenClient) {
@@ -30,7 +31,8 @@ public class MaybeTlsCryptoEngine implements CryptoEngine {
}
}
- @Override public String toString() { return "MaybeTlsCryptoEngine(useTlsWhenClient:" + useTlsWhenClient + ")"; }
+ @Override
+ public String toString() { return "MaybeTlsCryptoEngine(useTlsWhenClient:" + useTlsWhenClient + ")"; }
@Override
public void close() {
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/Routable.java b/messagebus/src/main/java/com/yahoo/messagebus/Routable.java
index b797c103e67..e761a874ac1 100755
--- a/messagebus/src/main/java/com/yahoo/messagebus/Routable.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/Routable.java
@@ -69,41 +69,27 @@ public abstract class Routable {
return callStack.pop(this);
}
- /**
- * Return the context of this routable.
- *
- * @return The context.
- */
+ /** Returns the context of this routable. */
public Object getContext() {
return context;
}
/**
- * Set a new context for this routable. Please note that the context is <u>not</u> something that is passed along a
+ * Sets a new context for this routable. Please note that the context is <u>not</u> something that is passed along a
* message, it is simply a user context for the handler currently manipulating a message. When the corresponding
* reply reaches the registered reply handler, its content will be the same as that of the outgoing message. More
* technically, this context is contained in the callstack of a routable.
- *
- * @param context The new context.
*/
public void setContext(Object context) {
this.context = context;
}
- /**
- * Return the callstack of this routable.
- *
- * @return The callstack.
- */
+ /** Returns the callstack of this routable. */
public CallStack getCallStack() {
return callStack;
}
- /**
- * Returns the trace object of this routable.
- *
- * @return The trace object.
- */
+ /** Returns the trace object of this routable. */
public Trace getTrace() {
return trace;
}
@@ -112,15 +98,14 @@ public abstract class Routable {
* Return the name of the protocol that defines this routable. This must be implemented by all inheriting classes,
* and should then return the result of {@link com.yahoo.messagebus.Protocol#getName} of its protocol.
*
- * @return The name of the protocol defining this message.
+ * @return the name of the protocol defining this message.
*/
public abstract Utf8String getProtocol();
/**
- * Obtain the type of this routable. The id '0' is reserved for the EmptyReply class. Other ids must be defined by
+ * Returns the type of this routable. The id '0' is reserved for the EmptyReply class. Other ids must be defined by
* the application protocol.
- *
- * @return The message type.
*/
public abstract int getType();
+
}
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/SendProxy.java b/messagebus/src/main/java/com/yahoo/messagebus/SendProxy.java
index ecc6bfebc41..df60fc5bdbf 100644
--- a/messagebus/src/main/java/com/yahoo/messagebus/SendProxy.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/SendProxy.java
@@ -90,4 +90,5 @@ public class SendProxy implements MessageHandler, ReplyHandler {
handler.handleReply(reply);
}
}
+
}
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java b/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java
index b804c776969..35218364c8f 100644
--- a/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/Sequencer.java
@@ -103,7 +103,7 @@ public class Sequencer implements MessageHandler, ReplyHandler {
* sequencing-id, it is simply passed through to the next handler in the chain. Sequenced messages are sent only if
* there is no queue for their id, otherwise they are queued.
*
- * @param msg The message to send.
+ * @param msg the message to send.
*/
@Override
public void handleMessage(Message msg) {
diff --git a/messagebus/src/main/java/com/yahoo/messagebus/SourceSession.java b/messagebus/src/main/java/com/yahoo/messagebus/SourceSession.java
index 3bfdfaa1f4a..4fdfa341e3b 100644
--- a/messagebus/src/main/java/com/yahoo/messagebus/SourceSession.java
+++ b/messagebus/src/main/java/com/yahoo/messagebus/SourceSession.java
@@ -1,25 +1,22 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.messagebus;
-import com.yahoo.log.LogLevel;
import com.yahoo.messagebus.routing.Route;
import com.yahoo.messagebus.routing.RoutingTable;
-import com.yahoo.text.Utf8String;
-import java.util.*;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Queue;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.logging.Logger;
/**
- * <p>A session supporting sending new messages.</p>
+ * A session supporting sending new messages.
*
* @author Simon Thoresen Hult
*/
public final class SourceSession implements ReplyHandler, MessageBus.SendBlockedMessages {
- private static Logger log = Logger.getLogger(SourceSession.class.getName());
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private final CountDownLatch done = new CountDownLatch(1);
private final Object lock = new Object();
@@ -116,11 +113,12 @@ public final class SourceSession implements ReplyHandler, MessageBus.SendBlocked
* </code>
*
* @param msg the message to send
- * @return The result of <i>initiating</i> sending of this message.
+ * @return the result of <i>initiating</i> sending of this message
*/
public Result send(Message msg) {
return sendInternal(updateTiming(msg));
}
+
private Message updateTiming(Message msg) {
msg.setTimeReceivedNow();
if (msg.getTimeRemaining() <= 0) {
@@ -128,13 +126,14 @@ public final class SourceSession implements ReplyHandler, MessageBus.SendBlocked
}
return msg;
}
+
private Result sendInternal(Message msg) {
synchronized (lock) {
if (closed) {
return new Result(ErrorCode.SEND_QUEUE_CLOSED,
"Source session is closed.");
}
- if (throttlePolicy != null && !throttlePolicy.canSend(msg, pendingCount)) {
+ if (throttlePolicy != null && ! throttlePolicy.canSend(msg, pendingCount)) {
return new Result(ErrorCode.SEND_QUEUE_FULL,
"Too much pending data (" + pendingCount + " messages).");
}
@@ -247,7 +246,7 @@ public final class SourceSession implements ReplyHandler, MessageBus.SendBlocked
private void expireStalledBlockedMessages() {
synchronized (lock) {
- final Iterator<BlockedMessage> each = blockedQ.iterator();
+ Iterator<BlockedMessage> each = blockedQ.iterator();
while (each.hasNext()) {
if (each.next().notifyIfExpired()) {
each.remove();
diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java
index ce6df32a9a1..54e638717e0 100755
--- a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java
+++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessageBusSessionFactory.java
@@ -76,6 +76,7 @@ public class MessageBusSessionFactory implements SessionFactory {
}
private class SourceSessionWrapper extends SendSession {
+
private final SourceSession session;
private final Metric metric;
private final Metric.Context context;