[rfc] netx: do not create unnecessary native directories

Omair Majid omajid at redhat.com
Wed Oct 20 07:06:59 PDT 2010


On 10/18/2010 12:29 PM, Deepak Bhole wrote:
> * Omair Majid<omajid at redhat.com>  [2010-10-08 11:47]:
>> Hi,
>>
>> Netx currently creates one or more directories under /tmp/ to hold
>> native libraries any time it launches an application. The attached
>> patch tries to reduce the clutter caused by these directories. The
>> patch ensures that a directory for holding native files is only
>> created if there are native libraries. The patch also installs a
>> shutdown hook to delete the directory containing the native files.
>>
>> Any thoughts or comments?
>>
>> Cheers,
>> Omair
>
>> diff -r 4698e476b886 ChangeLog
>> --- a/ChangeLog	Fri Oct 08 11:06:14 2010 -0400
>> +++ b/ChangeLog	Fri Oct 08 11:33:49 2010 -0400
>> @@ -1,3 +1,11 @@
>> +2010-10-08  Omair Majid<omajid at redhat.com>
>> +
>> +	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
>> +	(JNLPClassLoader): Call installShutdownHooks.
>> +	(installShutdownHooks): New method. Installs a shutdown hook to
>> +	recursively delete the contents of nativeDir.
>> +	(activateNative): Only create a nativeDir if there are native libraries.
>> +
>>   2010-10-08  Omair Majid<omajid at redhat.com>
>>
>>   	* NEWS: Updated
>> diff -r 4698e476b886 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
>> --- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Fri Oct 08 11:06:14 2010 -0400
>> +++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Fri Oct 08 11:33:49 2010 -0400
>> @@ -59,6 +59,7 @@
>>   import net.sourceforge.jnlp.cache.UpdatePolicy;
>>   import net.sourceforge.jnlp.security.SecurityWarningDialog;
>>   import net.sourceforge.jnlp.tools.JarSigner;
>> +import net.sourceforge.jnlp.util.FileUtils;
>>   import sun.misc.JarIndex;
>>
>>   /**
>> @@ -169,6 +170,41 @@
>>
>>           setSecurity();
>>
>> +        installShutdownHooks();
>> +
>> +    }
>> +
>> +    /**
>> +     * Install JVM shutdown hooks to clean up resources allocated by this
>> +     * ClassLoader.
>> +     */
>> +    private void installShutdownHooks() {
>> +        Runtime.getRuntime().addShutdownHook(new Thread() {
>> +            @Override
>> +            public void run() {
>> +                if (JNLPRuntime.isDebug()) {
>> +                    System.out.println("Cleaing up native directory" + nativeDir.getAbsolutePath());
>> +                }
>> +
>
> Typo there in spelling of cleaning :)
>
> Rest looks fine to me. Assuming you have tested this, OK for commit to
> HEAD and all branches.

Thanks. I have fixed the typo and pushed it to icedtea-web

Cheers,
Omair




More information about the distro-pkg-dev mailing list