org.apache.log4j.PropertyConfigurator.configureAndWatch(log4jConfigPath);
} else {
logger.warn("log4j.properties not found on classpath!");
}
Indexer indexer = null;
CompositeSearcher searcher = null;
try {
int indexerPort = DEFAULT_INDEXER_PORT;
int searcherPort = DEFAULT_SEARCHER_PORT;
if (args.length == 2) {
try {
indexerPort = Integer.valueOf(args[0]).intValue();
searcherPort = Integer.valueOf(args[1]).intValue();
} catch (NumberFormatException e) {
logger.error("Invalid parameters " +e);
printUsage();
return;
}
} else if (args.length != 0) {
printUsage();
return;
}
indexer = new Indexer();
XmlrpcServer indexerServer = new XmlrpcServer(indexerPort);
indexerServer.addHandler("indexer", indexer);
searcher = new CompositeSearcher();
XmlrpcServer searcherServer = new XmlrpcServer(searcherPort);
searcherServer.addHandler("searcher", searcher);
indexerServer.start();
logger.info("Indexer started on port " +Integer.toString(indexerPort));
searcherServer.start();
logger.info("Searcher started on port " +Integer.toString(indexerPort));
} catch (Exception e) {
if (indexer != null) {
indexer.requestStop();
}
if (searcher != null) {
((Searcher)searcher.getBaseSearcher()).close();
}
while (!indexer.isStopped()) {
Execute.sleep(10);
}
}
}