Open SeungpilPark opened 7 years ago
해당 code 가 오디에 있나요? 한번 봐줄게요.
포시에스에서 해결해달라고 주장하는 부분:
상황:
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>4.16.1</version>
</dependency>
느려진다고 주장하는 부분 - nimbus-jose-jwt 내부코드의 synchronized 구간.
package com.nimbusds.jose;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JOSEObject;
import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jose.JWSSigner;
import com.nimbusds.jose.JWSVerifier;
import com.nimbusds.jose.Payload;
import com.nimbusds.jose.util.Base64URL;
import java.nio.charset.Charset;
import java.text.ParseException;
import net.jcip.annotations.ThreadSafe;
@ThreadSafe
public class JWSObject extends JOSEObject {
.
.
public synchronized boolean verify(JWSVerifier verifier) throws JOSEException {
this.ensureSignedOrVerifiedState();
boolean verified;
try {
verified = verifier.verify(this.getHeader(), this.getSigningInput(), this.getSignature());
} catch (JOSEException var4) {
throw var4;
} catch (Exception var5) {
throw new JOSEException(var5.getMessage(), var5);
}
if(verified) {
this.state = JWSObject.State.VERIFIED;
}
return verified;
}
nimbus-jose-jwt 내부의 synchronized 메소드로 인해 멀티 쓰레드 요청시 성능 저하가 의심되는 상황.