Is a library able to change class of my object?

P

Pavel Smerk

Hello,

I have got a webrick server allowing two concurrent threads and using
BDB::XML, a ruby interface to Berkeley DBXML. When some user presses two
times very quickly the refresh button of his/her browser and generates
two requests in very short time, following code

puts Time.now.to_s + ' ' + xil.inspect + ' 1'
xil.low_bound = ['a', XML::IndexLookup::GTE]
sleep(1)
xil.execute(nil, XML::LAZY_DOCS)
puts Time.now.to_s + ' ' + xil.inspect + ' 2'

(the sleep simulates that one xmllookupindex object is set and executed
many times) produces this output

Tue Aug 29 14:12:12 CEST 2006 #<BDB::XML::IndexLookup:0x426b9c14> 1
Tue Aug 29 14:12:12 CEST 2006 #<BDB::XML::IndexLookup:0x426b1c44> 1
Tue Aug 29 14:12:14 CEST 2006 #<BDB::XML::IndexLookup:0x426b1c44> 2
06-08-29 14:12:15 ERROR NoMethodError: undefined method `execute' for
#<Data:0x426b9c14>

Notice the "Data" string --- what does it mean? OK, may be the DB locks
the index in some way so methods of one of the indexlookup objects would
fail if called. But what and how (and why) changes the class?

Thanks,

P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top