From: Pen Ttt Date: 2010-08-27T23:22:24+09:00 Subject: Re: error handling with exceptions in multi-thread download require 'rubygems' require 'open-uri' require 'nokogiri' require 'mysql' require 'date' class Data def self.getdaystock() time0=Time.now i=0 cdown=[] threads=[] cthreaddown=[] open("/home/pt/usa/stocklist","r"){|item| while line=item.gets cdown< e puts "#{web} failed" rescue NameError => e puts "#{web} failed" rescue => e puts "#{web} wrong" end end end threads.each {|thr| begin thr.join rescue Timeout::Error => e puts "#{web} failed" rescue NameError => e puts "#{web} failed" rescue => e puts "#{web} failed" end } i=0 cthreaddown=[] threads = [] sleep 0.01 else end } end end i have opened 100 threads. there are 6000 companies in /home/pt/usa/stocklist . -- Posted via http://www.ruby-forum.com/.