Codota Logo
ThreadLockServiceImpl.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.kie.commons.io.impl.lock.ThreadLockServiceImpl
constructor

Best Java code snippets using org.kie.commons.io.impl.lock.ThreadLockServiceImpl.<init> (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: org.kie.commons/kie-commons-io

public AbstractIOService() {
  lockService = new ThreadLockServiceImpl();
  ioWatchService = null;
}
origin: org.kie.commons/kie-commons-io

public AbstractIOService( final IOWatchService watchService ) {
  lockService = new ThreadLockServiceImpl();
  ioWatchService = watchService;
}
origin: org.kie.commons/kie-commons-io

@Test
public void testLock() {
  final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
  lockService.lock();
  lockService.unlock();
}
origin: org.kie.commons/kie-commons-io

@Test
public void testDoubleLock() {
  final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
  lockService.lock();
  lockService.lock();
  lockService.unlock();
  lockService.unlock();
}
origin: org.kie.commons/kie-commons-io

  @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;
        }
      } );
      thread.setName( "temp" );
      assertThat( vals[ 0 ] ).isEqualTo( false );
      thread.start();
      assertThat( vals[ 0 ] ).isEqualTo( false );
      lockService.unlock();
      Thread.sleep( 120 );
      assertThat( vals[ 0 ] ).isEqualTo( true );
    }
  }
}
origin: org.kie.commons/kie-commons-io

@Test(expected = IllegalMonitorStateException.class)
public void testUnlock() {
  final ThreadLockServiceImpl lockService = new ThreadLockServiceImpl();
  lockService.lock();
  lockService.lock();
  lockService.unlock();
  lockService.unlock();
  lockService.unlock();
}
org.kie.commons.io.impl.lockThreadLockServiceImpl<init>

Popular methods of ThreadLockServiceImpl

  • lock
  • unlock

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • orElseThrow (Optional)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now