File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed
Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ def initialize(config)
2020 connection # force the connection to load (@see RubyJDbcConnection.connection)
2121 set_native_database_types
2222 @stmts = { } # AR compatibility - statement cache not used
23- rescue ::ActiveRecord ::ActiveRecordError
24- raise
2523 rescue Java ::JavaSql ::SQLException => e
2624 e = e . cause if defined? ( NativeException ) && e . is_a? ( NativeException ) # JRuby-1.6.8
2725 error = e . getMessage || e . getSQLState
Original file line number Diff line number Diff line change 11module ArJdbc
2+
23 def self . discover_extensions
34 if defined? ( ::Gem ) && ::Gem . respond_to? ( :find_files )
45 files = ::Gem . find_files ( 'arjdbc/discover' )
@@ -8,11 +9,12 @@ def self.discover_extensions
89 File . exist? ( discover ) ? discover : nil
910 end . compact
1011 end
11- files . each do |f |
12- puts "Loading #{ f } " if $DEBUG
13- require f
12+ files . each do |file |
13+ puts "Loading AR-JDBC extension #{ file } " if $DEBUG
14+ require file
1415 end
1516 end
1617
1718 discover_extensions
18- end
19+
20+ end
Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ def initialize(name, properties = {})
1313 properties . each { |key , val | @properties [ key ] = val . to_s } if properties
1414 end
1515 end
16-
16+
1717 def driver_class
1818 @driver_class ||= begin
1919 driver_class_const = ( @name [ 0 ...1 ] . capitalize + @name [ 1 ..@name . length ] ) . gsub ( /\. / , '_' )
20- Jdbc ::Mutex . synchronized do
20+ Jdbc ::DriverManager . java_class . synchronized do # avoid 2 threads here
2121 unless Jdbc . const_defined? ( driver_class_const )
2222 driver_class_name = @name
2323 Jdbc . module_eval do
Original file line number Diff line number Diff line change 44module ActiveRecord
55 module ConnectionAdapters
66 module Jdbc
7- Mutex = java . lang . Object . new
87 DriverManager = java . sql . DriverManager
98 Types = java . sql . Types
109 end
11-
1210 java_import "arjdbc.jdbc.JdbcConnectionFactory"
1311 end
1412end
You can’t perform that action at this time.
0 commit comments