Signalhandler mit Puffer.
This commit is contained in:
parent
c20b420d4a
commit
aa47581eb9
3 changed files with 9 additions and 4 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.0.0
|
||||
0.0.0.1
|
||||
|
|
|
@ -52,6 +52,8 @@ class Retries
|
|||
end
|
||||
|
||||
class RobustServer
|
||||
attr_reader :signals
|
||||
|
||||
def self.main *argv
|
||||
self.new( *argv).main
|
||||
end
|
||||
|
@ -62,6 +64,7 @@ class RobustServer
|
|||
Signal[:INT] => sh, Signal[:HUP] => nil, Signal[:TERM] => sh,
|
||||
Signal[:KILL] => sh, Signal[:USR1] => nil, Signal[:USR2] => nil
|
||||
}
|
||||
@signals = []
|
||||
end
|
||||
|
||||
def trapping
|
||||
|
@ -69,7 +72,8 @@ class RobustServer
|
|||
end
|
||||
|
||||
def signal_handler s
|
||||
@signal = s
|
||||
s = s
|
||||
@signals.push s unless @signals.include? s
|
||||
end
|
||||
|
||||
def main max = nil, range = nil
|
||||
|
@ -85,6 +89,7 @@ class RobustServer
|
|||
retry if retries.retry?
|
||||
$stderr.print "Zuviele Fehler in zu kurzer Zeit. Ich gebe auf und "
|
||||
end
|
||||
$stderr.puts "Unbeachtete Signale: #{@signals.map(&Signal.method(:[])).join( ', ')}"
|
||||
trapping
|
||||
$stderr.puts "Beende mich selbst."
|
||||
end
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{robustserver}
|
||||
s.version = "0.0.0"
|
||||
s.version = "0.0.0.1"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Denis Knauf"]
|
||||
s.date = %q{2010-03-02}
|
||||
s.date = %q{2010-03-07}
|
||||
s.description = %q{Protects your Server against SIGS and unplaned exceptions}
|
||||
s.email = %q{Denis.Knauf@gmail.com}
|
||||
s.extra_rdoc_files = [
|
||||
|
|
Loading…
Add table
Reference in a new issue