* @param work this is the Runnable to invoke
*/
public static void queueWork(Runnable work) {
- incomingWork.offer(work);
+ if (!incomingWork.offer(work)) {
+ logger.info("incomingWork returned false");
+ }
}
/**
// work that runs every cycle
for (Runnable work : backgroundWork) {
- try {
- work.run();
- } catch (Exception e) {
- logger.error("Exception in MainLoop background work", e);
- }
+ backgroundWorkRunnable(work);
}
} catch (Exception e) {
logger.error("Exception in MainLoop", e);
}
}
+ /**
+ * Runnable try loop.
+ */
+ static void backgroundWorkRunnable(Runnable work) {
+ try {
+ work.run();
+ } catch (Exception e) {
+ logger.error("Exception in MainLoop background work", e);
+ }
+ }
+
/**
* Poll for and process incoming messages for up to 1 second.
*/
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Collection;
* This method may be invoked from any thread, and is used as the main
* entry point when testing.
*
- * @param args arguments contaning an '=' character are intepreted as
+ * @param args arguments containing an '=' character are interpreted as
* a property, other arguments are presumed to be a property file.
*/
public static void main(String[] args) throws IOException {
Properties prop = new Properties();
for (String arg : args) {
- // arguments with an '=' in them are a property definition;
+ // arguments with an equals sign in them are a property definition;
// otherwise, they are a properties file name
if (arg.contains("=")) {
// initialize the 'target' field
target = getTarget(client);
- } catch (KeyManagementException | NoSuchAlgorithmException
- | NoSuchFieldException | IllegalAccessException
- | ClassNotFoundException | HttpClientConfigException e) {
+ } catch (NoSuchFieldException | IllegalAccessException | HttpClientConfigException e) {
logger.error("Server.newServer: problems creating 'client'", e);
}
}
// initialize the 'target' field
target = getTarget(client);
- } catch (KeyManagementException | NoSuchAlgorithmException
- | NoSuchFieldException | IllegalAccessException
- | ClassNotFoundException | HttpClientConfigException e) {
+ } catch (NoSuchFieldException | IllegalAccessException | HttpClientConfigException e) {
logger.error("Server.checkServer: problems recreating 'client'", e);
}
}
}
/**
- * Fetch, and possibily calculate, the "notify list" associated with this
+ * Fetch, and possibly calculate, the "notify list" associated with this
* server. This is the list of servers to forward a server and bucket
* information to, and is approximately log2(n) in length, where 'n' is
* the total number of servers.
siteSocketAddresses.add(thisSiteSocketAddress);
// the list we are building
- notifyList = new LinkedList<Server>();
+ notifyList = new LinkedList<>();
int index = 1;
for ( ; ; ) {
* @param destName the string name to use for the destination
*/
static HttpClient buildClient(String name, InetSocketAddress dest, String destName)
- throws KeyManagementException, NoSuchAlgorithmException,
- ClassNotFoundException, HttpClientConfigException {
+ throws HttpClientConfigException {
return HttpClientFactoryInstance.getClientFactory().build(
BusTopicParams.builder()
getTarget(httpClient).path("admin").request().post(entity);
httpClient.shutdown();
httpClient = null;
- } catch (KeyManagementException | NoSuchAlgorithmException e) {
- out.println(host + ": Unable to create client connection");
- logger.error(PINGHOSTS_ERROR, e);
} catch (NoSuchFieldException | IllegalAccessException e) {
out.println(host + ": Unable to get link to target");
logger.error(PINGHOSTS_ERROR, e);
if (AuditPostResponse.responseSupport(
respData, "self (" + server + ")",
"TargetLock.Audit.send")) {
- // a return falue of 'true' either indicates the
+ // a return value of 'true' either indicates the
// mismatches were resolved after a retry, or we
// received an interrupt, and need to abort
return;
Entity.entity(new String(encodedData),
MediaType.APPLICATION_OCTET_STREAM_TYPE);
- server.post("lock/audit", entity, new AuditPostResponse(server));
+ server.post(LOCK_AUDIT, entity, new AuditPostResponse(server));
}
}