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

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

本文整理了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

  1. /**
  2. * @return The hostname to use in the hostname field of the encoded
  3. * LoggingEvents.
  4. */
  5. public static String getHostname() {
  6. try {
  7. return Util.getLocalHost().getHostName();
  8. } catch (Exception e) {
  9. return "unknown-host";
  10. }
  11. }

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

  1. /**
  2. * @return The hostname to use in the hostname field of the encoded
  3. * LoggingEvents.
  4. */
  5. public static String getHostname() {
  6. try {
  7. return Util.getLocalHost().getHostName();
  8. } catch (Exception e) {
  9. return "unknown-host";
  10. }
  11. }

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

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

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

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

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

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

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

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

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

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

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

  1. public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
  2. this(keyArray, messageMap);
  3. if (!isDelete) {
  4. this.messageMap.put("values", new HashMap<String, String>());
  5. setSource(source);
  6. setUsername(System.getProperty("user.name"));
  7. setTimestamp(System.currentTimeMillis());
  8. try {
  9. setHost(Util.getLocalHost().getHostAddress());
  10. } catch (Exception e) {
  11. log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
  12. setHost("");
  13. }
  14. }
  15. setVersion(VERSION);
  16. }

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

  1. public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
  2. this(keyArray, messageMap);
  3. if (!isDelete) {
  4. this.messageMap.put("values", new HashMap<String, String>());
  5. setSource(source);
  6. setUsername(System.getProperty("user.name"));
  7. setTimestamp(System.currentTimeMillis());
  8. try {
  9. setHost(Util.getLocalHost().getHostAddress());
  10. } catch (Exception e) {
  11. log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
  12. setHost("");
  13. }
  14. }
  15. setVersion(VERSION);
  16. }

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

  1. public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
  2. this(keyArray, messageMap);
  3. if (!isDelete) {
  4. this.messageMap.put("values", new HashMap<String, String>());
  5. setSource(source);
  6. setUsername(System.getProperty("user.name"));
  7. setTimestamp(System.currentTimeMillis());
  8. try {
  9. setHost(Util.getLocalHost().getHostAddress());
  10. } catch (Exception e) {
  11. log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
  12. setHost("");
  13. }
  14. }
  15. setVersion(VERSION);
  16. }

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

  1. public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
  2. this(keyArray, messageMap);
  3. if (!isDelete) {
  4. this.messageMap.put("values", new HashMap<String, String>());
  5. setSource(source);
  6. setUsername(System.getProperty("user.name"));
  7. setTimestamp(System.currentTimeMillis());
  8. try {
  9. setHost(Util.getLocalHost().getHostAddress());
  10. } catch (Exception e) {
  11. log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
  12. setHost("");
  13. }
  14. }
  15. setVersion(VERSION);
  16. }

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

  1. public CoordinatorStreamMessage(String source, Object[] keyArray, Map<String, Object> messageMap) {
  2. this(keyArray, messageMap);
  3. if (!isDelete) {
  4. this.messageMap.put("values", new HashMap<String, String>());
  5. setSource(source);
  6. setUsername(System.getProperty("user.name"));
  7. setTimestamp(System.currentTimeMillis());
  8. try {
  9. setHost(Util.getLocalHost().getHostAddress());
  10. } catch (Exception e) {
  11. log.warn("Unable to retrieve host for current machine. Setting coordinator stream message host field to an empty string.");
  12. setHost("");
  13. }
  14. }
  15. setVersion(VERSION);
  16. }

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

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

相关文章