org.apache.hadoop.io.nativeio.NativeIO.stripDomain()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(81)

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

NativeIO.stripDomain介绍

[英]The Windows logon name has two part, NetBIOS domain name and user account name, of the format DOMAIN\UserName. This method will remove the domain part of the full logon name.
[中]Windows登录名有两部分,即NetBIOS域名和用户帐户名,格式为domain\UserName。此方法将删除完整登录名的域部分。

代码示例

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

public static String getOwner(FileDescriptor fd) throws IOException {
 ensureInitialized();
 if (Shell.WINDOWS) {
  String owner = Windows.getOwner(fd);
  owner = stripDomain(owner);
  return owner;
 } else {
  long uid = POSIX.getUIDforFDOwnerforOwner(fd);
  CachedUid cUid = uidCache.get(uid);
  long now = System.currentTimeMillis();
  if (cUid != null && (cUid.timestamp + cacheTimeout) > now) {
   return cUid.username;
  }
  String user = POSIX.getUserName(uid);
  LOG.info("Got UserName " + user + " for UID " + uid
    + " from the native implementation");
  cUid = new CachedUid(user, now);
  uidCache.put(uid, cUid);
  return user;
 }
}

代码示例来源:origin: io.hops/hadoop-common

public static String getOwner(FileDescriptor fd) throws IOException {
 ensureInitialized();
 if (Shell.WINDOWS) {
  String owner = Windows.getOwner(fd);
  owner = stripDomain(owner);
  return owner;
 } else {
  long uid = POSIX.getUIDforFDOwnerforOwner(fd);
  CachedUid cUid = uidCache.get(uid);
  long now = System.currentTimeMillis();
  if (cUid != null && (cUid.timestamp + cacheTimeout) > now) {
   return cUid.username;
  }
  String user = POSIX.getUserName(uid);
  LOG.info("Got UserName " + user + " for UID " + uid
    + " from the native implementation");
  cUid = new CachedUid(user, now);
  uidCache.put(uid, cUid);
  return user;
 }
}

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

public static String getOwner(FileDescriptor fd) throws IOException {
 ensureInitialized();
 if (Shell.WINDOWS) {
  String owner = Windows.getOwner(fd);
  owner = stripDomain(owner);
  return owner;
 } else {
  long uid = POSIX.getUIDforFDOwnerforOwner(fd);
  CachedUid cUid = uidCache.get(uid);
  long now = System.currentTimeMillis();
  if (cUid != null && (cUid.timestamp + cacheTimeout) > now) {
   return cUid.username;
  }
  String user = POSIX.getUserName(uid);
  LOG.info("Got UserName " + user + " for UID " + uid
    + " from the native implementation");
  cUid = new CachedUid(user, now);
  uidCache.put(uid, cUid);
  return user;
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

public static String getOwner(FileDescriptor fd) throws IOException {
 ensureInitialized();
 if (Shell.WINDOWS) {
  String owner = Windows.getOwner(fd);
  owner = stripDomain(owner);
  return owner;
 } else {
  long uid = POSIX.getUIDforFDOwnerforOwner(fd);
  CachedUid cUid = uidCache.get(uid);
  long now = System.currentTimeMillis();
  if (cUid != null && (cUid.timestamp + cacheTimeout) > now) {
   return cUid.username;
  }
  String user = POSIX.getUserName(uid);
  LOG.info("Got UserName " + user + " for UID " + uid
    + " from the native implementation");
  cUid = new CachedUid(user, now);
  uidCache.put(uid, cUid);
  return user;
 }
}

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

public static String getOwner(FileDescriptor fd) throws IOException {
 ensureInitialized();
 if (Shell.WINDOWS) {
  String owner = Windows.getOwner(fd);
  owner = stripDomain(owner);
  return owner;
 } else {
  long uid = POSIX.getUIDforFDOwnerforOwner(fd);
  CachedUid cUid = uidCache.get(uid);
  long now = System.currentTimeMillis();
  if (cUid != null && (cUid.timestamp + cacheTimeout) > now) {
   return cUid.username;
  }
  String user = POSIX.getUserName(uid);
  LOG.info("Got UserName " + user + " for UID " + uid
    + " from the native implementation");
  cUid = new CachedUid(user, now);
  uidCache.put(uid, cUid);
  return user;
 }
}

相关文章