org.apache.samza.util.Util.getLocalHost()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(140)

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

Util.getLocalHost介绍

暂无

代码示例

代码示例来源:origin: apache/samza

/**
 * @return The hostname to use in the hostname field of the encoded
 *         LoggingEvents.
 */
public static String getHostname() {
 try {
  return Util.getLocalHost().getHostName();
 } catch (Exception e) {
  return "unknown-host";
 }
}

代码示例来源:origin: apache/samza

/**
 * @return The hostname to use in the hostname field of the encoded
 *         LoggingEvents.
 */
public static String getHostname() {
 try {
  return Util.getLocalHost().getHostName();
 } catch (Exception e) {
  return "unknown-host";
 }
}

代码示例来源:origin: apache/samza

@Override
 public LocationIdProvider getLocationIdProvider(Config config) {
  return ()  -> new LocationId(Util.getLocalHost().getHostName());
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

@Override
 public LocationIdProvider getLocationIdProvider(Config config) {
  return ()  -> new LocationId(Util.getLocalHost().getHostName());
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

@Override
 public LocationIdProvider getLocationIdProvider(Config config) {
  return ()  -> new LocationId(Util.getLocalHost().getHostName());
 }
}

代码示例来源:origin: org.apache.samza/samza-core

@Override
 public LocationIdProvider getLocationIdProvider(Config config) {
  return ()  -> new LocationId(Util.getLocalHost().getHostName());
 }
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

@Override
 public LocationIdProvider getLocationIdProvider(Config config) {
  return ()  -> new LocationId(Util.getLocalHost().getHostName());
 }
}

代码示例来源:origin: org.apache.samza/samza-core

public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
 this(keyArray, messageMap);
 if (!isDelete) {
  this.messageMap.put("values", new HashMap<String, String>());
  setSource(source);
  setUsername(System.getProperty("user.name"));
  setTimestamp(System.currentTimeMillis());
  try {
   setHost(Util.getLocalHost().getHostAddress());
  } catch (Exception e) {
   log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
   setHost("");
  }
 }
 setVersion(VERSION);
}

代码示例来源:origin: apache/samza

public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
 this(keyArray, messageMap);
 if (!isDelete) {
  this.messageMap.put("values", new HashMap<String, String>());
  setSource(source);
  setUsername(System.getProperty("user.name"));
  setTimestamp(System.currentTimeMillis());
  try {
   setHost(Util.getLocalHost().getHostAddress());
  } catch (Exception e) {
   log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
   setHost("");
  }
 }
 setVersion(VERSION);
}

代码示例来源:origin: org.apache.samza/samza-core_2.12

public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
 this(keyArray, messageMap);
 if (!isDelete) {
  this.messageMap.put("values", new HashMap<String, String>());
  setSource(source);
  setUsername(System.getProperty("user.name"));
  setTimestamp(System.currentTimeMillis());
  try {
   setHost(Util.getLocalHost().getHostAddress());
  } catch (Exception e) {
   log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
   setHost("");
  }
 }
 setVersion(VERSION);
}

代码示例来源:origin: org.apache.samza/samza-core_2.10

public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
 this(keyArray, messageMap);
 if (!isDelete) {
  this.messageMap.put("values", new HashMap<String, String>());
  setSource(source);
  setUsername(System.getProperty("user.name"));
  setTimestamp(System.currentTimeMillis());
  try {
   setHost(Util.getLocalHost().getHostAddress());
  } catch (Exception e) {
   log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
   setHost("");
  }
 }
 setVersion(VERSION);
}

代码示例来源:origin: org.apache.samza/samza-core_2.11

public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
 this(keyArray, messageMap);
 if (!isDelete) {
  this.messageMap.put("values", new HashMap<String, String>());
  setSource(source);
  setUsername(System.getProperty("user.name"));
  setTimestamp(System.currentTimeMillis());
  try {
   setHost(Util.getLocalHost().getHostAddress());
  } catch (Exception e) {
   log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
   setHost("");
  }
 }
 setVersion(VERSION);
}

代码示例来源:origin: apache/samza

MetricsConfig metricsConfig = new MetricsConfig(config);
Map<String, MetricsReporter> metricsReporters = MetricsReporterLoader.getMetricsReporters(metricsConfig,
  Util.getLocalHost().getHostName());
SamzaRestService restService = new SamzaRestService(new Server(config.getPort()), metricsRegistry, metricsReporters,
  new ServletContextHandler(ServletContextHandler.SESSIONS));

相关文章