Skip to content

Commit e5db3f2

Browse files
committed
[refactor] less locking when there's a shared SSLContext
1 parent b32a4fa commit e5db3f2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,15 @@ public IRubyObject initialize_copy(IRubyObject original) {
334334
final SSLContext initializeImpl() { return this; }
335335

336336
@JRubyMethod
337-
public synchronized IRubyObject setup(final ThreadContext context) {
338-
final Ruby runtime = context.runtime;
337+
public IRubyObject setup(final ThreadContext context) {
338+
if (isFrozen()) return context.nil;
339+
return doSetup(context);
340+
}
339341

340-
if ( isFrozen() ) return runtime.getNil();
342+
private synchronized IRubyObject doSetup(final ThreadContext context) {
343+
if (isFrozen()) return context.nil;
344+
345+
final Ruby runtime = context.runtime;
341346

342347
final X509Store certStore = getCertStore();
343348

0 commit comments

Comments
 (0)