private int calculatePort() { int port = this.port; if (!isFixedPort) { port += socketBindings.getPortOffset(); } return port; }
private int calculatePort() { int port = this.port; if (port > 0 && isFixedPort == false) { port += socketBindings.getPortOffset(); } return port; }
/** * Unlike the {@link #getPort()} method, this method takes into account the port offset, if the port * is <i>not</i> a fixed port and returns the absolute port number which is the sum of the port offset * and the (relative) port * @return */ public int getAbsolutePort() { if (this.isFixedPort) { return port; } return this.port + this.socketBindings.getPortOffset(); }
private int calculatePort() { int port = this.port; if (!isFixedPort) { port += socketBindings.getPortOffset(); } return port; }
/** * The absolute source port for this outbound socket binding. The absolute source port is the same as {@link #getSourcePort()} * if the outbound socket binding is marked for "fixed source port". Else, it is the sum of {@link #getSourcePort()} * and the port offset configured on the {@link SocketBindingManager} * * @return */ Integer getAbsoluteSourcePort() { if (this.sourcePort == null) { return null; } if (this.fixedSourcePort) { return this.sourcePort; } final int portOffset = this.socketBindingManager.getPortOffset(); return this.sourcePort + portOffset; }
/** * The absolute source port for this outbound socket binding. The absolute source port is the same as {@link #getSourcePort()} * if the outbound socket binding is marked for "fixed source port". Else, it is the sum of {@link #getSourcePort()} * and the port offset configured on the {@link SocketBindingManager} * * @return */ Integer getAbsoluteSourcePort() { if (this.sourcePort == null) { return null; } if (this.fixedSourcePort) { return this.sourcePort; } final int portOffset = this.socketBindingManager.getPortOffset(); return this.sourcePort + portOffset; }
/** * Returns the absolute source port for this outbound socket binding. The absolute source port is the same as {@link #getSourcePort()} * if the outbound socket binding is marked for "fixed source port". Else, it is the sum of {@link #getSourcePort()} * and the port offset configured on the {@link SocketBindingManager}. * * @return the absolute source port accounting for port offset/fixation; {@code null} if an ephemeral port should be used */ public Integer getAbsoluteSourcePort() { if (this.getSourcePort() == null) { return null; } if (this.fixedSourcePort) { return this.sourcePort; } final int portOffset = this.socketBindingManager.getPortOffset(); return this.sourcePort + portOffset; }
undertow = Undertow.builder().addHttpListener(8080 + socketBindingManagerInjectedValue.getValue().getPortOffset(), "0.0.0.0").setHandler(shutdown).build(); undertow.start();