[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Is a library able to change class of my object?

Pavel Smerk

8/29/2006 12:25:00 PM

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.