Skip to content

Commit

Permalink
fix: passticket generation and limit eureka replication peers threads (
Browse files Browse the repository at this point in the history
…#2845)

* Limit Eureka peer threads
  • Loading branch information
JirkaAichler authored Mar 20, 2023
1 parent e49b663 commit 42b491e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class PassTicketService {

private IRRPassTicket irrPassTicket;
private final IRRPassTicket irrPassTicket;

public PassTicketService() {
this.irrPassTicket = ClassOrDefaultProxyUtils.createProxy(IRRPassTicket.class,
Expand All @@ -40,11 +40,13 @@ public PassTicketService() {
IRRPassTicketGenerationException.class, "getSafRc", "getRacfRc", "getRacfRsn"));
}

public void evaluate(String userId, String applId, String passTicket) throws IRRPassTicketEvaluationException {
// IRRPassTicket is not thread-safe, must be synchronized
public synchronized void evaluate(String userId, String applId, String passTicket) throws IRRPassTicketEvaluationException {
irrPassTicket.evaluate(userId.toUpperCase(), applId.toUpperCase(), passTicket.toUpperCase());
}

public String generate(String userId, String applId) throws IRRPassTicketGenerationException {
// IRRPassTicket is not thread-safe, must be synchronized
public synchronized String generate(String userId, String applId) throws IRRPassTicketGenerationException {
return irrPassTicket.generate(userId.toUpperCase(), applId.toUpperCase());
}

Expand Down Expand Up @@ -118,8 +120,8 @@ public String generate(String userId, String applId) throws IRRPassTicketGenerat
@Value
private static class UserApp {

private final String userId;
private final String applId;
String userId;
String applId;

}
}
Expand Down
1 change: 1 addition & 0 deletions discovery-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ eureka:
serviceUrl:
defaultZone: ${apiml.discovery.allPeersUrls}
server:
max-threads-for-peer-replication: 2
useReadOnlyResponseCache: false

management:
Expand Down

0 comments on commit 42b491e

Please sign in to comment.