this.getLogger().debug("Load " + uri + " for session " + session);
}
// first make the URI absolute
if ( uri.indexOf("://") == -1) {
final Source source = session.resolveURI(uri, this.resolver);
uri = source.getURI();
}
// if we are not processing in parallel (or do preemptive)
// then we don't have to do anything in this method - everything
// is done in the stream method.
// if we are processing in parallel (and not preemptive) then....
if ( session.isParallel() && !session.isPreemptive()) {
// first look-up if we have a valid stored response
IncludeCacheStorageProxy storage = session.getCacheStorageProxy();
CachedResponse response = (CachedResponse)storage.get(uri);
if ( null != response) {
SourceValidity[] validities = response.getValidityObjects();
// if we are valid and do not purging
if ( !session.isPurging()
&& validities[0].isValid() == SourceValidity.VALID) {
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("Using cached response for parallel processing.");
}
session.add(uri, response.getResponse());
return uri;
} else {
// response is not used
storage.remove(uri);
}
}
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("Starting parallel thread for loading " + uri);
}
// now we start a parallel thread, this thread gets all required avalon components
// so it does not have to lookup them by itself
try {
XMLSerializer serializer = (XMLSerializer)this.manager.lookup(XMLSerializer.ROLE);
Source source = session.resolveURI(uri, this.resolver);
LoaderThread loader = new LoaderThread(source, serializer, this.manager);
Thread thread = new Thread(loader);
session.add(uri, loader);
thread.start();