Skip to content

Commit 2f251b9

Browse files
committed
[fix] sync SSLContext#setup as it could be shared (#302)
follow-up on previous commit: b612897
1 parent b612897 commit 2f251b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/jruby/ext/openssl/SSLContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public SSLContext(Ruby runtime, RubyClass type) {
315315
//private int sessionCacheMode; // 2 default on MRI
316316
private int sessionCacheSize; // 20480
317317

318-
private InternalContext internalContext;
318+
private volatile InternalContext internalContext;
319319

320320
@JRubyMethod(required = 0, optional = 1, visibility = Visibility.PRIVATE)
321321
public IRubyObject initialize(IRubyObject[] args) {
@@ -334,7 +334,7 @@ public IRubyObject initialize_copy(IRubyObject original) {
334334
final SSLContext initializeImpl() { return this; }
335335

336336
@JRubyMethod
337-
public IRubyObject setup(final ThreadContext context) {
337+
public synchronized IRubyObject setup(final ThreadContext context) {
338338
final Ruby runtime = context.runtime;
339339

340340
if ( isFrozen() ) return runtime.getNil();

0 commit comments

Comments
 (0)