当前位置: 首页>>代码示例>>Java>>正文


Java ActiveRepairService.Status方法代码示例

本文整理汇总了Java中org.apache.cassandra.service.ActiveRepairService.Status方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveRepairService.Status方法的具体用法?Java ActiveRepairService.Status怎么用?Java ActiveRepairService.Status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.service.ActiveRepairService的用法示例。


在下文中一共展示了ActiveRepairService.Status方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processOldApiNotification

import org.apache.cassandra.service.ActiveRepairService; //导入方法依赖的package包/类
/**
 * Handles notifications from the old repair API (forceRepairAsync)
 */
private void processOldApiNotification(Notification notification) {
  try {
    int[] data = (int[]) notification.getUserData();
    // get the repair sequence number
    int repairNo = data[0];
    // get the repair status
    ActiveRepairService.Status status = ActiveRepairService.Status.values()[data[1]];
    // this is some text message like "Starting repair...", "Finished repair...", etc.
    String message = notification.getMessage();
    // let the handler process the even
    repairStatusHandler.get().handle(repairNo, Optional.of(status), Optional.absent(), message);
  } catch (RuntimeException e) {
    LOG.error("Error while processing JMX notification", e);
  }
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:19,代码来源:JmxProxyImpl.java

示例2: handle

import org.apache.cassandra.service.ActiveRepairService; //导入方法依赖的package包/类
/**
 * Called when there is an event coming either from JMX or this runner regarding on-going repairs.
 *
 * @param repairNumber repair sequence number, obtained when triggering a repair
 * @param status new status of the repair
 * @param message additional information about the repair
 */
@Override
public void handle(
    int repairNumber,
    Optional<ActiveRepairService.Status> status,
    Optional<ProgressEventType> progress,
    String message) {

  final RepairSegment segment = context.storage.getRepairSegment(repairRunner.getRepairRunId(), segmentId).get();
  Thread.currentThread().setName(clusterName + ":" + segment.getRunId() + ":" + segmentId);
  LOG.debug(
      "handle called for repairCommandId {}, outcome {} / {} and message: {}",
      repairNumber,
      status,
      progress,
      message);
  if (repairNumber != commandId) {
    LOG.debug("Handler for command id {} not handling message with number {}", commandId, repairNumber);
    return;
  }

  boolean failOutsideSynchronizedBlock = false;
  // DO NOT ADD EXTERNAL CALLS INSIDE THIS SYNCHRONIZED BLOCK (JMX PROXY ETC)
  synchronized (condition) {
    RepairSegment currentSegment = context.storage.getRepairSegment(repairRunner.getRepairRunId(), segmentId).get();
    // See status explanations at: https://wiki.apache.org/cassandra/RepairAsyncAPI
    // Old repair API – up to Cassandra-2.1.x
    if (status.isPresent()) {
      failOutsideSynchronizedBlock = handleJmxNotificationForCassandra21(
          status,
          currentSegment,
          repairNumber,
          failOutsideSynchronizedBlock,
          progress);
    }
    // New repair API – Cassandra-2.2 onwards
    if (progress.isPresent()) {
      failOutsideSynchronizedBlock = handleJmxNotificationForCassandra22(
          progress,
          currentSegment,
          repairNumber,
          failOutsideSynchronizedBlock);
    }
  }

  if (failOutsideSynchronizedBlock) {
    if (takeLead() || renewLead()) {
      try {
        postponeCurrentSegment();
        tryClearSnapshots(message);
      } finally {
        // if someone else does hold the lease, ie renewLead(..) was true,
        // then their writes to repair_run table and any call to releaseLead(..) will throw an exception
        try {
          releaseLead();
        } catch (AssertionError ignore) { }
      }
    }
  }
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:67,代码来源:SegmentRunner.java

示例3: handleNotification

import org.apache.cassandra.service.ActiveRepairService; //导入方法依赖的package包/类
@Override
public void handleNotification(final Notification notification, final Object handback) {
    if (!"repair".equals(notification.getType())) {
        return;
    }

    final int[] result = (int[]) notification.getUserData();
    final int repairCommandNo = result[0];
    final ActiveRepairService.Status status = ActiveRepairService.Status.values()[result[1]];

    final String keyspace = commandToKeyspace.get(repairCommandNo);

    switch (status) {
        case STARTED:
            LOGGER.info("Received STARTED notification about repair for keyspace {} with cmd#{}, timetamp={}, message={}",
                    keyspace, repairCommandNo, notification.getTimeStamp(), notification.getMessage());
            keyspaceStarted();
            break;
        case SESSION_SUCCESS:
            LOGGER.debug("Received SESSION_SUCCESS notification about repair for keyspace {} with cmd#{}, timetamp={}, message={}",
                    keyspace, repairCommandNo, notification.getTimeStamp(), notification.getMessage());
            break;
        case SESSION_FAILED:
            LOGGER.warn("Received SESSION_FAILED notification about repair for keyspace {} with cmd#{}, timetamp={}, message={}",
                    keyspace, repairCommandNo, notification.getTimeStamp(), notification.getMessage());
            break;
        case FINISHED:
            LOGGER.info("Received FINISHED notification about repair for keyspace {} with cmd#{}, timetamp={}, message={}",
                    keyspace, repairCommandNo, notification.getTimeStamp(), notification.getMessage());

            keyspaceFinished(status.name(), keyspace);

            startNextKeyspace();

            break;
    }

    // TODO also allow StorageServiceMBean.forceTerminateAllRepairSessions

    /*
    TODO handle these, too !!!

    else if (JMXConnectionNotification.NOTIFS_LOST.equals(notification.getType()))
    {
        String message = String.format("[%s] Lost notification. You should check server log for repair status of keyspace %s",
                                       format.format(notification.getTimeStamp()),
                                       keyspace);
        out.println(message);
    }
    else if (JMXConnectionNotification.FAILED.equals(notification.getType())
             || JMXConnectionNotification.CLOSED.equals(notification.getType()))
    {
        String message = String.format("JMX connection closed. You should check server log for repair status of keyspace %s"
                                       + "(Subsequent keyspaces are not going to be repaired).",
                                       keyspace);
        error = new IOException(message);
        condition.signalAll();
    }

     */
}
 
开发者ID:mesosphere,项目名称:cassandra-mesos-deprecated,代码行数:62,代码来源:NodeRepairJob.java

示例4: emitRepairNotification

import org.apache.cassandra.service.ActiveRepairService; //导入方法依赖的package包/类
public void emitRepairNotification(final ActiveRepairService.Status status) {
    final Notification notification = new Notification("repair", this, ++sequence, System.currentTimeMillis(), "hello world");
    notification.setUserData(new int[]{commandSeq, status.ordinal()});
    emitNotification(notification);
}
 
开发者ID:mesosphere,项目名称:cassandra-mesos-deprecated,代码行数:6,代码来源:TestObjectFactory.java

示例5: handle

import org.apache.cassandra.service.ActiveRepairService; //导入方法依赖的package包/类
/**
 * Handle an event representing a change in the state of a running repair.
 *
 * <p>
 * Implementation of this method is intended to persist the repair state change in Reaper's state.
 *
 * @param repairNumber repair sequence number, obtained when triggering a repair
 * @param status new status of the repair (old API)
 * @param progress new status of the repair (new API)
 * @param message additional information about the repair
 */
void handle(
    int repairNumber,
    Optional<ActiveRepairService.Status> status,
    Optional<ProgressEventType> progress,
    String message);
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:17,代码来源:RepairStatusHandler.java


注:本文中的org.apache.cassandra.service.ActiveRepairService.Status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。