public static void main(String[] args) throws IOException, InvalidConfigurationException, InterruptedException { CommandLineChecker.check(args, new String[]{"configuration_file_path", "log4j_properties_file_path"}, PartitionServer.class); String configPath = args[0]; String log4jprops = args[1]; PartitionServerConfigurator configurator = new YamlPartitionServerConfigurator(configPath); PropertyConfigurator.configure(log4jprops); new PartitionServer(configurator, getHostName()).run(); }
public void run() throws IOException, InterruptedException { connectToRing(); addShutdownHook(); setStateSynchronized(HostState.IDLE); // In case of exception, server will stop and state will be coherent. addServerOfflineWatcher(); Thread.sleep(100); processCommandOnStartup(); while (!stopping) { try { if (command != null) { try { processCommand(command, host.getState()); } catch (IOException e) { LOG.error("Failed to process command: " + command, e); stopServingData(); stopUpdating(); setStateSynchronized(HostState.OFFLINE); // In case of exception, server will stop and state will be coherent. removeShutdownHook();
private void processExecuteUpdate(HostState state) throws IOException { switch (state) { case IDLE: host.setState(HostState.UPDATING); // In case of exception, server will stop and state will be coherent. executeUpdate(); // Next command is set by the updater thread break; default: LOG.info(ignoreIncompatibleCommandMessage(HostCommand.EXECUTE_UPDATE, state)); host.nextCommand(); // In case of exception, server will stop and state will be coherent. } }
try { handler = getHandler(); List<Selector> selectors = getServerSelectors(dataServer); closeServerSelectors(selectors);
private Map<String, FilesystemStatisticsAggregator> getFilesystemStatistics() throws IOException { Map<String, FilesystemStatisticsAggregator> result = new HashMap<String, FilesystemStatisticsAggregator>(); for (String filesystemRoot : getUsedFilesystemRoots()) { File filesystemRootFile = new File(filesystemRoot); result.put(filesystemRoot, new FilesystemStatisticsAggregator(filesystemRootFile.getTotalSpace(), filesystemRootFile.getUsableSpace())); } return result; }
@Override public void run() { try { IUpdateManager updateManager = getUpdateManager(); updateManager.update(); LOG.info("Update succeeded.");