com.sleepycat.je.rep.elections
Class Utils

java.lang.Object
  extended by com.sleepycat.je.rep.elections.Utils

public class Utils
extends Object


Nested Class Summary
static class Utils.WithFutureExceptionHandler
           
 
Constructor Summary
Utils()
           
 
Method Summary
static List<Future<TextProtocol.MessageExchange>> broadcastMessage(Set<InetSocketAddress> targets, String serviceName, TextProtocol.RequestMessage requestMessage, ExecutorService threadPool)
           
(package private) static void checkFutures(List<Future<TextProtocol.MessageExchange>> futures, Logger logger, EnvironmentImpl envImpl, Formatter formatter)
          Utility to wait for completion of futures.
static void cleanup(Logger logger, EnvironmentImpl envImpl, Formatter formatter, Socket socket, BufferedReader in, PrintWriter out)
          Cleans up the socket and its related streams after a request/response cycle.
(package private) static void discardFutures(List<Future<TextProtocol.MessageExchange>> futures)
          Discard futures computations, since we no longer care about their outcomes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

cleanup

public static void cleanup(Logger logger,
                           EnvironmentImpl envImpl,
                           Formatter formatter,
                           Socket socket,
                           BufferedReader in,
                           PrintWriter out)
Cleans up the socket and its related streams after a request/response cycle.

Parameters:
socket - the socket to be closed
in - the request stream to be closed
out - the response stream to be closed

broadcastMessage

public static List<Future<TextProtocol.MessageExchange>> broadcastMessage(Set<InetSocketAddress> targets,
                                                                          String serviceName,
                                                                          TextProtocol.RequestMessage requestMessage,
                                                                          ExecutorService threadPool)
Parameters:
targets - of the broadcast
requestMessage - to be broadcast
threadPool - used to issue message in parallel
Returns:
the list of futures representing the results of the broadcast

checkFutures

static void checkFutures(List<Future<TextProtocol.MessageExchange>> futures,
                         Logger logger,
                         EnvironmentImpl envImpl,
                         Formatter formatter)
Utility to wait for completion of futures.

Parameters:
futures - the futures to wait for
logger - used to report any error messages

discardFutures

static void discardFutures(List<Future<TextProtocol.MessageExchange>> futures)
Discard futures computations, since we no longer care about their outcomes.

Parameters:
futures - futures to be discarded.


Copyright (c) 2004-2010 Oracle. All rights reserved.