ERXGlobalLock Class Reference

Inherits com::webobjects::foundation::NSLocking.

Collaboration diagram for ERXGlobalLock:

Collaboration graph
[legend]

List of all members.

Public Member Functions

boolean cleanup ()
 ERXGlobalLock (String name)
void lock ()
void unlock ()

Static Public Member Functions

static NSLocking lockForName (String name)

Private Attributes

int _lockcnt
File _lockfile
Thread _owner


Detailed Description

Simple lock to sync access for multiple instances on one machine. This implementation uses a lock file with the given name in the temp directory. In case of a VM crash, the file is *not* deleted, so you have to do this yourself.
Additionally, you can't use it reliably on an NFS server. The lock otherwise behaves like an NSRecursiveLock in that the same thread can re-lock as often as he wants.
 App1:
 NSLocking lock = ERXGlobalLock.lockForName("test");
 lock.lock();
 ...
 lock.unlock();
 App2:
 NSLocking lock = ERXGlobalLock.lockForName("test");
 lock.lock();
 ...
 lock.unlock();
 
Author:
ak

Constructor & Destructor Documentation

ERXGlobalLock ( String  name  ) 


Member Function Documentation

boolean cleanup (  ) 

Call this on startup.

void lock (  ) 

static NSLocking lockForName ( String  name  )  [static]

void unlock (  ) 


Member Data Documentation

int _lockcnt [private]

File _lockfile [private]

Thread _owner [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:10 2012 for Project Wonder by  doxygen 1.5.8