Examples of HelixLock


Examples of org.apache.helix.lock.HelixLock

    return false;
  }

  @Override
  public boolean dropCluster() {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.cluster(_clusterId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.dropCluster();
      } finally {
        lock.unlock();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    return false;
  }

  @Override
  public Cluster readCluster() {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.cluster(_clusterId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.readCluster();
      } finally {
        lock.unlock();
      }
    }
    return null;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

  public boolean addParticipantToCluster(ParticipantConfig participant) {
    if (participant == null) {
      LOG.error("Participant config cannot be null");
      return false;
    }
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participant.getId()));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.addParticipantToCluster(participant);
      } finally {
        lock.unlock();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    return false;
  }

  @Override
  public boolean dropParticipantFromCluster(ParticipantId participantId) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.dropParticipantFromCluster(participantId);
      } finally {
        lock.unlock();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

  public boolean addResourceToCluster(ResourceConfig resource) {
    if (resource == null) {
      LOG.error("Resource config cannot be null");
      return false;
    }
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.resource(resource.getId()));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.addResourceToCluster(resource);
      } finally {
        lock.unlock();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    return false;
  }

  @Override
  public boolean dropResourceFromCluster(ResourceId resourceId) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.resource(resourceId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.dropResourceFromCluster(resourceId);
      } finally {
        lock.unlock();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    return false;
  }

  @Override
  public ClusterConfig updateCluster(ClusterConfig.Delta clusterDelta) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.cluster(_clusterId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.updateCluster(clusterDelta);
      } finally {
        lock.unlock();
      }
    }
    return null;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    return participants;
  }

  @Override
  public void initClusterStructure() {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.cluster(_clusterId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        _clusterAccessor.initClusterStructure();
      } finally {
        lock.unlock();
      }
    }
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    _participantAccessor = new ParticipantAccessor(accessor);
  }

  @Override
  boolean enableParticipant(ParticipantId participantId, boolean isEnabled) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _participantAccessor.enableParticipant(participantId);
      } finally {
        lock.unlock();
      }
    }
    return false;
  }
View Full Code Here

Examples of org.apache.helix.lock.HelixLock

    return false;
  }

  @Override
  public Participant readParticipant(ParticipantId participantId) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _participantAccessor.readParticipant(participantId);
      } finally {
        lock.unlock();
      }
    }
    return null;
  }
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.