Can parallelStream be used in Webstart applications?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Can parallelStream be used in Webstart applications?

Stefan Fuchs

a recent change in our webstart application triggered various
PermissionExceptions all over the place.
 From injection failures in guice (tried to use reflection to update a
private member) to loading resources with getResource().
This was odd given that our application is started with all-permissions.
Moreover the application worked fine (using various functions, which
require elevated permissions) until a certain function was triggered.

Bisecting revealed that the problem was triggered by a call to

Reading the fine-print in the class description of |ForkJoinPool, we
found out that the threads created with no Permissions enabled.

"If a |SecurityManager|
is present and no factory is specified, then the default pool uses a
factory supplying threads that have no |Permissions|
enabled. The system class loader is used to load these classes."

So we think what, happens is that certain application classes are loaded
in the context of the restricted thread and are therefor unable to
function properly.

While we could fix the above problem by passing our own ExecutorService
to the appropriate variant of the above method, we wonder what happens,
if the common ForkJoinPool is used by some code, that is not under our
control, say some linked framework or even the jdk itself.

Perhaps we could add the code mentioned here at are very early stage of
our application?

The issue has been raised before in . The bug was however
closed as not an issue.

So is every Webstart application using parallelStream and co. to
implement the above workaround?

Any thoughts?

Stefan Fuchs
Concurrency-interest mailing list
[hidden email]