public void waitForResponse(int timeoutMills) { long startTime = System.currentTimeMillis(); while (this.successSendResult.size() != this.msgSize) { if (System.currentTimeMillis() - startTime < timeoutMills) { TestUtil.waitForMonment(100); } else { logger.info("timeout but still not recv all response!"); break; } } }
private void cleanOldExecutionLogs(final long millis) { final long beforeDeleteLogsTimestamp = System.currentTimeMillis(); try { final int count = this.executorLoader.removeExecutionLogsByTime(millis); logger.info("Cleaned up " + count + " log entries."); } catch (final ExecutorManagerException e) { logger.error("log clean up failed. ", e); } logger.info( "log clean up time: " + (System.currentTimeMillis() - beforeDeleteLogsTimestamp) / 1000 + " seconds."); }
private Socket applySettings(Socket s) throws IOException { if(logger.isDebugEnabled()) logger.debug("Attempting to set socket receive buffer of " + this.socketReceiveBufferSize + " bytes"); s.setReceiveBufferSize(socketReceiveBufferSize); s.setSoTimeout(socketTimeout); if(logger.isDebugEnabled()) logger.info("Actually set socket receive buffer to " + s.getReceiveBufferSize() + " bytes"); return s; }
public void run() { try { DataSetStats totals = new DataSetStats(); List<String> names = new ArrayList<String>(); List<DataSetStats> stats = new ArrayList<DataSetStats>(); for(StorageEngine<ByteArray, byte[], byte[]> store: storeRepository.getAllStorageEngines()) { if(store instanceof ReadOnlyStorageEngine || store instanceof ViewStorageEngine || store instanceof MetadataStore) continue; logger.info(store.getClass()); logger.info("Calculating stats for '" + store.getName() + "'..."); DataSetStats curr = calculateStats(store); names.add(store.getName()); stats.add(curr); totals.add(curr); } for(int i = 0; i < names.size(); i++) logger.info("\n\nData statistics for store '" + names.get(i) + "':\n" + stats.get(i) + "\n\n"); logger.info("Totals: \n " + totals + "\n\n"); } catch(Exception e) { logger.error("Error in thread: ", e); } } });
boolean details) { if(logger.isInfoEnabled()) { logger.info("Connecting to bootstrap server: " + url); if(storeNames != null) { if(!storeNames.contains(storeName)) { logger.debug("Will not sample store " + storeName + " since it is not in list of storeNames provided on command line."); for(String storeName: storeNames) { if(!this.storeNamesSet.contains(storeName)) { badStoreNames.add(storeName); if(badStoreNames.size() > 0) { Utils.croak("Some storeNames provided on the command line were not found on this cluster: " + badStoreNames);
private List<Long> getValidationOutputFromHive(List<String> queries) throws IOException { Path hiveTempDir = new Path("/tmp" + Path.SEPARATOR + hiveOutput); query = "INSERT OVERWRITE DIRECTORY '" + hiveTempDir + "' " + query; log.info("Executing query: " + query); try { if (this.hiveSettings.size() > 0) { hiveJdbcConnector.executeStatements(this.hiveSettings.toArray(new String[this.hiveSettings.size()])); if (files.size() > 1) { log.warn("Found more than one output file. Should have been one."); } else if (files.size() == 0) { log.warn("Found no output file. Should have been one."); } else { String theString = IOUtils.toString(new InputStreamReader(this.fs.open(files.get(0).getPath()), Charsets.UTF_8)); log.info("Found row count: " + theString.trim()); if (StringUtils.isBlank(theString.trim())) { rowCounts.add(0l); } else { try { rowCounts.add(Long.parseLong(theString.trim())); } catch (NumberFormatException e) { throw new RuntimeException("Could not parse Hive output: " + theString.trim(), e); log.debug("Deleting temp dir: " + hiveTempDir); this.fs.delete(hiveTempDir, true);
private static void getOtherNamenodesToken(List<String> otherNamenodes, Configuration conf, Credentials cred) throws IOException { LOG.info(OTHER_NAMENODES + ": " + otherNamenodes); Path[] ps = new Path[otherNamenodes.size()]; for (int i = 0; i < ps.length; i++) { ps[i] = new Path(otherNamenodes.get(i).trim()); } TokenCache.obtainTokensForNamenodes(cred, ps, conf); LOG.info("Successfully fetched tokens for: " + otherNamenodes); }
private void printRemainingTasks(List<Integer> stealerIds) { for(int stealerId: stealerIds) { List<Integer> donorIds = new ArrayList<Integer>(); for(StealerBasedRebalanceTask sbTask: tasksByStealer.get(stealerId)) { int donorId = sbTask.getStealInfos().get(0).getDonorId(); donorIds.add(donorId); } logger.info(" Remaining work for Stealer " + stealerId + " Donors : " + donorIds); } }
private void commitToVoldemort(List<String> storeNamesToCommit) { if(logger.isDebugEnabled()) { logger.debug("Trying to commit to Voldemort"); if(nodesToStream == null || nodesToStream.size() == 0) { if(logger.isDebugEnabled()) { logger.debug("No nodes to stream to. Returning."); logger.error("Exception during commit", e); hasError = true; if(!faultyNodes.contains(node.getId())) faultyNodes.add(node.getId()); logger.warn("StreamingSession may not have been initialized since Variable streamingresults is null. Skipping callback "); return; logger.info("Invoking the Recovery Callback"); Future future = streamingresults.submit(recoveryCallback); try { if(logger.isDebugEnabled()) { logger.debug("Commit successful"); logger.debug("calling checkpoint callback"); logger.warn("Checkpoint callback failed!", e1); } catch(ExecutionException e1) { logger.warn("Checkpoint callback failed during execution!", e1);
Versioned<String> storesValue) { if (remoteNodeIds == null || remoteNodeIds.size() == 0) { throw new IllegalArgumentException("One ore more nodes expected for NodeIds"); logger.info("Setting " + clusterKey + " and " + storesKey + " for " + getAdminClientCluster().getNodeById(currentNodeId).getHost() + ":" + getAdminClientCluster().getNodeById(currentNodeId).getId()); try { for(StoreDefinition storeDef: storeDefs) { storeNames.add(storeDef.getName());
public Collection<Object> waitForMessageConsume(Collection<Object> allSendMsgs, int timeoutMills) { this.allSendMsgs = allSendMsgs; List<Object> sendMsgs = new ArrayList<Object>(); sendMsgs.addAll(allSendMsgs); long curTime = System.currentTimeMillis(); while (!sendMsgs.isEmpty()) { Iterator<Object> iter = sendMsgs.iterator(); while (iter.hasNext()) { Object msg = iter.next(); if (msgBodys.getAllData().contains(msg)) { iter.remove(); } } if (sendMsgs.isEmpty()) { break; } else { if (System.currentTimeMillis() - curTime >= timeoutMills) { logger.error(String.format("timeout but [%s] not recv all send messages!", listenerName)); break; } else { logger.info(String.format("[%s] still [%s] msg not recv!", listenerName, sendMsgs.size())); TestUtil.waitForMonment(500); } } } return sendMsgs; }
private void registerMbean(final String name, final Object mbean) { final Class<?> mbeanClass = mbean.getClass(); final ObjectName mbeanName; try { mbeanName = new ObjectName(mbeanClass.getName() + ":name=" + name); this.mbeanServer.registerMBean(mbean, mbeanName); logger.info("Bean " + mbeanClass.getCanonicalName() + " registered."); this.registeredMBeans.add(mbeanName); } catch (final Exception e) { logger.error("Error registering mbean " + mbeanClass.getCanonicalName(), e); } }
final long updateTime = this.updateProvider.getUpdateTime(sourcePartition); if (shouldValidate(sourcePartition)) { log.info(String.format("Validating partition: %s", sourcePartition.getCompleteName())); .getDbName(), destinationMeta.getKey().get(), Optional.of(sourcePartition), this.isNestedORC)); this.futures.add(this.exec.submit(new Callable<Void>() { @Override public Void call() throws Exception { log.debug(String.format("Not validating partition: %s as updateTime: %s is not in range of max look back: %s " + "and skip recent than: %s", sourcePartition.getCompleteName(), updateTime, this.maxLookBackTime, this.skipRecentThanTime)); log.warn( String.format("Not validating partition: %s %s", sourcePartition.getCompleteName(), e.getMessage())); } catch (UpdateNotFoundException e) { log.warn(String.format("Not validating partition: %s as update time was not found. %s", sourcePartition.getCompleteName(), e.getMessage())); log.info(String.format("No conversion config found for format %s. Ignoring data validation", format));
@Override public void rip() throws IOException { int index = 0; LOGGER.info("Retrieving " + this.url); sendUpdate(STATUS.LOADING_RESOURCE, this.url.toExternalForm()); JSONObject json = getFirstPage(); while (imageURLs.size() > 1) { imageURLs.remove(1); LOGGER.debug("Found image url #" + index+ ": " + imageURL); downloadURL(new URL(imageURL), index); json = getNextPage(json); } catch (IOException e) { LOGGER.info("Can't get next page: " + e.getMessage()); break; LOGGER.debug("Waiting for threadpool " + getThreadPool().getClass().getName()); getThreadPool().waitForThreads();
/** Listens for client connections **/ public void run() { LOG.info("Thread started"); try { while (true) { LOG.debug("Waiting for a connection"); final Socket client = mSvrSock.accept(); LOG.debug("Got a connection from " + client.getInetAddress().getHostName()); final Thread t = new Thread(new Slurper(client)); t.setDaemon(true); t.start(); } } catch (IOException e) { LOG.error("Error in accepting connections, stopping.", e); } } }
static void roll() { try { Socket socket = new Socket(host, port); DataOutputStream dos = new DataOutputStream(socket.getOutputStream()); DataInputStream dis = new DataInputStream(socket.getInputStream()); dos.writeUTF(ExternallyRolledFileAppender.ROLL_OVER); String rc = dis.readUTF(); if(ExternallyRolledFileAppender.OK.equals(rc)) { cat.info("Roll over signal acknowledged by remote appender."); } else { cat.warn("Unexpected return code "+rc+" from remote entity."); System.exit(2); } } catch(IOException e) { cat.error("Could not send roll signal on host "+host+" port "+port+" .", e); System.exit(2); } System.exit(0); } }
/** loops getting the events **/ public void run() { LOG.debug("Starting to get data"); try { final ObjectInputStream ois = new ObjectInputStream(mClient.getInputStream()); while (true) { final LoggingEvent event = (LoggingEvent) ois.readObject(); mModel.addEvent(new EventDetails(event)); } } catch (EOFException e) { LOG.info("Reached EOF, closing connection"); } catch (SocketException e) { LOG.info("Caught SocketException, closing connection"); } catch (IOException e) { LOG.warn("Got IOException, closing connection", e); } catch (ClassNotFoundException e) { LOG.warn("Got ClassNotFoundException, closing connection", e); } try { mClient.close(); } catch (IOException e) { LOG.warn("Error closing connection", e); } } }
/** * Prompts the user for a file to load events from. * @param aIgnore an <code>ActionEvent</code> value */ public void actionPerformed(ActionEvent aIgnore) { LOG.info("load file called"); if (mChooser.showOpenDialog(mParent) == JFileChooser.APPROVE_OPTION) { LOG.info("Need to load a file"); final File chosen = mChooser.getSelectedFile(); LOG.info("loading the contents of " + chosen.getAbsolutePath()); try { final int num = loadFile(chosen.getAbsolutePath()); JOptionPane.showMessageDialog( mParent, "Loaded " + num + " events.", "CHAINSAW", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { LOG.warn("caught an exception loading the file", e); JOptionPane.showMessageDialog( mParent, "Error parsing file - " + e.getMessage(), "CHAINSAW", JOptionPane.ERROR_MESSAGE); } } }