arya-pandemic 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,8 +2,8 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('pandemic', '0.4.0') do |p|
6
- p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
5
+ Echoe.new('pandemic', '0.4.1') do |p|
6
+ p.description = "A framework for distributing work for real-time services and offline tasks."
7
7
  p.url = "https://github.com/arya/pandemic/"
8
8
  p.author = "Arya Asemanfar"
9
9
  p.email = "aryaasemanfar@gmail.com"
@@ -1,10 +1,10 @@
1
1
  module Pandemic
2
2
  module ClientSide
3
3
  class ClusterConnection
4
- class NotEnoughConnectionsTimeout < Exception; end
5
- class NoNodesAvailable < Exception; end
6
- class LostConnectionToNode < Exception; end
7
- class NodeTimedOut < Exception; end
4
+ class NotEnoughConnectionsTimeout < StandardError; end
5
+ class NoNodesAvailable < StandardError; end
6
+ class LostConnectionToNode < StandardError; end
7
+ class NodeTimedOut < StandardError; end
8
8
 
9
9
  include Util
10
10
  def initialize
@@ -1,7 +1,7 @@
1
1
  module Pandemic
2
2
  class ConnectionPool
3
- class TimedOutWaitingForConnectionException < Exception; end
4
- class CreateConnectionUndefinedException < Exception; end
3
+ class TimedOutWaitingForConnectionException < StandardError; end
4
+ class CreateConnectionUndefinedException < StandardError; end
5
5
  include Util
6
6
  def initialize(options = {})
7
7
  @connected = false
@@ -62,7 +62,7 @@ module Pandemic
62
62
  info("Connection to client lost")
63
63
  close_connection
64
64
  rescue Exception => e
65
- warn("Unhandled exception in client listen thread: #{e.inspect}")
65
+ warn("Unhandled exception in client listen thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
66
66
  ensure
67
67
  @current_request.cancel! if @current_request
68
68
  @server.client_closed(self)
@@ -1,7 +1,7 @@
1
1
  module Pandemic
2
2
  module ServerSide
3
3
  class Peer
4
- class PeerUnavailableException < Exception; end
4
+ class PeerUnavailableException < StandardError; end
5
5
  include Util
6
6
  attr_reader :host, :port
7
7
 
@@ -69,7 +69,7 @@ module Pandemic
69
69
  end
70
70
  end
71
71
  rescue Exception => e
72
- warn("Unhandled exception in peer listener thread: #{e.inspect}")
72
+ warn("Unhandled exception in peer listener thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
73
73
  ensure
74
74
  debug("Incoming connection closing")
75
75
  conn.close if conn && !conn.closed?
@@ -103,7 +103,7 @@ module Pandemic
103
103
  retry
104
104
  end
105
105
  rescue Exception => e
106
- warn("Unhandled exception in create connection block: #{e.inspect}")
106
+ warn("Unhandled exception in create connection block:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
107
107
  end
108
108
  if connection
109
109
  connection.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if TCP_NO_DELAY_AVAILABLE
@@ -128,7 +128,7 @@ module Pandemic
128
128
  # TODO: what to do here?
129
129
  return false
130
130
  rescue Exception => e
131
- warn("Unhandled exception in incoming request read: #{e.inspect}")
131
+ warn("Unhandled exception in incoming request read:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
132
132
  end
133
133
  debug("Processing body")
134
134
  process_request(hash, request_body)
@@ -153,7 +153,7 @@ module Pandemic
153
153
  # TODO: what to do here?
154
154
  return false
155
155
  rescue Exception => e
156
- warn("Unhandled exception in incoming response read: #{e.inspect}")
156
+ warn("Unhandled exception in incoming response read:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
157
157
  end
158
158
  process_response(hash, response_body)
159
159
  else
@@ -177,7 +177,7 @@ module Pandemic
177
177
  debug( "Finished sending response (#{hash})")
178
178
  end
179
179
  rescue Exception => e
180
- warn("Unhandled exception in process request thread: #{e.inspect}")
180
+ warn("Unhandled exception in process request thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
181
181
  end
182
182
  end
183
183
  end
@@ -194,7 +194,7 @@ module Pandemic
194
194
  warn("Original response not found (#{hash})")
195
195
  end
196
196
  rescue Exception => e
197
- warn("Unhandled exception in process response thread: #{e.inspect}")
197
+ warn("Unhandled exception in process response thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
198
198
  end
199
199
  end
200
200
  end
@@ -74,8 +74,9 @@ module Pandemic
74
74
  @listener.close if @listener
75
75
  @peers.values.each { |p| p.disconnect }
76
76
  @clients.each {|c| c.close }
77
+ self.processor.disconnect if Config.fork_for_processor
77
78
  rescue Exception => e
78
- warn("Unhandled exception in server listening thread: #{e.inspect}")
79
+ warn("Unhandled exception in server listening thread:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
79
80
  end
80
81
  end
81
82
  end
@@ -101,6 +102,7 @@ module Pandemic
101
102
  debug("Recognized as client")
102
103
  @clients_mutex.synchronize do
103
104
  @clients << Client.new(connection, self).listen
105
+ @total_clients += 1
104
106
  end
105
107
  elsif identification =~ /^stats$/
106
108
  debug("Stats request received")
@@ -110,7 +112,7 @@ module Pandemic
110
112
  connection.close # i dunno you
111
113
  end
112
114
  rescue Exception => e
113
- warn("Unhandled exception in handle connection method: #{e.inspect}")
115
+ warn("Unhandled exception in handle connection method:\n#{e.inspect}\n#{e.backtrace.join("\n")}")
114
116
  end
115
117
  end
116
118
 
@@ -132,7 +134,7 @@ module Pandemic
132
134
  begin
133
135
  request.add_response(self.process(map[signature]))
134
136
  rescue Exception => e
135
- warn("Unhandled exception in local processing: #{e.inspect}#{e.backtrace.join("\n")}}")
137
+ warn("Unhandled exception in local processing:\n#{e.inspect}#{e.backtrace.join("\n")}}")
136
138
  end
137
139
  end
138
140
  end
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pandemic}
5
- s.version = "0.4.0"
5
+ s.version = "0.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Arya Asemanfar"]
9
- s.date = %q{2009-07-06}
10
- s.description = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
9
+ s.date = %q{2009-07-12}
10
+ s.description = %q{A framework for distributing work for real-time services and offline tasks.}
11
11
  s.email = %q{aryaasemanfar@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "README.markdown"]
13
13
  s.files = ["examples/client/client.rb", "examples/client/constitution.txt", "examples/client/pandemic_client.yml", "examples/server/pandemic_server.yml", "examples/server/word_count_server.rb", "lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "Manifest", "MIT-LICENSE", "pandemic.gemspec", "Rakefile", "README.markdown", "test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{pandemic}
18
18
  s.rubygems_version = %q{1.3.4}
19
- s.summary = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
19
+ s.summary = %q{A framework for distributing work for real-time services and offline tasks.}
20
20
  s.test_files = ["test/client_test.rb", "test/connection_pool_test.rb", "test/functional_test.rb", "test/handler_test.rb", "test/mutex_counter_test.rb", "test/peer_test.rb", "test/processor_test.rb", "test/server_test.rb", "test/test_helper.rb", "test/util_test.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arya-pandemic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-06 00:00:00 -07:00
12
+ date: 2009-07-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "0"
34
34
  version:
35
- description: Distribute MapReduce to any of the workers and it will spread, like a pandemic.
35
+ description: A framework for distributing work for real-time services and offline tasks.
36
36
  email: aryaasemanfar@gmail.com
37
37
  executables: []
38
38
 
@@ -123,7 +123,7 @@ rubyforge_project: pandemic
123
123
  rubygems_version: 1.2.0
124
124
  signing_key:
125
125
  specification_version: 3
126
- summary: Distribute MapReduce to any of the workers and it will spread, like a pandemic.
126
+ summary: A framework for distributing work for real-time services and offline tasks.
127
127
  test_files:
128
128
  - test/client_test.rb
129
129
  - test/connection_pool_test.rb