Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicInteger.compareAndSet()


                }
                @Override
                public void handleFailed(ModelNode failureDescription) {
                    synchronized(failureResult) {
                        failureResult.set(failureDescription);
                        status.compareAndSet(0, 2);
                        failureResult.notify();
                    }
                }
                @Override
                public void handleCancellation() {
View Full Code Here


                    }
                }
                @Override
                public void handleCancellation() {
                    synchronized(failureResult) {
                        status.compareAndSet(0, 3);
                        failureResult.notify();
                    }
                }
            };
            final OperationResult result = BasicModelController.this.execute(resolveContext, resolveHandler, modelSource, contextFactory, configurationPersisterProvider, false);
View Full Code Here

                        ++i;
                        int prev;
                        do {
                           prev = record.get();
                           if ((prev & (1 << thread)) != 0) break;
                        } while (record.compareAndSet(prev, prev | (1 << thread)));
                     } catch (PersistenceException e) {
                        // when the store is stopped, exceptions are thrown
                     }
                  }
               } catch (Exception e) {
View Full Code Here

    Object[] metadata = registery.get(txnId);
    if(metadata==null)
      return true;
    AtomicInteger status = ((AtomicInteger)metadata[STATUS_INDEX]);
    Logger.debug("Trying to Kill"+txnId);
    return status.get()==ABORTED || status.compareAndSet(ACTIVE, ABORTED);
  }

  @Override
  protected boolean tryCommit(Long txnId) {
    Logger.debug(txnId + ":TryCommit: start");
View Full Code Here

    if( (val & LOCK) != 0){  //is already locked?
      Logger.debug("Remote Lock Failed: Locked object");
      throw FAILURE_EXCEPTION;
    }
   
    boolean isLocked = lock.compareAndSet(val, val | LOCK);
   
    if( !isLocked){
      Logger.debug("Remote Lock Failed: Concurrent Locked object");
      throw FAILURE_EXCEPTION;
    }   
View Full Code Here

        return true;
      Logger.debug("Locally Locked object");
      throw FAILURE_EXCEPTION;
    }
   
    boolean isLocked = lock.compareAndSet(val, val | LOCK);
   
    if( !isLocked){
      Logger.debug("Being Locked object");
      throw FAILURE_EXCEPTION;
    }   
View Full Code Here

      Logger.debug("Can't unlock remote object");
      return false;
    }
   
    int unlockedValue = val & UNLOCK;
    if(!lock.compareAndSet(val, unlockedValue)){
      Logger.debug("Fail due to concurrent unlock!!");
      return false;
    }
   
    if(contextLocks!=null)
View Full Code Here

    if( (val & LOCK) != 0){  //is already locked?
      Logger.debug("Remote Lock Failed: Locked object");
      throw FAILURE_EXCEPTION;
    }
   
    boolean isLocked = lock.compareAndSet(val, val | LOCK);
   
    if( !isLocked){
      Logger.debug("Remote Lock Failed: Concurrent Locked object");
      throw FAILURE_EXCEPTION;
    }   
View Full Code Here

    if( (val & LOCK) != 0){  //is already locked?
      Logger.debug("Remote Lock Failed: Locked object");
      throw FAILURE_EXCEPTION;
    }
   
    boolean isLocked = lock.compareAndSet(val, val | LOCK);
   
    if( !isLocked){
      Logger.debug("Remote Lock Failed: Concurrent Locked object");
      throw FAILURE_EXCEPTION;
    }   
View Full Code Here

        return true;
      Logger.debug("Locally Locked object");
      throw FAILURE_EXCEPTION;
    }
   
    boolean isLocked = lock.compareAndSet(val, val | LOCK);
   
    if( !isLocked){
      Logger.debug("Being Locked object");
      throw FAILURE_EXCEPTION;
    }   
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.