Package org.apache.ojb.otm.lock.wait

Examples of org.apache.ojb.otm.lock.wait.TimeoutStrategy


    protected SimpleKit()
    {
        super();
        _txFactory = new LocalTransactionFactory();
        _swizzlingStrategy = new CopySwizzling();
        _lockWaitStrategy = new TimeoutStrategy();
        _lockMap = new InMemoryLockMap();
        _noOpCopyStrategy = new NoOpObjectCopyStrategy();
        //_defaultCopyStrategy = new ReflectiveObjectCopyStrategy();
        //_defaultCopyStrategy = new SerializeObjectCopyStrategy();
        _defaultCopyStrategy = new MetadataObjectCopyStrategy();
View Full Code Here


            _conn2 = null;
        }
        catch (Throwable t)
        {
        }
        _kit.setLockWaitStrategy(new TimeoutStrategy());
    }
View Full Code Here

            _conn.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);

            // test different LockWaitStrategies
            _kit.setLockWaitStrategy(new NoWaitStrategy());
            failIfLockForWrite(conn2, pgOid);
            _kit.setLockWaitStrategy(new TimeoutStrategy(1));
            failIfLockForWrite(conn2, pgOid);

            // Second test for the TimeoutStrategy:
            // let the second tx to lock
            _kit.setLockWaitStrategy(new TimeoutStrategy(2000));
            tx2 = _kit.getTransaction(conn2);
            tx2.begin();
            (new Thread()
            {
                public void run()
                {
                    try
                    {
                        Thread.sleep(1000);
                        tx3.commit();
                    }
                    catch (InterruptedException ex)
                    {
                    }
                }
            }).start();
            conn2.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);
            tx2.commit();

            // Third test for the TimeoutStrategy:
            // test deadlock detection
            _kit.setLockWaitStrategy(new TimeoutStrategy(4000));
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);
            tx2 = _kit.getTransaction(conn2);
            tx2.begin();
View Full Code Here

    protected SimpleKit()
    {
        super();
        _txFactory = new LocalTransactionFactory();
        _swizzlingStrategy = new CopySwizzling();
        _lockWaitStrategy = new TimeoutStrategy();
        _lockMap = new InMemoryLockMap();
        _noOpCopyStrategy = new NoOpObjectCopyStrategy();
        //_defaultCopyStrategy = new ReflectiveObjectCopyStrategy();
        //_defaultCopyStrategy = new SerializeObjectCopyStrategy();
        _defaultCopyStrategy = new MetadataObjectCopyStrategy();
View Full Code Here

            _conn2 = null;
        }
        catch (Throwable t)
        {
        }
        _kit.setLockWaitStrategy(new TimeoutStrategy());
    }
View Full Code Here

            _conn.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);

            // test different LockWaitStrategies
            _kit.setLockWaitStrategy(new NoWaitStrategy());
            failIfLockForWrite(conn2, pgOid);
            _kit.setLockWaitStrategy(new TimeoutStrategy(1));
            failIfLockForWrite(conn2, pgOid);

            // Second test for the TimeoutStrategy:
            // let the second tx to lock
            _kit.setLockWaitStrategy(new TimeoutStrategy(2000));
            tx2 = _kit.getTransaction(conn2);
            tx2.begin();
            (new Thread()
            {
                public void run()
                {
                    try
                    {
                        Thread.sleep(1000);
                        tx3.commit();
                    }
                    catch (InterruptedException ex)
                    {
                    }
                }
            }).start();
            conn2.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);
            tx2.commit();

            // Third test for the TimeoutStrategy:
            // test deadlock detection
            _kit.setLockWaitStrategy(new TimeoutStrategy(4000));
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);
            tx2 = _kit.getTransaction(conn2);
            tx2.begin();
View Full Code Here

TOP

Related Classes of org.apache.ojb.otm.lock.wait.TimeoutStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.