Sha256: 9d427b5897d0abe13ab5021a1b432a3ab2b1b7441a7453a7c0a3414cfc0370d3
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
module Pacer module Orient import com.orientechnologies.orient.core.db.ODatabaseListener class DbListener include ODatabaseListener attr_reader :graph, :ident def initialize(graph) @ident = :"listener#{rand}" @graph = graph end def data=(x) Thread.current[ident] = x end def data Thread.current[ident] end def onCreate(db) end def onDelete(db) end def onOpen(db) end def onBeforeTxBegin(db) end def onBeforeTxRollback(db) end def onAfterTxRollback(db) end def onBeforeTxCommit(db) end def onAfterTxCommit(db) end def onClose(db) end def onCorruptionRepairDatabase(db, iReason, iWhatWillbeFixed) return false end end class DbCommitListener < DbListener attr_reader :on_commit def initialize(graph, on_commit) @on_commit = on_commit super graph end def onBeforeTxCommit(db) self.data = CachedTxDataWrapper.new db, graph rescue Exception => e puts "Exception: #{ e.message }" pp e.backtrace nil end def onAfterTxCommit(db) on_commit.call self.data rescue Exception => e puts "Exception: #{ e.message }" pp e.backtrace nil ensure self.data = nil end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pacer-orient-2.3.5.pre-java | lib/pacer-orient/db_listener.rb |
pacer-orient-2.3.4.pre-java | lib/pacer-orient/db_listener.rb |