Skip to content

Instantly share code, notes, and snippets.

@kmussel
Created December 15, 2014 15:13
Show Gist options
  • Save kmussel/e6787839b09ab5e38842 to your computer and use it in GitHub Desktop.
Save kmussel/e6787839b09ab5e38842 to your computer and use it in GitHub Desktop.
Oriented connection commit
def commit
@transaction_type = 0
Oriented.graph.raw_graph.transaction.current_record_entries.to_a.each do |r|
@transaction_type |= TRANSACTION_TYPES[r.type]
end
@graph.commit
Oriented::IdentityMap.clear
@retries = 0
rescue Java::ComOrientechnologiesOrientCoreException::OConcurrentModificationException => ex
@retries ||= 0
if @retries < 1 && (@transaction_type & DELETED) == 0
@retries += 1
Oriented::IdentityMap.all.each do |k, v|
v.save
end
retry
else
unless java_connection.closed?
rollback
end
raise ex
end
rescue => ex
unless java_connection.closed?
rollback
end
raise ex
ensure
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment