PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting PDF generation took longer time in multi threaded environmen Re: Re: PDF generation took longer time in multi threaded environmen

#27325

PD4ML does not reinvent the wheel – it uses the standard Java’s method to load resources:
[language=java:3hnk51i1]URL src = new URL(resource);

URLConnection urlConnect = src.openConnection();

cm.setCookies( urlConnect );
try {
urlConnect.connect();
} catch (Throwable e) {
return new byte[0]; // requested resource is missing
}
cm.storeCookies( urlConnect );

is = urlConnect.getInputStream();

…[/language:3hnk51i1]

So if any delays occur – they are most probably caused by network misconfiguration/problems, like invalid IP routing, wrong DNS responses, firewall restrictions. If network configuration is flawless, in a case of a missing resource the code should break at line #9 in a few milliseconds.

You may always optimize the above code (or for example, implement a correct HTTPS loader for your particular platform) with a custom resource loader. See:
pd4ml-html-css-pdf-tips-tricks-f7/a-definition-of-custom-resource-loaders-t40.html