JDK-4171986 : Ability to unload native libraries.
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1998-09-08
  • Updated: 1999-08-04
  • Resolved: 1999-08-04
Description

Name: clC74495			Date: 09/08/98


There appears to be no way for classes to unload
native libraries.  They do not even appear to get
unloaded when the class which loads the
library is finalized.

Seeing it is not possible to load a library multiple
times(why throw an exception here?) its then not 
possible to ever use the library again until you
restart the JVM.

Another reason to be able to unload a dll is so
that a new version of the library can be dynamically
updated without restarting the JVM.  (yes we have
a very good reason to want to do this!!).
(Review ID: 36264)
======================================================================

Comments
WORK AROUND Name: clC74495 Date: 09/08/98 1. Rewrite ClassLoader.java in package java.lang 2. ? ======================================================================
11-06-2004

EVALUATION In 1.2, a library is unloaded when the class of that loaded the native library goes away. But it is not clear that unloading native libraries is safe -- what if the native library registered a function in its address space with atexit()? anand.palaniswamy@Eng 1998-09-15 In a multi-thread system, there is no safe way to explicit unload the library. Unloading library at class gc is the only possible solution. If people need such feature, they can write a launcher library, and use it to load/unload real one. The vm will use class load and class gc to load and unload the launcher library. ###@###.### 1999-08-04
04-08-1999