minor: JRUBY hacks

This commit is contained in:
Tyler Brock 2012-05-15 15:41:57 -04:00
parent 746687bb86
commit 9b38c3a70f
1 changed files with 8 additions and 4 deletions

View File

@ -70,10 +70,14 @@ module Mongo
if ready
begin
@socket.sysread(maxlen, buffer)
rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT, EOFError
raise ConnectionFailure
rescue Errno::EINTR, Errno::EIO, IOError
raise OperationFailure
rescue SystemCallError => ex
# Needed because sometimes JRUBY doesn't throw Errno::ECONNRESET as it should
# http://jira.codehaus.org/browse/JRUBY-6180
raise ConnectionFailure, ex
rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT, EOFError => ex
raise ConnectionFailure, ex
rescue Errno::EINTR, Errno::EIO, IOError => ex
raise OperationFailure, ex
end
else
raise OperationTimeout