@@ -171,18 +171,27 @@ private static RaiseException newSSLError(Ruby runtime, String message, Exceptio
171171 }
172172
173173 public static RaiseException newSSLErrorWaitReadable (Ruby runtime , String message ) {
174- return newCustomSSLError (runtime , "SSLErrorWaitReadable" , message );
174+ return newWaitSSLError (runtime , "SSLErrorWaitReadable" , message );
175175 }
176176
177177 public static RaiseException newSSLErrorWaitWritable (Ruby runtime , String message ) {
178- return newCustomSSLError (runtime , "SSLErrorWaitWritable" , message );
178+ return newWaitSSLError (runtime , "SSLErrorWaitWritable" , message );
179179 }
180180
181181 // -Djruby.openssl.ssl.error_wait_nonblock.backtrace=false disables backtrace for WaitReadable/Writable
182- private static final boolean waitErrorBacktrace =
183- SafePropertyAccessor .getBoolean ("jruby.openssl.ssl.error_wait_nonblock.backtrace" , false );
182+ private static final boolean waitErrorBacktrace ;
183+
184+ static {
185+ String backtrace = SafePropertyAccessor .getProperty ("jruby.openssl.ssl.error_wait_nonblock.backtrace" );
186+ if (backtrace == null ) {
187+ // default to JRuby's Option<Boolean> ERRNO_BACKTRACE =
188+ // ... "Generate backtraces for heavily-used Errno exceptions (EAGAIN)."
189+ backtrace = SafePropertyAccessor .getProperty ("jruby.errno.backtrace" , "false" );
190+ }
191+ waitErrorBacktrace = Boolean .parseBoolean (backtrace );
192+ }
184193
185- private static RaiseException newCustomSSLError (final Ruby runtime , final String name ,
194+ private static RaiseException newWaitSSLError (final Ruby runtime , final String name ,
186195 final String message ) {
187196 RubyClass errorClass = _SSL (runtime ).getClass (name );
188197 if ( errorClass == null ) { // < Ruby 2.0
0 commit comments