Package org.uberfire.commons.lock.impl

Examples of org.uberfire.commons.lock.impl.ThreadLockServiceImpl.lock()


public class ThreadLockServiceTest {

    @Test
    public void testLock() {
        final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
        lockService.lock();
        lockService.unlock();
    }

    @Test
    public void testDoubleLock() {
View Full Code Here


    }

    @Test
    public void testDoubleLock() {
        final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
        lockService.lock();
        lockService.lock();
        lockService.unlock();
        lockService.unlock();
    }
View Full Code Here

    @Test
    public void testDoubleLock() {
        final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
        lockService.lock();
        lockService.lock();
        lockService.unlock();
        lockService.unlock();
    }

    @Test(expected = IllegalMonitorStateException.class)
View Full Code Here

    }

    @Test(expected = IllegalMonitorStateException.class)
    public void testUnlock() {
        final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
        lockService.lock();
        lockService.lock();
        lockService.unlock();
        lockService.unlock();
        lockService.unlock();
    }
View Full Code Here

    @Test(expected = IllegalMonitorStateException.class)
    public void testUnlock() {
        final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
        lockService.lock();
        lockService.lock();
        lockService.unlock();
        lockService.unlock();
        lockService.unlock();
    }
View Full Code Here

    @Test
    public void testOnThreads() throws InterruptedException {
        for ( int i = 0; i < 100; i++ ) {
            final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
            final boolean[] vals = new boolean[]{ false };
            lockService.lock();
            Thread thread = new Thread( new Runnable() {
                @Override
                public void run() {
                    lockService.lock();
                    vals[ 0 ] = true;
View Full Code Here

            final boolean[] vals = new boolean[]{ false };
            lockService.lock();
            Thread thread = new Thread( new Runnable() {
                @Override
                public void run() {
                    lockService.lock();
                    vals[ 0 ] = true;
                }
            } );
            thread.setName( "temp" );
            assertThat( vals[ 0 ] ).isEqualTo( false );
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.