Subject: RE: Yet another “already loaded in another classloader” problem
It was a little late yesterday :(, but anyway, the problems I am having is not with calling the native function, it is somehing I have no control over.
Before I get to call my functions, the DLL gets loaded:
public class TimeZone {
static {
System.loadLibrary( "TimeZoneLib" );
}
…
This is where the JVM throws an exception. So, the JVM should detect that DLL is already loaded and not load it again. Or, if one could catch that exception [UnsatisfiedLinkError] and ignore it [because it simply means that the DLL is already loaded], everything would be alright. But that Exception, or rather error can not be caught, it is simply reported before the program exits.
I have tried to load the DLL as needed, but I have found no way to detect, that a DLL is already loaded. All you can do is try to load it again, because loading it statically should only load it once anyway.
Now, as I have stated, I don’t know that much about JVM, so maybe my understanding is flawed, but searching the Internet indicates, that it is a known bug in the JVM, and that it cannot be fixed.
But, even if it cannot be fixed, I still want to understand why two of my agents behave so differently.
One of them crashes only if two versions of it run concurrently [two users open tha same page at the same time], or one briefly after another.
The second agent works only once every few minutes, and crashes predictivly in between, like something is not releasing the loaded library, even though the agent has stopped running long ago.
Both are using the same DLL, and the same library, so the DLL loading part is the same for both of them-
And I want to know what that is, and how to fix it. Maybe it is a the size of the agents? The first one larger, and maybe the server unloads it ASAP, so that it will not waste its resources.
The other one is short and simple, so maybe it doesn’t get unloaded for a while.
But, if that is the case, how do I fix it, besides trying to eat up large ammounts of memory :((((((
Cheers, Miha Vitorovic