Skip to content

Rename AutoClosable to AutoCloseable #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jruby/neo4j/driver/ext/graph_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ module Neo4j
module Driver
module Ext
module GraphDatabase
extend AutoClosable
extend AutoCloseable
include ConfigConverter
include ExceptionCheckable

auto_closable :driver
auto_closeable :driver

def driver(uri, auth_token = Neo4j::Driver::AuthTokens.none, **config)
check do
Expand Down
4 changes: 2 additions & 2 deletions jruby/neo4j/driver/ext/internal_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module Neo4j
module Driver
module Ext
module InternalDriver
extend AutoClosable
extend AutoCloseable
include ConfigConverter
include ExceptionCheckable
include AsyncConverter

auto_closable :session
auto_closeable :session

def session(**session_config)
java_method(:session, [org.neo4j.driver.SessionConfig])
Expand Down
4 changes: 2 additions & 2 deletions jruby/neo4j/driver/ext/internal_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module Neo4j
module Driver
module Ext
module InternalSession
extend AutoClosable
extend AutoCloseable
include ConfigConverter
include ExceptionCheckable
include RunOverride

auto_closable :begin_transaction
auto_closeable :begin_transaction

# work around jruby issue https://github.com/jruby/jruby/issues/5603
Struct.new('Wrapper', :object)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module Neo4j
module Driver
module AutoClosable
def auto_closable(*methods)
module AutoCloseable
def auto_closeable(*methods)
prepend with_block_definer(methods)
end

Expand All @@ -13,15 +13,15 @@ def with_block_definer(methods)
Module.new do
methods.each do |method|
define_method(method) do |*args, **kwargs, &block|
closable = super(*args, **kwargs)
closeable = super(*args, **kwargs)
if block
begin
block.arity.zero? ? closable.instance_eval(&block) : block.call(closable)
block.arity.zero? ? closeable.instance_eval(&block) : block.call(closeable)
ensure
closable&.close
closeable&.close
end
else
closable
closeable
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions ruby/neo4j/driver/graph_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module Neo4j::Driver
class GraphDatabase
class << self
extend AutoClosable
auto_closable :driver, :routing_driver
extend AutoCloseable
auto_closeable :driver, :routing_driver

def driver(uri, auth_token = nil, **config)
internal_driver(uri, auth_token, config)
Expand Down
4 changes: 2 additions & 2 deletions ruby/neo4j/driver/internal/internal_driver.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module Neo4j::Driver
module Internal
class InternalDriver
extend AutoClosable
extend AutoCloseable
extend Synchronizable
attr_reader :session_factory, :metrics_provider
# delegate :verify_connectivity, to: :session_factory
delegate :metrics, :metrics_enabled?, to: :metrics_provider
auto_closable :session
auto_closeable :session
sync :close, :supports_multi_db?, :verify_connectivity, :session

def initialize(security_plan, session_factory, metrics_provider, logger)
Expand Down
4 changes: 2 additions & 2 deletions ruby/neo4j/driver/internal/internal_session.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Neo4j::Driver
module Internal
class InternalSession
extend AutoClosable
extend AutoCloseable
extend Synchronizable
# include Ext::RunOverride
delegate :open?, :last_bookmark, to: :@session
auto_closable :begin_transaction
auto_closeable :begin_transaction
sync :close, :begin_transaction, :run, :transaction

def initialize(session)
Expand Down
Loading