private void deployHADeployments() { int size = toDeployOnQuorum.size(); if (size != 0) { log.info("There are " + size + " HA deployments waiting on a quorum. These will now be deployed"); Runnable task; while ((task = toDeployOnQuorum.poll()) != null) { try { task.run(); } catch (Throwable t) { log.error("Failed to run redeployment task", t); } } } }
public void handle(AsyncResult<Boolean> res) { if (res.succeeded()) { if (res.result) { cacheAuthorisation(sessionID, sock); checkAndSend(send, address, jsonObject, sock, replyAddress); } else { log.debug("Inbound message for address " + address + " rejected because sessionID is not authorised"); } } else { log.error("Error in performing authorisation", res.exception); } } });
public void handle(HttpServerRequest req) { if (log.isTraceEnabled()) log.trace("Request: " + req.uri + " does not match, returning 404"); req.response.statusCode = 404; req.response.end(); } });
private void logInternal(final String perms) { if ((perms != null) && log.isDebugEnabled()) { log.debug("You are running on Windows and POSIX style file permissions are not supported"); } }
@Override public void reportException(Logger logger, Throwable t) { if (logger != null) { logger.error("Exception in HK2VerticleFactory", t); } }
@Test protected void runTestInLoop(String testName, int iters) throws Exception { Method meth = getClass().getMethod(testName, (Class<?>[])null); for (int i = 0; i < iters; i++) { log.info("****************************** ITER " + i); meth.invoke(this); tearDown(); if (i != iters - 1) { setUp(); } } }
private void unzipModule(final ModuleIdentifier modID, final ModuleZipInfo zipInfo, boolean deleteZip) { // We synchronize to prevent a race whereby it tries to unzip the same module at the // same time (e.g. deployModule for the same module name has been called in parallel) String modName = modID.toString(); synchronized (modName.intern()) { checkCreateModDirs(); File fdest = new File(modRoot, modName); File sdest = new File(systemModRoot, modName); if (fdest.exists() || sdest.exists()) { // This can happen if the same module is requested to be installed // at around the same time // It's ok if this happens log.warn("Module " + modID + " is already installed"); return; } // Unzip into temp dir first File tdest = unzipIntoTmpDir(zipInfo, deleteZip); // Check if it's a system module JsonObject conf = loadModuleConfig(createModJSONFile(tdest), modID); ModuleFields fields = new ModuleFields(conf); boolean system = fields.isSystem(); // Now copy it to the proper directory String moveFrom = tdest.getAbsolutePath(); safeMove(moveFrom, system ? sdest.getAbsolutePath() : fdest.getAbsolutePath()); log.info("Module " + modID +" successfully installed"); } }
public void handle(HttpServerRequest req) { try { if (log.isTraceEnabled()) log.trace("In Iframe handler"); if (etag != null && etag.equals(req.headers().get("if-none-match"))) { req.response.statusCode = 304; req.response.end(); } else { req.response.headers().put("Content-Type", "text/html; charset=UTF-8"); req.response.headers().put("Cache-Control", "public,max-age=31536000"); long oneYear = 365 * 24 * 60 * 60 * 1000; String expires = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz").format(new Date(System.currentTimeMillis() + oneYear)); req.response.headers().put("Expires", expires); req.response.headers().put("ETag", etag); req.response.end(iframeHTML); } } catch (Exception e) { log.error("Failed to server iframe", e); } } };
public void handle(final Message<JsonObject> msg) { Match curMatch = checkMatches(false, address, msg.body); if (curMatch.doesMatch) { if (curMatch.requiresAuth && sockAuths.get(sock) == null) { log.debug("Outbound message for address " + address + " rejected because auth is required and socket is not authed"); } else { checkAddAccceptedReplyAddress(msg.replyAddress); deliverMessage(sock, address, msg); } } else { log.debug("Outbound message for address " + address + " rejected because there is no inbound match"); } } };
public synchronized void close() { vertx.cancelTimer(timerID); Set<Deployment> deps = new HashSet<>(); for (Map.Entry<Path, Set<Deployment>> entry: watchedDeployments.entrySet()) { deps.addAll(entry.getValue()); } toUndeploy.addAll(deps); processUndeployments(); try { watchService.close(); } catch (IOException ex) { log.warn("Error while shutting down watch service: " + ex.getMessage(), ex); } closed = true; }
public synchronized void report() { log.trace("available: " + available.size() + " connection count: " + connectionCount + " waiters: " + waiters.size()); }
public void handle(AsyncResult<Void> event) { if (event.exception != null) { log.error("Failed to remove entry", event.exception); } } };
private void fatJar(String modName, Args args) { log.info("Attempting to make a fat jar for module " + modName); String directory = args.map.get("-d"); if (directory != null && !new File(directory).exists()) { log.info("Directory does not exist: " + directory); return; } createPM().makeFatJar(modName, directory, createLoggingHandler("making fat jar", unblockHandler())); block(); }
@Override protected void initSeeds(JsonArray seeds) { // Recall super super.initSeeds(seeds); // If default, try env vars if (DEFAULT_SEEDS.equals(this.seeds)) { String envVarSeeds = container.env().get(ENV_VAR_SEEDS); if (!Strings.isNullOrEmpty(envVarSeeds)) { logger.debug("Using environment configuration of " + envVarSeeds); String[] seedsArray = envVarSeeds.split("\\|"); this.seeds = ImmutableList.copyOf(seedsArray); } } }
private void checkAndSend(boolean send, final String address, JsonObject jsonObject, final SockJSSocket sock, final String replyAddress) { final Handler<Message<JsonObject>> replyHandler; if (replyAddress != null) { replyHandler = new Handler<Message<JsonObject>>() { public void handle(Message<JsonObject> message) { // Note we don't check outbound matches for replies // Replies are always let through if the original message // was approved checkAddAccceptedReplyAddress(message.replyAddress); deliverMessage(sock, replyAddress, message); } }; } else { replyHandler = null; } if (log.isDebugEnabled()) { log.debug("Forwarding message to address " + address + " on event bus"); } if (send) { eb.send(address, jsonObject, replyHandler); } else { eb.publish(address, jsonObject); } }
/** * Create the singleton Hazelcast instance if necessary * @return */ private synchronized HazelcastInstance initHazelcast() { if (instance == null) { Config cfg = getConfig(null); if (cfg == null) { log.warn("Cannot find cluster.xml on classpath. Using default cluster configuration"); } // default instance instance = Hazelcast.init(cfg); // Properly shutdown all instances Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { Hazelcast.shutdownAll(); } }); } return instance; }
public void handle(HttpClientResponse resp) { if (resp.statusCode == 200) { log.info("Downloading module..."); resp.bodyHandler(new Handler<Buffer>() { public void handle(Buffer buffer) { mod.set(buffer); latch.countDown(); } }); } else if (resp.statusCode == 404) { log.error("Can't find module " + moduleName + " in repository"); latch.countDown(); } else { log.error("Failed to download module: " + resp.statusCode); latch.countDown(); } } });