[icedtea-web] not closeable javaws (and maybe more)
Jiri Vanek
jvanek at redhat.com
Wed Feb 18 17:45:54 UTC 2015
On 02/18/2015 03:23 PM, Jie Kang wrote:
>
>
> ----- Original Message -----
>> On 02/17/2015 11:57 AM, Jiri Vanek wrote:
>>> On 02/17/2015 11:00 AM, Jiri Vanek wrote:
>>>> Hi!
>>>>
>>>> Head, for already some time javaws apps needs to be closed by signal kill.
>>>> For long time I thought this is soem accident or whatever, but it is not.
>>>> Today I tracked it to guilty changeset of
>>>> http://icedtea.classpath.org/hg/icedtea-web/rev/6f4c1d501560
>>>>
>>>> Looking for the fix now, but in case I fail, this will spare some time to
>>>> the followr,
>>>>
>>>> J.
>>>
>>> Ok, so the caus eis clear, ServiceExecutor do not run as daemon, and so is
>>> preventing jvm to stop.
>>>
>>> I'm wondering Why I dont see this issue from plugin side...
>>>
>>> Anyway - for javaws - both ok and failed run - where to place call to
>>>
>>> diff -r a8baec8d9d21 netx/net/sourceforge/jnlp/cache/ResourceTracker.java
>>> --- a/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Fri Feb 13
>>> 12:48:24 2015 +0100
>>> +++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java Tue Feb 17
>>> 11:57:01 2015 +0100
>>> @@ -34,6 +34,7 @@
>>> import java.util.List;
>>> import java.util.concurrent.ExecutorService;
>>> import java.util.concurrent.Executors;
>>> +import java.util.concurrent.TimeUnit;
>>>
>>> import net.sourceforge.jnlp.DownloadOptions;
>>> import net.sourceforge.jnlp.Version;
>>> @@ -633,4 +634,15 @@
>>> interface Filter<T> {
>>> public boolean test(T t);
>>> }
>>> +
>>> + public static void shutdDownThreadPool() throws InterruptedException{
>>> + threadPool.shutdown();
>>> + if (!threadPool.awaitTermination(5, TimeUnit.SECONDS)) {
>>> + OutputController.getLogger().log("Executor did not terminate
>>> in the specified time.");
>>> + List<Runnable> droppedTasks = threadPool.shutdownNow();
>>> + OutputController.getLogger().log("Executor was abruptly shut
>>> down. " + droppedTasks.size() + " tasks will not be executed.");
>>> + }
>>> + }
>>> +
>>> +
>>> }
>>>
>>>
>>> ?
>>
>> One more thought, attached patch fixed the issue for me:
>>
>> It does only thing - it changes threads used by ExecutorService to daemons.
>>
>> Well, I dont know whot Iahve done - I dont know if ExecutorService is still
>> keeping its purpose when its threads are daemons.
>>
>> On contrary, documentation is silent, and usage of custom ThreadFactory is
>> supported....
>> As negativism, original code (before patch 6f4c1d501560) was not using
>> daemons. But was not recycling threads...
>>
>>
>> Thoughts?
>
> Hello,
>
> I strongly prefer a solution that uses threadPool.shutdown() since it is the proper way to stop the service and generally much more predictable/safer solution.
I'm the opposite. I consider this as much safer ad more predictable approach...
>
> How about using a ResourceTracker Factory to create ResourceTrackers and keep a list of them there. Then you can call the shutdown on all the ResourceTrackers when IT-W exits.
Again - when/where is that point where to call this "shutdown" ? Such a point do not exists in
plugin, and is achiavable by many paths from javaws....
Also - the service is static, so no need to track it...
J:(
More information about the distro-pkg-dev
mailing list