80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/sequel/extensions/concurrent_thread_pool.rb', line 80
def extended(db)
db.instance_exec do
case pool.pool_type
when :single, :sharded_single
raise Error, "cannot load concurrent_thread_pool extension " \
"if using single or sharded_single connection pool"
end
executor, owned = choose_executor(opts)
proxy_klass =
typecast_value_boolean(opts[:preempt_async_thread]) ? PreemptableProxy : Proxy
define_singleton_method(:async_job_class) { proxy_klass }
define_singleton_method(:async_thread_executor) { executor }
finalizer =
Sequel::Database::ConcurrentThreadPool::DatabaseMethods.make_finalizer(executor)
ObjectSpace.define_finalizer(db, finalizer) if owned
extend_datasets(DatasetMethods)
end
end
|