def stop_service
DRb.remove_server(self)
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
Thread.current['DRb']['stop_service'] = true
else
if @protocol.respond_to? :shutdown
@protocol.shutdown
else
@thread.kill
end
@thread.join
end
end