Detecting multiple class loaders



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?
.



Relevant Pages

  • Re: Detecting multiple class loaders
    ... The file gets corrupt if more than one process gets at it at once. ... When this class gets used in a webapp, Websphere, like most other app servers, creates a classloader just for that webapp. ...
    (comp.lang.java.programmer)
  • Re: Prevent multiple instances of Excel from starting
    ... I didn't have any confusion as regards multiple Excel instances vs multiple ... Does your app call Excel to reference a particular file (which may or may ... I don't have some malicious intent on making life difficult by randomly ...
    (microsoft.public.excel.programming)
  • Re: I need help with mfc doc/view
    ... WHile SDI can support multiple view types, I always worry about SDI apps. ... This is a horrendous step backward from having a single app in which I ... embedded in a remote controller, and when a view calls a document method such as ...
    (microsoft.public.vc.mfc)
  • Re: MDI in MFC, Conceptually
    ... render the BMP file data in a window and this is typically ... points to the new file data, the new window renders the second image, ... This behavior makes sense if your App contains two ... >> And I can have multiple instances of each type. ...
    (microsoft.public.vc.mfc.docview)
  • MDI in MFC, Conceptually
    ... This is what I understand the way MDI works in the MFC framework: ... wizard builds you a View class, Main and Child frame classes, the App ... have multiple instances of each type. ...
    (microsoft.public.vc.mfc.docview)