예제 #1
0
 @Override
 public String toString() {
   return "{"
       + entityGroupInfo.getEntityGroupNameAsString()
       + " state="
       + state
       + ", ts="
       + stamp
       + ", server="
       + serverName
       + "}";
 }
예제 #2
0
  /** A slower (but more easy-to-read) stringification */
  public String toDescriptiveString() {
    long lstamp = stamp.get();
    long relTime = System.currentTimeMillis() - lstamp;

    return entityGroupInfo.getEntityGroupNameAsString()
        + " state="
        + state
        + ", ts="
        + new Date(lstamp)
        + " ("
        + (relTime / 1000)
        + "s ago)"
        + ", server="
        + serverName;
  }
예제 #3
0
 /**
  * Convert a EntityGroupState to an HBaseProtos.EntityGroupState
  *
  * @return the converted HBaseProtos.EntityGroupState
  */
 public ClusterStatusProtos.EntityGroupStateProtos convert() {
   ClusterStatusProtos.EntityGroupStateProtos.Builder entityGroupState =
       ClusterStatusProtos.EntityGroupStateProtos.newBuilder();
   ClusterStatusProtos.EntityGroupStateProtos.State rs;
   switch (entityGroupState.getState()) {
     case OFFLINE:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.OFFLINE;
       break;
     case PENDING_OPEN:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.PENDING_OPEN;
       break;
     case OPENING:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.OPENING;
       break;
     case OPEN:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.OPEN;
       break;
     case PENDING_CLOSE:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.PENDING_CLOSE;
       break;
     case CLOSING:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.CLOSING;
       break;
     case CLOSED:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.CLOSED;
       break;
     case SPLITTING:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.SPLITTING;
       break;
     case SPLIT:
       rs = ClusterStatusProtos.EntityGroupStateProtos.State.SPLIT;
       break;
     default:
       throw new IllegalStateException("");
   }
   entityGroupState.setEntityGroupInfo(EntityGroupInfo.convert(entityGroupInfo));
   entityGroupState.setState(rs);
   entityGroupState.setStamp(getStamp());
   return entityGroupState.build();
 }
예제 #4
0
  /**
   * Convert a protobuf HBaseProtos.EntityGroupState to a EntityGroupState
   *
   * @return the EntityGroupState
   */
  public static EntityGroupState convert(ClusterStatusProtos.EntityGroupStateProtos proto) {
    EntityGroupState.State state;
    switch (proto.getState()) {
      case OFFLINE:
        state = State.OFFLINE;
        break;
      case PENDING_OPEN:
        state = State.PENDING_OPEN;
        break;
      case OPENING:
        state = State.OPENING;
        break;
      case OPEN:
        state = State.OPEN;
        break;
      case PENDING_CLOSE:
        state = State.PENDING_CLOSE;
        break;
      case CLOSING:
        state = State.CLOSING;
        break;
      case CLOSED:
        state = State.CLOSED;
        break;
      case SPLITTING:
        state = State.SPLITTING;
        break;
      case SPLIT:
        state = State.SPLIT;
        break;
      default:
        throw new IllegalStateException("");
    }

    return new EntityGroupState(
        EntityGroupInfo.convert(proto.getEntityGroupInfo()), state, proto.getStamp(), null);
  }