com.ptc.windchill.counterpart
Class cUploadLock

java.lang.Object
  extended bycom.ptc.windchill.counterpart.cUploadLock

final class cUploadLock
extends Object

Responsible for synchronization between threads and processes. Oracle locking is used behind the scene. As a workaround we engage the Oracle lock in another thread. Certain processing queue APIs don't like to be called within a transaction. They deadlock and fail. Different thread will ensure that a different connection to Oracle is used, not interfeering with the queue operation.


Field Summary
private  boolean fEngaged
           
private  boolean fError
           
private static cUploadLock fLock
           
private static Persistable fPersistentLock
           
private  boolean fReleased
           
private static Object fSyncObject
           
private  boolean fTried
           
 
Constructor Summary
cUploadLock(boolean wait)
          Takes out an exclusive lock either waiting for it or only if the lock is available
 
Method Summary
private static Persistable getPersistentLock()
           
private static Persistable getPersistentLockFromOracle()
           
private static void lockOracle()
           
 void release()
          Releases the lock.
private static void runLoop()
          Background thread loops infinitely and processes one lock request at a time
private static void waitOnSyncObject()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fSyncObject

private static final Object fSyncObject

fLock

private static volatile cUploadLock fLock

fPersistentLock

private static Persistable fPersistentLock

fReleased

private volatile boolean fReleased

fEngaged

private volatile boolean fEngaged

fTried

private volatile boolean fTried

fError

private volatile boolean fError
Constructor Detail

cUploadLock

public cUploadLock(boolean wait)
            throws CounterPartUploadBusyException
Takes out an exclusive lock either waiting for it or only if the lock is available

Method Detail

runLoop

private static void runLoop()
Background thread loops infinitely and processes one lock request at a time


lockOracle

private static void lockOracle()
                        throws WTException
Throws:
WTException

getPersistentLock

private static Persistable getPersistentLock()
                                      throws WTException
Throws:
WTException

getPersistentLockFromOracle

private static Persistable getPersistentLockFromOracle()
                                                throws WTException
Throws:
WTException

waitOnSyncObject

private static void waitOnSyncObject()

release

public void release()
Releases the lock. Other threads can now proceed.