Class: Baykit::BayServer::Common::VehicleRunner
- Inherits:
-
Object
- Object
- Baykit::BayServer::Common::VehicleRunner
- Includes:
- Agent
- Defined in:
- lib/baykit/bayserver/common/vehicle_runner.rb
Defined Under Namespace
Classes: AgentListener, VehicleService
Instance Attribute Summary collapse
-
#max_vehicles ⇒ Object
readonly
Returns the value of attribute max_vehicles.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
Instance Method Summary collapse
-
#init(max) ⇒ Object
Custom methods.
-
#initialize ⇒ VehicleRunner
constructor
A new instance of VehicleRunner.
- #post(agt_id, vcl) ⇒ Object
Constructor Details
#initialize ⇒ VehicleRunner
Returns a new instance of VehicleRunner.
104 105 106 107 |
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 104 def initialize @max_vehicles = 0 @services = [] end |
Instance Attribute Details
#max_vehicles ⇒ Object (readonly)
Returns the value of attribute max_vehicles.
101 102 103 |
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 101 def max_vehicles @max_vehicles end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
102 103 104 |
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 102 def services @services end |
Instance Method Details
#init(max) ⇒ Object
Custom methods
112 113 114 115 116 117 118 |
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 112 def init(max) if(max <= 0) raise Sink.new() end @max_vehicles = max GrandAgent.add_lifecycle_listener(AgentListener.new(self)) end |
#post(agt_id, vcl) ⇒ Object
120 121 122 |
# File 'lib/baykit/bayserver/common/vehicle_runner.rb', line 120 def post(agt_id, vcl) @services[agt_id - 1].submit(vcl) end |