Tabnine Logo
RedissonClient.getReadWriteLock
Code IndexAdd Tabnine to your IDE (free)

How to use
getReadWriteLock
method
in
org.redisson.api.RedissonClient

Best Java code snippets using org.redisson.api.RedissonClient.getReadWriteLock (Showing top 6 results out of 315)

origin: hs-web/hsweb-framework

  @Override
  protected ReadWriteLock createReadWriteLock(String lockName) {
    return redisson.getReadWriteLock(lockName);
  }
}
origin: Nepxion/Aquarius

  private RReadWriteLock getCachedReadWriteLock(LockType lockType, String key, boolean fair) {
    String newKey = key + "-" + "fair[" + fair + "]";

    RReadWriteLock readWriteLock = readWriteLockMap.get(newKey);
    if (readWriteLock == null) {
      RedissonClient redisson = redissonHandler.getRedisson();
      RReadWriteLock newReadWriteLock = redisson.getReadWriteLock(key);
      readWriteLock = readWriteLockMap.putIfAbsent(newKey, newReadWriteLock);
      if (readWriteLock == null) {
        readWriteLock = newReadWriteLock;
      }
    }

    return readWriteLock;
  }
}
origin: redisson/redisson-examples

public static void main(String[] args) throws InterruptedException {
  // connects to 127.0.0.1:6379 by default
  RedissonClient redisson = Redisson.create();
  final RReadWriteLock lock = redisson.getReadWriteLock("lock");
  lock.writeLock().tryLock();
  Thread t = new Thread() {
    public void run() {
       RLock r = lock.readLock();
       r.lock();
       try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      r.unlock();
    };
  };
  t.start();
  t.join();
  lock.writeLock().unlock();
  t.join();
  
  redisson.shutdown();
}

origin: dqeasycloud/easy-cloud

/** 根据完整的锁名获取锁 */
private RLock getLock(String lockNameFull, EcLockTypeEnum lockType) {
  if (EcLockTypeEnum.isFair(lockType)) {
    return redisson.getFairLock(lockNameFull);
  } else if (EcLockTypeEnum.isUnfair(lockType)){
    return redisson.getLock(lockNameFull);
  } else if (EcLockTypeEnum.isRead(lockType)) {
    return redisson.getReadWriteLock(lockNameFull).readLock();
  } else if (EcLockTypeEnum.isWrite(lockType)) {
    return redisson.getReadWriteLock(lockNameFull).writeLock();
  }
  throw new EcBaseBusinessException(EcLockErrorCodeEnum.LOCK_TYPE_NOT_SUPPORT);
}

origin: kekingcn/spring-boot-klock-starter

@Override
public boolean acquire() {
  try {
    rLock=redissonClient.getReadWriteLock(lockInfo.getName());
    return rLock.readLock().tryLock(lockInfo.getWaitTime(), lockInfo.getLeaseTime(), TimeUnit.SECONDS);
  } catch (InterruptedException e) {
    return false;
  }
}
origin: kekingcn/spring-boot-klock-starter

@Override
public boolean acquire() {
  try {
    rLock=redissonClient.getReadWriteLock(lockInfo.getName());
    return rLock.writeLock().tryLock(lockInfo.getWaitTime(), lockInfo.getLeaseTime(), TimeUnit.SECONDS);
  } catch (InterruptedException e) {
    return false;
  }
}
org.redisson.apiRedissonClientgetReadWriteLock

Javadoc

Returns readWriteLock instance by name.

Popular methods of RedissonClient

  • shutdown
    Shuts down Redisson instance but NOT Redis server Shutdown ensures that no tasks are submitted for '
  • getMap
    Returns map instance by name using provided codec for both map keys and values.
  • getLock
    Returns lock instance by name. Implements a non-fair locking so doesn't guarantees an acquire order
  • getTopic
    Returns topic instance by name using provided codec for messages.
  • getBucket
    Returns object holder instance by name using provided codec for object.
  • getConfig
    Allows to get configuration provided during Redisson instance creation. Further changes on this obje
  • getMapCache
    Returns map-based cache instance by name using provided codec for both cache keys and values. Suppor
  • getAtomicLong
    Returns atomicLong instance by name.
  • getKeys
    Returns interface with methods for Redis keys. Each of Redis/Redisson object associated with own key
  • getScript
    Returns script operations object using provided codec.
  • getSemaphore
    Returns semaphore instance by name
  • getSet
    Returns set instance by name using provided codec for set objects.
  • getSemaphore,
  • getSet,
  • getBlockingQueue,
  • getList,
  • getScoredSortedSet,
  • getExecutorService,
  • getFairLock,
  • getQueue,
  • getListMultimap

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • Menu (java.awt)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now