Package org.apache.helix.lock

Examples of org.apache.helix.lock.HelixLock


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


  }

  @Override
  public ParticipantConfig updateParticipant(ParticipantId participantId,
      ParticipantConfig.Delta participantDelta) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        return _participantAccessor.updateParticipant(participantId, participantDelta);
      } finally {
        lock.unlock();
      }
    }
    return null;
  }
View Full Code Here

    return null;
  }

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

  }

  @Override
  public void insertMessagesToParticipant(ParticipantId participantId,
      Map<MessageId, Message> msgMap) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        _participantAccessor.insertMessagesToParticipant(participantId, msgMap);
      } finally {
        lock.unlock();
      }
    }
    return;
  }
View Full Code Here

    return;
  }

  @Override
  public void updateMessageStatus(ParticipantId participantId, Map<MessageId, Message> msgMap) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        _participantAccessor.updateMessageStatus(participantId, msgMap);
      } finally {
        lock.unlock();
      }
    }
    return;
  }
View Full Code Here

    return;
  }

  @Override
  public void deleteMessagesFromParticipant(ParticipantId participantId, Set<MessageId> msgIdSet) {
    HelixLock lock = _lockProvider.getLock(_clusterId, Scope.participant(participantId));
    boolean locked = lock.lock();
    if (locked) {
      try {
        _participantAccessor.deleteMessagesFromParticipant(participantId, msgIdSet);
      } finally {
        lock.unlock();
      }
    }
    return;
  }
View Full Code Here

    return;
  }

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

TOP

Related Classes of org.apache.helix.lock.HelixLock

Copyright © 2018 www.massapicom. 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.