提交 c6d9eb8a 编写于 作者: K Kohsuke Kawaguchi

Making people happier

上级 0d41a2c3
......@@ -25,8 +25,8 @@ import java.security.spec.RSAPublicKeySpec;
* @author Kohsuke Kawaguchi
*/
public abstract class RSAConfidentialKey extends ConfidentialKey {
private volatile RSAPrivateKey priv;
private volatile RSAPublicKey pub;
private RSAPrivateKey priv;
private RSAPublicKey pub;
public RSAConfidentialKey(String id) {
super(id);
}
......@@ -35,10 +35,8 @@ public abstract class RSAConfidentialKey extends ConfidentialKey {
this(owner.getName() + '.' + shortName);
}
private RSAPrivateKey getKey() {
private synchronized RSAPrivateKey getKey() {
try {
if (priv == null) {
synchronized (this) {
if (priv == null) {
byte[] payload = load();
if (payload == null) {
......@@ -57,8 +55,6 @@ public abstract class RSAConfidentialKey extends ConfidentialKey {
new RSAPublicKeySpec(pks.getModulus(), pks.getPublicExponent()));
}
}
}
}
return priv;
} catch (IOException e) {
throw new Error("Failed to load the key: " + getId(), e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册