Java Code Examples for org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction#SAFEMODE_GET

The following examples show how to use org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction#SAFEMODE_GET . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NameNodeRpcServer.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override // ClientProtocol
public boolean setSafeMode(SafeModeAction action, boolean isChecked)
    throws IOException {
  checkNNStartup();
  OperationCategory opCategory = OperationCategory.UNCHECKED;
  if (isChecked) {
    if (action == SafeModeAction.SAFEMODE_GET) {
      opCategory = OperationCategory.READ;
    } else {
      opCategory = OperationCategory.WRITE;
    }
  }
  namesystem.checkOperation(opCategory);
  return namesystem.setSafeMode(action);
}
 
Example 2
Source File: PBHelper.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static SafeModeAction convert(
    ClientNamenodeProtocolProtos.SafeModeActionProto a) {
  switch (a) {
  case SAFEMODE_LEAVE:
    return SafeModeAction.SAFEMODE_LEAVE;
  case SAFEMODE_ENTER:
    return SafeModeAction.SAFEMODE_ENTER;
  case SAFEMODE_GET:
    return SafeModeAction.SAFEMODE_GET;
  default:
    throw new IllegalArgumentException("Unexpected SafeModeAction :" + a);
  }
}
 
Example 3
Source File: NameNodeRpcServer.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override // ClientProtocol
public boolean setSafeMode(SafeModeAction action, boolean isChecked)
    throws IOException {
  checkNNStartup();
  OperationCategory opCategory = OperationCategory.UNCHECKED;
  if (isChecked) {
    if (action == SafeModeAction.SAFEMODE_GET) {
      opCategory = OperationCategory.READ;
    } else {
      opCategory = OperationCategory.WRITE;
    }
  }
  namesystem.checkOperation(opCategory);
  return namesystem.setSafeMode(action);
}
 
Example 4
Source File: PBHelper.java    From big-c with Apache License 2.0 5 votes vote down vote up
public static SafeModeAction convert(
    ClientNamenodeProtocolProtos.SafeModeActionProto a) {
  switch (a) {
  case SAFEMODE_LEAVE:
    return SafeModeAction.SAFEMODE_LEAVE;
  case SAFEMODE_ENTER:
    return SafeModeAction.SAFEMODE_ENTER;
  case SAFEMODE_GET:
    return SafeModeAction.SAFEMODE_GET;
  default:
    throw new IllegalArgumentException("Unexpected SafeModeAction :" + a);
  }
}