Java 8 Lock - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Lock class.

This code example shows how to use the following methods: lock, unlock
    public StaticLockingMavenPublisher(MavenPublisher delegate) {
        this.delegate = delegate;
    } 
 
    public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) {
        STATIC_LOCK.lock();
        try { 
            delegate.publish(publication, artifactRepository);
        } finally { 
            STATIC_LOCK.unlock();
        } 
    } 
} 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: lock, tryLock, unlock
    public SynchronizedToolingImplementationLoader(ToolingImplementationLoader delegate) {
        this.delegate = delegate;
    } 
 
    public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
        if (lock.tryLock()) {
            try { 
                return delegate.create(distribution, progressLoggerFactory, connectionParameters, cancellationToken);
            } finally { 
                lock.unlock();
            } 
        } 
        ProgressLogger logger = progressLoggerFactory.newOperation(SynchronizedToolingImplementationLoader.class);
        logger.setDescription("Wait for the other thread to finish acquiring the distribution");
        logger.started();
        lock.lock();
        try { 
            return delegate.create(distribution, progressLoggerFactory, connectionParameters, cancellationToken);
        } finally { 
            lock.unlock();

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: lock, unlock
public class Synchronizer { 
 
    private final Lock lock = new ReentrantLock();
 
    public <T> T synchronize(Factory<T> factory) {
        lock.lock();
        try { 
            return factory.create();
        } finally { 
            lock.unlock();
        } 
    } 
 
    public void synchronize(Runnable operation) {
        lock.lock();
        try { 
            operation.run();
        } finally { 
            lock.unlock();
        } 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: lock, unlock
          monitorLock(); 
        } 
      } 
   
      private void syncLock() { 
        lock1.lock();
        try { 
          try { 
            barrier.await();
          } catch (Exception e) {
          } 
          goSyncDeadlock(); 
        } finally { 
          lock1.unlock();
        } 
      } 
   
      private void goSyncDeadlock() { 
        try { 
          barrier.await();
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: lock, unlock
        startDaemon(daemon);
        return new DaemonStartupInfo(daemon.getUid(), daemon.getAddress(), null);
    } 
 
    public void startDaemon(Daemon daemon) {
        daemonsLock.lock();
        try { 
            daemons.add(daemon);
        } finally { 
            daemonsLock.unlock();
        } 
 
        daemon.start();
    } 
 
    public void stop() { 
        List<Daemon> daemonsToStop;
 
        daemonsLock.lock();
        try { 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Lock Questions & Answers:

See Code Examples for Java 8 Lock Methods: