Skip to content

Commit

Permalink
Ensure the java extension is always loaded before it's needed
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jan 11, 2023
1 parent fa5f28a commit f3d8a89
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
if Concurrent.on_jruby?
require 'concurrent/utility/native_extension_loader'

module Concurrent

Expand Down
4 changes: 2 additions & 2 deletions lib/concurrent-ruby/concurrent/atomic/semaphore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ module Concurrent

# @!visibility private
# @!macro internal_implementation_note
SemaphoreImplementation = case
when defined?(JavaSemaphore)
SemaphoreImplementation = if Concurrent.on_jruby?
require 'concurrent/utility/native_extension_loader'
JavaSemaphore
else
MutexSemaphore
Expand Down
1 change: 1 addition & 0 deletions lib/concurrent-ruby/concurrent/exchanger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def do_exchange(value, timeout)
end

if Concurrent.on_jruby?
require 'concurrent/utility/native_extension_loader'

# @!macro internal_implementation_note
# @!visibility private
Expand Down
1 change: 1 addition & 0 deletions lib/concurrent-ruby/concurrent/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Collection
# @!visibility private
MapImplementation = case
when Concurrent.on_jruby?
require 'concurrent/utility/native_extension_loader'
# noinspection RubyResolve
JRubyMapBackend
when Concurrent.on_cruby?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'concurrent/utility/native_extension_loader' # load native parts first

module Concurrent
module Synchronization

Expand Down

0 comments on commit f3d8a89

Please sign in to comment.