Detecting multiple class loaders
- From: Chris <spam_me_not@xxxxxxxxxx>
- Date: Wed, 19 Mar 2008 10:39:04 -0500
Is there any way to detect when a class has been loaded by two different class loaders?
Our app has a class that reads and writes a file on disk. The file gets corrupt if more than one process gets at it at once. We can detect multiple processes by locking the file on disk and throwing an error; no problem. We can control access by multiple threads using synchronization. So far, so good.
The problem is Websphere. When this class gets used in a webapp, Websphere, like most other app servers, creates a classloader just for that webapp. But it does more than that; it creates multiple classloaders and they all load the class independently. And we get corruption.
Other than fix Websphere (and we're working on it), is there another way, in general, we can use to ensure that only one classloader within a JVM loads a given class?
.
- Follow-Ups:
- Re: Detecting multiple class loaders
- From: Arne Vajhøj
- Re: Detecting multiple class loaders
- From: Silvio Bierman
- Re: Detecting multiple class loaders
- From: Mark Space
- Re: Detecting multiple class loaders
- From: Matt Humphrey
- Re: Detecting multiple class loaders
- Prev by Date: Re: Sell - IDE IntelliJidea 7.0 personal license
- Next by Date: Shell out without so many threads?
- Previous by thread: all languages
- Next by thread: Re: Detecting multiple class loaders
- Index(es):
Relevant Pages
|