Package org.apache.derbyTesting.functionTests.util

Examples of org.apache.derbyTesting.functionTests.util.Barrier.await()


                        JDBC.assertSingleValueResultSet(
                                select.executeQuery(), "456");

                        // Now we've got the read lock. Wait until all threads
                        // have it before attempting to get the write lock.
                        readLockBarrier.await();

                        // All threads have the read lock. Now all should try
                        // to update the row and thereby create a deadlock.
                        assertUpdateCount(update, 1);
View Full Code Here


        Thread t = new Thread(new Runnable() {
                public void run() {
                    try {
                        // Let the main thread know the helper thread has
                        // started. The race for the locks can start.
                        barrier.await();

                        // This statement will be blocked because T1 holds
                        // an exclusive lock on the row we want.
                        JDBC.assertDrainResults(ps2.executeQuery());
                    } catch (SQLException e) {
View Full Code Here

            });
        t.start();

        // Wait until the helper thread has started. Once the call returns,
        // both threads are ready, and the race for the locks can start.
        barrier.await();

        // This statement will be blocked because T2 holds an exclusive lock
        // on the row we want. So now we have T1 waiting for T2, and T2 waiting
        // for T1, and one of the transactions should be terminated because of
        // the deadlock.
View Full Code Here

                        JDBC.assertSingleValueResultSet(
                                select.executeQuery(), "456");

                        // Now we've got the read lock. Wait until all threads
                        // have it before attempting to get the write lock.
                        readLockBarrier.await();

                        // All threads have the read lock. Now all should try
                        // to update the row and thereby create a deadlock.
                        assertUpdateCount(update, 1);
View Full Code Here

                s.close();

                // Tell the main thread that we've locked the row and that
                // it can go ahead with the index scan. Wait here until the
                // main thread has started the scan.
                barrier.await();

                // The main thread has started the index scan. Give it a
                // second to get to the row we have locked.
                Thread.sleep(1000L);
View Full Code Here

            // Once we have fetched the first row, tell the helper thread we
            // have started the index scan, and wait until it has locked the
            // row that should block the scan (x=40).
            if (i == 0) {
                barrier.await();
            }
        }
        assertFalse(rs.next());
        rs.close();
    }
View Full Code Here

                Statement s = conn.createStatement();
                s.executeUpdate("update t set x = x where x = 40");

                // Tell the main thread we have locked the row, and wait for
                // it to start the index scan.
                barrier.await();

                // Give the index scan time to get to the row we have locked.
                Thread.sleep(1000);

                // The index scan should be blocked now. Split the first leaf
View Full Code Here

            // Once we have fetched the first row, tell the helper thread we
            // have started the index scan, and wait until it has locked the
            // row that should block the scan (x=40).
            if (i == 0) {
                barrier.await();
            }
        }
        assertFalse(rs.next());
        rs.close();
    }
View Full Code Here

        Thread t = new Thread(new Runnable() {
                public void run() {
                    try {
                        // Let the main thread know the helper thread has
                        // started. The race for the locks can start.
                        barrier.await();

                        // This statement will be blocked because T1 holds
                        // an exclusive lock on the row we want.
                        JDBC.assertDrainResults(ps2.executeQuery());
                    } catch (SQLException e) {
View Full Code Here

            });
        t.start();

        // Wait until the helper thread has started. Once the call returns,
        // both threads are ready, and the race for the locks can start.
        barrier.await();

        // This statement will be blocked because T2 holds an exclusive lock
        // on the row we want. So now we have T1 waiting for T2, and T2 waiting
        // for T1, and one of the transactions should be terminated because of
        // the deadlock.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.