org.apache.hadoop.ipc.Server.getRemoteAddress()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中org.apache.hadoop.ipc.Server.getRemoteAddress()方法的一些代码示例,展示了Server.getRemoteAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getRemoteAddress()方法的具体详情如下:
包路径:org.apache.hadoop.ipc.Server
类名称:Server
方法名:getRemoteAddress

Server.getRemoteAddress介绍

[英]Returns remote address as a string when invoked inside an RPC. Returns null in case of an error.
[中]在RPC内部调用时,以字符串形式返回远程地址。出现错误时返回null。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

" at " + Server.getRemoteAddress() + " to cede active role.");
boolean needFence = false;
try {

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

private static String getClientMachine() {
 String clientMachine = Server.getRemoteAddress();
 if (clientMachine == null) { //not a RPC client
  clientMachine = "";
 }
 return clientMachine;
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

@Override
protected void checkRpcAdminAccess() throws IOException, AccessControlException {
 UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
 UserGroupInformation zkfcUgi = UserGroupInformation.getLoginUser();
 if (adminAcl.isUserAllowed(ugi) ||
   ugi.getShortUserName().equals(zkfcUgi.getShortUserName())) {
  LOG.info("Allowed RPC access from " + ugi + " at " + Server.getRemoteAddress());
  return;
 }
 String msg = "Disallowed RPC access from " + ugi + " at " +
   Server.getRemoteAddress() + ". Not listed in " + DFSConfigKeys.DFS_ADMIN; 
 LOG.warn(msg);
 throw new AccessControlException(msg);
}

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

if (autoHaEnabled) {
 LOG.warn("Allowing manual HA control from " +
   Server.getRemoteAddress() +
   " even though automatic HA is enabled, because the user " +
   "specified the force flag");
 throw new AccessControlException(
   "Request from ZK failover controller at " +
   Server.getRemoteAddress() + " denied since automatic HA " +
   "is not enabled");

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs

CheckpointSignature rollEditLog() throws IOException {
 String operationName = "rollEditLog";
 CheckpointSignature result = null;
 checkSuperuserPrivilege(operationName);
 checkOperation(OperationCategory.JOURNAL);
 writeLock();
 try {
  checkOperation(OperationCategory.JOURNAL);
  checkNameNodeSafeMode("Log not rolled");
  if (Server.isRpcInvocation()) {
   LOG.info("Roll Edit Log from " + Server.getRemoteAddress());
  }
  result = getFSImage().rollEditLog(getEffectiveLayoutVersion());
 } finally {
  writeUnlock(operationName);
 }
 logAuditEvent(true, operationName, null);
 return result;
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

private static String getClientMachine() {
 String clientMachine = Server.getRemoteAddress();
 if (clientMachine == null) {
  clientMachine = "";
 }
 return clientMachine;
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

private static String getClientMachine() {
 String clientMachine = Server.getRemoteAddress();
 if (clientMachine == null) {
  clientMachine = "";
 }
 return clientMachine;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

private static String getClientMachine() {
 String clientMachine = NamenodeWebHdfsMethods.getRemoteAddress();
 if (clientMachine == null) { //not a web client
  clientMachine = Server.getRemoteAddress();
 }
 if (clientMachine == null) { //not a RPC client
  clientMachine = "";
 }
 return clientMachine;
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

private static String getClientMachine() {
 String clientMachine = NamenodeWebHdfsMethods.getRemoteAddress();
 if (clientMachine == null) { //not a web client
  clientMachine = Server.getRemoteAddress();
 }
 if (clientMachine == null) { //not a RPC client
  clientMachine = "";
 }
 return clientMachine;
}

代码示例来源:origin: org.apache.tez/tez-dag

private String getClientInfo() throws TezException {
 UserGroupInformation callerUGI;
 try {
  callerUGI = UserGroupInformation.getCurrentUser();
 } catch (IOException ie) {
  LOG.info("Error getting UGI ", ie);
  throw new TezException(ie);
 }
 String message = callerUGI.toString();
 if(null != Server.getRemoteAddress()) {
  message += " at " + Server.getRemoteAddress();
 }
 return message;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

@Override
 protected void checkRpcAdminAccess() throws IOException, AccessControlException {
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
  UserGroupInformation zkfcUgi = UserGroupInformation.getLoginUser();
  if (adminAcl.isUserAllowed(ugi) ||
    ugi.getShortUserName().equals(zkfcUgi.getShortUserName())) {
   LOG.info("Allowed RPC access from " + ugi + " at " + Server.getRemoteAddress());
   return;
  }
  String msg = "Disallowed RPC access from " + ugi + " at " +
    Server.getRemoteAddress() + ". Not listed in " + DFSConfigKeys.DFS_ADMIN; 
  LOG.warn(msg);
  throw new AccessControlException(msg);
 }
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

synchronized CheckpointSignature rollEditLog() throws IOException {
 if (isInSafeMode()) {
  throw new SafeModeException("Checkpoint not created",
                safeMode);
 }
 LOG.info("Roll Edit Log from " + Server.getRemoteAddress());
 return getFSImage().rollEditLog();
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

synchronized void rollFSImage() throws IOException {
 if (isInSafeMode()) {
  throw new SafeModeException("Checkpoint not created",
                safeMode);
 }
 LOG.info("Roll FSImage from " + Server.getRemoteAddress());
 getFSImage().rollFSImage();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public boolean hasAccess(QueueACL acl, UserGroupInformation user) {
 return authorizer.checkPermission(
   new AccessRequest(queueEntity, user,
     SchedulerUtils.toAccessType(acl), null, null,
     Server.getRemoteAddress(), null));
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
public boolean hasAccess(QueueACL acl, UserGroupInformation user) {
 return authorizer.checkPermission(
   new AccessRequest(queueEntity, user, SchedulerUtils.toAccessType(acl),
     null, null, Server.getRemoteAddress(), null));
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app

@SuppressWarnings("unchecked")
@Override
public KillTaskResponse killTask(KillTaskRequest request) 
 throws IOException {
 TaskId taskId = request.getTaskId();
 UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
 String message = "Kill task " + taskId + " received from " + callerUGI
   + " at " + Server.getRemoteAddress();
 LOG.info(message);
 verifyAndGetTask(taskId, JobACL.MODIFY_JOB);
 appContext.getEventHandler().handle(
   new TaskEvent(taskId, TaskEventType.T_KILL));
 KillTaskResponse response = 
  recordFactory.newRecordInstance(KillTaskResponse.class);
 return response;
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-app

@SuppressWarnings("unchecked")
@Override
public KillTaskResponse killTask(KillTaskRequest request) 
 throws IOException {
 TaskId taskId = request.getTaskId();
 UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
 String message = "Kill task " + taskId + " received from " + callerUGI
   + " at " + Server.getRemoteAddress();
 LOG.info(message);
 verifyAndGetTask(taskId, JobACL.MODIFY_JOB);
 appContext.getEventHandler().handle(
   new TaskEvent(taskId, TaskEventType.T_KILL));
 KillTaskResponse response = 
  recordFactory.newRecordInstance(KillTaskResponse.class);
 return response;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

CheckpointSignature rollEditLog() throws IOException {
 checkSuperuserPrivilege();
 checkOperation(OperationCategory.JOURNAL);
 writeLock();
 try {
  checkOperation(OperationCategory.JOURNAL);
  checkNameNodeSafeMode("Log not rolled");
  if (Server.isRpcInvocation()) {
   LOG.info("Roll Edit Log from " + Server.getRemoteAddress());
  }
  return getFSImage().rollEditLog();
 } finally {
  writeUnlock("rollEditLog");
 }
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

CheckpointSignature rollEditLog() throws IOException {
 writeLock();
 try {
  if (isInSafeMode()) {
   throw new SafeModeException("Checkpoint not created",
    safeMode);
  }
  LOG.info("Roll Edit Log from " + Server.getRemoteAddress() +
   " editlog file " + getFSImage().getEditLog().getFsEditName() +
   " editlog timestamp " + getFSImage().getEditLog().getFsEditTime());
  return getFSImage().rollEditLog();
 } finally {
  writeUnlock();
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

CheckpointSignature rollEditLog() throws IOException {
 checkSuperuserPrivilege();
 checkOperation(OperationCategory.JOURNAL);
 writeLock();
 try {
  checkOperation(OperationCategory.JOURNAL);
  checkNameNodeSafeMode("Log not rolled");
  if (Server.isRpcInvocation()) {
   LOG.info("Roll Edit Log from " + Server.getRemoteAddress());
  }
  return getFSImage().rollEditLog();
 } finally {
  writeUnlock("rollEditLog");
 }
}

相关文章

微信公众号

最新文章

更多