Created
December 15, 2014 15:13
-
-
Save kmussel/e6787839b09ab5e38842 to your computer and use it in GitHub Desktop.
Oriented connection commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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