예제 #1
0
파일: Locking.java 프로젝트: an1310/JGroups
 protected void handleView(View view) {
   this.view = view;
   if (log.isDebugEnabled()) log.debug("view=" + view);
   List<Address> members = view.getMembers();
   for (Map.Entry<String, ServerLock> entry : server_locks.entrySet()) {
     String lock_name = entry.getKey();
     ServerLock server_lock = entry.getValue();
     Lock lock = _getLock(lock_name);
     lock.lock();
     try {
       server_lock.handleView(members);
       if (server_lock.isEmpty()
           && server_lock.current_owner == null
           && server_lock.condition.queue.isEmpty()) server_locks.remove(lock_name);
     } finally {
       lock.unlock();
     }
   }
 }
예제 #2
0
파일: Locking.java 프로젝트: an1310/JGroups
 protected void handleLockRequest(Request req) {
   Lock lock = _getLock(req.lock_name);
   lock.lock();
   try {
     ServerLock server_lock = server_locks.get(req.lock_name);
     if (server_lock == null) {
       server_lock = new ServerLock(req.lock_name);
       ServerLock tmp = server_locks.putIfAbsent(req.lock_name, server_lock);
       if (tmp != null) server_lock = tmp;
       else {
         notifyLockCreated(req.lock_name);
       }
     }
     server_lock.handleRequest(req);
     if (server_lock.isEmpty()
         && server_lock.current_owner == null
         && server_lock.condition.queue.isEmpty()) {
       server_locks.remove(req.lock_name);
     }
   } finally {
     lock.unlock();
   }
 }