Giriş
Şu satırı dahil ederiz
import com.hazelcast.internal.tpc.TpcServerBootstrap;
bind metodu
Kod şöyle. Verilen port aralığındaki bir port numarasına bind etmeye çalışır
private int bind(AsyncServerSocket serverSocket, int port, int limit) {
while (port < limit) {
try {
serverSocket.bind(new InetSocketAddress(thisAddress.getInetAddress(), port));
return port + 1;
} catch (UncheckedIOException e) {
if (e.getCause() instanceof BindException) {
// this port is occupied probably by another hz member, try another one
port += tpcEngine.reactorCount();
} else {
throw e;
}
} catch (UnknownHostException e) {
throw new UncheckedIOException(e);
}
}
throw new HazelcastException("Could not find a free port in the TPC socket port range.");
}
Hiç yorum yok:
Yorum Gönder