com.hazelcast.nio.Address.getPort()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(95)

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

Address.getPort介绍

暂无

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public String toUrn() {
  return URN_BASE + (address == null ? "-" : (address.getHost() + ":" + String.valueOf(address.getPort()))) + DESC_SEP
      + String.valueOf(partitionId) + DESC_SEP + schedulerName + DESC_SEP + taskName;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public String toUrn() {
  return URN_BASE + (address == null ? "-" : (address.getHost() + ":" + String.valueOf(address.getPort()))) + DESC_SEP
      + String.valueOf(partitionId) + DESC_SEP + schedulerName + DESC_SEP + taskName;
}

代码示例来源:origin: com.hazelcast.simulator/tests-hz38

public MockIOService(Address thisAddress, LoggingService loggingService) throws Exception {
  this.thisAddress = thisAddress;
  this.loggingService = loggingService;
  serverSocketChannel = ServerSocketChannel.open();
  ServerSocket serverSocket = serverSocketChannel.socket();
  serverSocket.setReuseAddress(true);
  serverSocket.setSoTimeout(1000);
  serverSocket.bind(new InetSocketAddress("0.0.0.0", thisAddress.getPort()));
  this.serializationService = new DefaultSerializationServiceBuilder().build();
}

代码示例来源:origin: bitsofinfo/hazelcast-docker-swarm-discovery-spi

@Override
public InetSocketAddress getBindAddress() {
  Address addr = this.swarmDiscoveryUtil.getMyAddress();
  return new InetSocketAddress(addr.getHost(), addr.getPort());
}

代码示例来源:origin: bitsofinfo/hazelcast-docker-swarm-discovery-spi

@Override
public InetSocketAddress getPublicAddress() {
  Address addr = this.swarmDiscoveryUtil.getMyAddress();
  return new InetSocketAddress(addr.getHost(), addr.getPort());
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  Address address = member.getAddress();
  String host = address.getHost();
  int port = address.getPort();
  out.writeUTF(member.getUuid());
  out.writeUTF(host);
  out.writeInt(port);
  out.writeBoolean(member.isLiteMember());
  out.writeObject(member.getVersion());
}

代码示例来源:origin: hazelcast/hazelcast-jet

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  Address address = member.getAddress();
  String host = address.getHost();
  int port = address.getPort();
  out.writeUTF(member.getUuid());
  out.writeUTF(host);
  out.writeInt(port);
  out.writeBoolean(member.isLiteMember());
  out.writeObject(member.getVersion());
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private static void printMemberPort(HazelcastInstance hz) throws FileNotFoundException, UnsupportedEncodingException {
    String printPort = System.getProperty("print.port");
    if (printPort != null) {
      PrintWriter printWriter = null;
      try {
        printWriter = new PrintWriter("ports" + File.separator + printPort, "UTF-8");
        printWriter.println(hz.getCluster().getLocalMember().getAddress().getPort());
      } finally {
        closeResource(printWriter);
      }
    }
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

private static void printMemberPort(HazelcastInstance hz) throws Exception {
    String printPort = System.getProperty("print.port");
    if (printPort != null) {
      PrintWriter printWriter = null;
      try {
        printWriter = new PrintWriter("ports" + File.separator + printPort, "UTF-8");
        printWriter.println(hz.getCluster().getLocalMember().getAddress().getPort());
      } finally {
        closeResource(printWriter);
      }
    }
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

private static void printMemberPort(HazelcastInstance hz) throws FileNotFoundException, UnsupportedEncodingException {
    String printPort = System.getProperty("print.port");
    if (printPort != null) {
      PrintWriter printWriter = null;
      try {
        printWriter = new PrintWriter("ports" + File.separator + printPort, "UTF-8");
        printWriter.println(hz.getCluster().getLocalMember().getAddress().getPort());
      } finally {
        closeResource(printWriter);
      }
    }
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

public void setThisMember(MemberImpl thisMember) {
  this.thisMember = thisMember;
  this.thisAddressString = "[" + thisMember.getAddress().getHost() + "]:"
      + thisMember.getAddress().getPort() + " ";
}

代码示例来源:origin: com.hazelcast/hazelcast-all

public void setThisMember(MemberImpl thisMember) {
  this.thisMember = thisMember;
  this.thisAddressString = "[" + thisMember.getAddress().getHost() + "]:"
      + thisMember.getAddress().getPort() + " ";
}

代码示例来源:origin: hazelcast/hazelcast-jet

public static void encode(Address address, ClientMessage clientMessage) {
  clientMessage.set(address.getHost()).set(address.getPort());
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private Diagnostics newDiagnostics() {
  Address address = node.getThisAddress();
  String addressString = address.getHost().replace(":", "_") + "_" + address.getPort();
  String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
  return new Diagnostics(
      name,
      loggingService.getLogger(Diagnostics.class),
      getHazelcastInstance().getName(),
      node.getProperties());
}

代码示例来源:origin: hazelcast/hazelcast-jet

private Diagnostics newDiagnostics() {
  Address address = node.getThisAddress();
  String addressString = address.getHost().replace(":", "_") + "_" + address.getPort();
  String name = "diagnostics-" + addressString + "-" + currentTimeMillis();
  return new Diagnostics(
      name,
      loggingService.getLogger(Diagnostics.class),
      getHazelcastInstance().getName(),
      node.getProperties());
}

代码示例来源:origin: hazelcast/hazelcast-jet

private URL newGetTaskUrl() throws IOException {
  GroupConfig groupConfig = instance.getConfig().getGroupConfig();
  Address localAddress = instance.node.getClusterService().getLocalMember().getAddress();
  String urlString = cleanupUrl(managementCenterUrl) + "getTask.do?member=" + localAddress.getHost()
      + ":" + localAddress.getPort() + "&cluster=" + encode(groupConfig.getName(), "UTF-8");
  return new URL(urlString);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private URL newGetTaskUrl() throws IOException {
  GroupConfig groupConfig = instance.getConfig().getGroupConfig();
  Address localAddress = instance.node.getClusterService().getLocalMember().getAddress();
  String urlString = cleanupUrl(managementCenterUrl) + "getTask.do?member=" + localAddress.getHost()
      + ":" + localAddress.getPort() + "&cluster=" + encode(groupConfig.getName(), "UTF-8");
  return new URL(urlString);
}

代码示例来源:origin: hazelcast/hazelcast-jet

private Map<Address, Address> parseResponse(InputStream is) throws IOException {
  JsonValue jsonValue = Json.parse(readInputStream(is));
  List<JsonValue> response = jsonValue.asArray().values();
  Map<Address, Address> privateToPublicAddresses = new HashMap<Address, Address>();
  for (JsonValue value : response) {
    String privateAddress = value.asObject().get(PRIVATE_ADDRESS_PROPERTY).asString();
    String publicAddress = value.asObject().get(PUBLIC_ADDRESS_PROPERTY).asString();
    Address publicAddr = createAddress(publicAddress);
    privateToPublicAddresses.put(new Address(privateAddress, publicAddr.getPort()), publicAddr);
  }
  return privateToPublicAddresses;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private Map<Address, Address> parseResponse(InputStream is) throws IOException {
  JsonValue jsonValue = Json.parse(readInputStream(is));
  List<JsonValue> response = jsonValue.asArray().values();
  Map<Address, Address> privateToPublicAddresses = new HashMap<Address, Address>();
  for (JsonValue value : response) {
    String privateAddress = value.asObject().get(PRIVATE_ADDRESS_PROPERTY).asString();
    String publicAddress = value.asObject().get(PUBLIC_ADDRESS_PROPERTY).asString();
    Address publicAddr = createAddress(publicAddress);
    privateToPublicAddresses.put(new Address(privateAddress, publicAddr.getPort()), publicAddr);
  }
  return privateToPublicAddresses;
}

代码示例来源:origin: com.hazelcast/hazelcast-zookeeper

private void prepareServiceInstance() throws Exception {
  Address privateAddress = thisNode.getPrivateAddress();
  serviceInstance = ServiceInstance.<Void>builder()
      .uriSpec(new UriSpec("{scheme}://{address}:{port}"))
      .address(privateAddress.getHost())
      .port(privateAddress.getPort())
      .name(group)
      .build();
}

相关文章