Package org.apache.helix.lock

Examples of org.apache.helix.lock.HelixLock.lock()


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


  @Override
  public ResourceConfig updateResource(ResourceId resourceId, ResourceConfig.Delta resourceDelta) {
    ClusterId clusterId = clusterId();
    HelixLock lock = _lockProvider.getLock(clusterId, Scope.resource(resourceId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.updateResource(resourceId, resourceDelta);
      } finally {
        lock.unlock();
View Full Code Here

              t1Locked.wait();
            } catch (InterruptedException e) {
            }
          }
        }
        lock2.lock();
        field1.set(2);
        field2.set(2);
      }
    };
View Full Code Here

              t1Locked.wait();
            } catch (InterruptedException e) {
            }
          }
        }
        lock2.lock();
        field1.set(2);
        field2.set(2);
      }
    };
View Full Code Here

  }

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

  }

  @Override
  public ResourceConfig updateResource(ResourceId resourceId, ResourceConfig.Delta resourceDelta) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.resource(resourceId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _resourceAccessor.updateResource(resourceId, resourceDelta);
      } finally {
        lock.unlock();
View Full Code Here

  }

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

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

  @Override
  public boolean generateDefaultAssignment(ResourceId resourceId, int replicaCount,
      String participantGroupTag) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.cluster(_clusterId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _resourceAccessor.generateDefaultAssignment(resourceId, replicaCount,
            participantGroupTag);
      } finally {
View Full Code Here

  }

  @Override
  public boolean createCluster(ClusterConfig cluster) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.cluster(_clusterId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _clusterAccessor.createCluster(cluster);
      } finally {
        lock.unlock();
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.