Class: Wildnet::Server::PipeLineFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/wildnet-server/pipe_line_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ PipeLineFactory

Returns a new instance of PipeLineFactory.



16
17
18
19
20
# File 'lib/wildnet-server/pipe_line_factory.rb', line 16

def initialize app
  @executor = OrderedMemoryAwareThreadPoolExecutor.new 16, 0, 0
  @execution_handler = ExecutionHandler.new @executor
  @app = app
end

Instance Method Details

#get_pipelineObject Also known as: getPipeline



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/wildnet-server/pipe_line_factory.rb', line 22

def get_pipeline

  handler = HttpHandler.new
  handler.app = @app
  
  pipeline = Channels.pipeline

  pipeline.addLast "decoder", HttpRequestDecoder.new
  pipeline.addLast "encoder", HttpResponseEncoder.new

  pipeline.addLast "executor", @execution_handler
  pipeline.addLast "chunkedWriter", ChunkedWriteHandler.new
  pipeline.addLast "handler", handler

  pipeline

end