public class Utils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Utils.WithFutureExceptionHandler |
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.util.concurrent.Future<TextProtocol.MessageExchange>> |
broadcastMessage(java.util.Set<java.net.InetSocketAddress> targets,
java.lang.String serviceName,
TextProtocol.RequestMessage requestMessage,
java.util.concurrent.ExecutorService threadPool) |
(package private) static void |
checkFutures(java.util.List<java.util.concurrent.Future<TextProtocol.MessageExchange>> futures,
java.util.logging.Logger logger,
EnvironmentImpl envImpl,
java.util.logging.Formatter formatter)
Utility to wait for completion of futures.
|
static void |
cleanup(java.util.logging.Logger logger,
EnvironmentImpl envImpl,
java.util.logging.Formatter formatter,
java.net.Socket socket,
java.io.BufferedReader in,
java.io.PrintWriter out)
Cleans up the socket and its related streams after a request/response
cycle.
|
(package private) static void |
discardFutures(java.util.List<java.util.concurrent.Future<TextProtocol.MessageExchange>> futures)
Discard futures computations, since we no longer care about their
outcomes.
|
public static void cleanup(java.util.logging.Logger logger, EnvironmentImpl envImpl, java.util.logging.Formatter formatter, java.net.Socket socket, java.io.BufferedReader in, java.io.PrintWriter out)
socket
- the socket to be closedin
- the request stream to be closedout
- the response stream to be closedpublic static java.util.List<java.util.concurrent.Future<TextProtocol.MessageExchange>> broadcastMessage(java.util.Set<java.net.InetSocketAddress> targets, java.lang.String serviceName, TextProtocol.RequestMessage requestMessage, java.util.concurrent.ExecutorService threadPool)
targets
- of the broadcastrequestMessage
- to be broadcastthreadPool
- used to issue message in parallelstatic void checkFutures(java.util.List<java.util.concurrent.Future<TextProtocol.MessageExchange>> futures, java.util.logging.Logger logger, EnvironmentImpl envImpl, java.util.logging.Formatter formatter)
futures
- the futures to wait forlogger
- used to report any error messagesstatic void discardFutures(java.util.List<java.util.concurrent.Future<TextProtocol.MessageExchange>> futures)
futures
- futures to be discarded.Copyright (c) 2004-2012 Oracle. All rights reserved.