Skip to content

Commit

Permalink
MODCLUSTER-798 Add support for server portOffset configuration in Tom…
Browse files Browse the repository at this point in the history
…cat.
  • Loading branch information
rhusar committed Dec 12, 2023
1 parent 2f7924e commit 8b9ab92
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ public String toString() {
void setAddress(InetAddress address);

/**
* Returns the port on which this connector operates.
* Returns the port on which this connector operates. Note that the implementations need to account for any form
* of external port mapping or port offsetting that might have an effect on the configured port.
*
* @return a port number
* @return a port number on which this connector operates
*/
int getPort();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void setAddress(InetAddress address) {

@Override
public int getPort() {
return (this.externalPort == null) ? this.connector.getPort() : this.externalPort;
return (this.externalPort == null) ? this.connector.getPortWithOffset() : this.externalPort;
}

@Override
Expand Down Expand Up @@ -112,7 +112,7 @@ public int hashCode() {
@Override
public String toString() {
InetAddress address = this.getAddress();
return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPort());
return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPortWithOffset());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public int getPortOffset() {
}

@Override
public void setPortOffset(int i) {
public void setPortOffset(int portOffset) {
throw new IllegalStateException();
}

@Override
public int getPortWithOffset() {
return this.service.getServer().getPort();
return this.service.getServer().getPortWithOffset();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void setAddress(InetAddress address) {

@Override
public int getPort() {
return (this.externalPort == null) ? this.connector.getPort() : this.externalPort;
return (this.externalPort == null) ? this.connector.getPortWithOffset() : this.externalPort;
}

@Override
Expand Down Expand Up @@ -112,7 +112,7 @@ public int hashCode() {
@Override
public String toString() {
InetAddress address = this.getAddress();
return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPort());
return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPortWithOffset());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void setAddress(InetAddress address) {

@Override
public int getPort() {
return (this.externalPort == null) ? this.connector.getPort() : this.externalPort;
return (this.externalPort == null) ? this.connector.getPortWithOffset() : this.externalPort;
}

@Override
Expand Down Expand Up @@ -112,7 +112,7 @@ public int hashCode() {
@Override
public String toString() {
InetAddress address = this.getAddress();
return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPort());
return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPortWithOffset());
}

/**
Expand Down

0 comments on commit 8b9ab92

Please sign in to comment.