Methods Summary |
---|
public void | configure(org.apache.avalon.framework.configuration.Configuration configuration)
int threadCount = configuration.getChild("threadCount").getValueAsInteger(1);
threadIdleTime = configuration.getChild("threadIdleTime").getValueAsInteger(60 * 1000);
spoolPathString = configuration.getChild("spoolPath").getValue();
worker = new SpoolerRunnable[threadCount];
|
public void | contextualize(org.apache.avalon.framework.context.Context context)
this.context = context;
|
java.io.File | getSpoolPath()Returns (and creates, if the directory doesn't already exist) the
spool directory
return spoolPath;
|
public void | initialize()
//System.out.println(getClass().getName()+": init");
try {
spoolPath = AvalonContextUtilities.getFile(context, spoolPathString);
if ( spoolPath.exists() == false ) {
spoolPath.mkdirs();
} else if (!(spoolPath.isDirectory())) {
StringBuffer errorBuffer =
new StringBuffer(128)
.append("Spool directory is improperly configured. The specified path ")
.append(spoolPathString)
.append(" is not a directory.");
throw new ConfigurationException(errorBuffer.toString());
}
} catch (Exception e) {
getLogger().fatalError(e.getMessage(), e);
throw e;
}
for ( int i = 0 ; i < worker.length ; i++ ) {
worker[i] = new SpoolerRunnable(threadIdleTime,spoolPath);
if ( worker[i] instanceof LogEnabled ) {
((LogEnabled)worker[i]).enableLogging(getLogger());
}
}
// TODO: Replace this with a standard Avalon thread pool
for ( int i = 0 ; i < worker.length ; i++ ) {
new Thread(worker[i],"NNTPSpool-"+i).start();
}
|
void | setArticleIDRepository(ArticleIDRepository articleIDRepo)Sets the article id repository used by this spooler.
for ( int i = 0 ; i < worker.length ; i++ ) {
worker[i].setArticleIDRepository(articleIDRepo);
}
|
void | setRepository(NNTPRepository repo)Sets the repository used by this spooler.
for ( int i = 0 ; i < worker.length ; i++ ) {
worker[i].setRepository(repo);
}
|