Package org.apache.commons.transaction.util

Examples of org.apache.commons.transaction.util.RendezvousBarrier.call()


                txMap1.startTransaction();
                try {
                    beforeCommitBarrier.meet();
                    txMap1.put("key1", "value2");
                    txMap1.commitTransaction();
                    afterCommitBarrier.call();
                } catch (InterruptedException e) {
                    logger.log(Level.WARNING, "Thread interrupted", e);
                    afterCommitBarrier.reset();
                    beforeCommitBarrier.reset();
                }
View Full Code Here


        new Thread(new Runnable() {
            public void run() {
                txMap1.resumeTransaction(ctx);
                txMap1.put("key2", "value2");
                txMap1.suspendTransaction();
                afterSuspendBarrier.call();
            }
        }).start();

        afterSuspendBarrier.meet();
        txMap1.resumeTransaction(ctx);
View Full Code Here

                txMap1.startTransaction();
                try {
                    beforeCommitBarrier.meet();
                    txMap1.put("key1", "value2");
                    txMap1.commitTransaction();
                    afterCommitBarrier.call();
                } catch (InterruptedException e) {
                    logger.log(Level.WARNING, "Thread interrupted", e);
                    afterCommitBarrier.reset();
                    beforeCommitBarrier.reset();
                }
View Full Code Here

        txMap1.startTransaction();
        try {
          beforeCommitBarrier.meet();
          txMap1.put("key1", "value2");
          txMap1.commitTransaction();
          afterCommitBarrier.call();
        } catch (InterruptedException e) {
          logger.log(Level.WARNING, "Thread interrupted", e);
          afterCommitBarrier.reset();
          beforeCommitBarrier.reset();
        }
View Full Code Here

                        manager.writeLock(owner1, res3);
                    } catch (LockException ie) {
                        System.out.print("-");
                    } finally {
                        manager.releaseAll(owner1);
                        end.call();
                    }
                }
            }, "Thread #1");

            Thread t2 = new Thread(new Runnable() {
View Full Code Here

                        manager.writeLock(owner2, res3);
                    } catch (LockException ie) {
                        System.out.print("-");
                    } finally {
                        manager.releaseAll(owner2);
                        end.call();
                    }
                }
            }, "Thread #2");

            Thread t3 = new Thread(new Runnable() {
View Full Code Here

                        } else {
                            System.out.print("-");
                        }
                    } finally {
                        manager.releaseAll(owner3);
                        end.call();
                    }
                }
            }, "Thread #3");

            Thread t4 = new Thread(new Runnable() {
View Full Code Here

                        manager.writeLock(owner4, res3);
                    } catch (LockException le) {
                        System.out.print("-");
                    } finally {
                        manager.releaseAll(owner4);
                        end.call();
                    }
                }
            }, "Thread #4");

                Thread deadlock1 = new Thread(new Runnable() {
View Full Code Here

                    } catch (LockException le) {
                        assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM);
                        System.out.print("-");
                    } finally {
                        manager.releaseAll(owner5);
                        end.call();
                    }
                }
            }, "Deadlock1 Thread");

            Thread deadlock2 = new Thread(new Runnable() {
View Full Code Here

                    } catch (LockException le) {
                        assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM);
                        System.out.print("-");
                    } finally {
                        manager.releaseAll(owner6);
                        end.call();
                    }
                }
            }, "Deadlock1 Thread");

            Thread reader = new Thread(new Runnable() {
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.