Added a few descriptions and comments.
This commit is contained in:
@@ -23,6 +23,7 @@ feature {NONE} -- Initialization
|
||||
feature -- Access
|
||||
|
||||
is_shutdown_requested: BOOLEAN
|
||||
-- <Precursor>
|
||||
|
||||
shutdown_requested (a_server: like server): BOOLEAN
|
||||
do
|
||||
|
||||
@@ -97,19 +97,13 @@ feature {HTTPD_SERVER_I} -- Execution
|
||||
end
|
||||
|
||||
process_handler (hdl: separate HTTPD_REQUEST_HANDLER)
|
||||
-- Process request handler `hdl' with exclusive access.
|
||||
-- Process request handler `hdl' concurrently.
|
||||
require
|
||||
hdl.is_connected
|
||||
do
|
||||
hdl.safe_execute
|
||||
end
|
||||
|
||||
separate_client_socket (hdl: separate HTTPD_REQUEST_HANDLER): separate HTTPD_STREAM_SOCKET
|
||||
-- Separate client socket from a request handler `hdl'.
|
||||
do
|
||||
Result := hdl.client_socket
|
||||
end
|
||||
|
||||
feature {HTTPD_SERVER_I} -- Status report
|
||||
|
||||
wait_for_completion
|
||||
@@ -128,6 +122,12 @@ feature {HTTPD_SERVER_I} -- Status report
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
separate_client_socket (hdl: separate HTTPD_REQUEST_HANDLER): separate HTTPD_STREAM_SOCKET
|
||||
-- Client socket for handler `hdl'.
|
||||
do
|
||||
Result := hdl.client_socket
|
||||
end
|
||||
|
||||
pool: separate CONCURRENT_POOL [HTTPD_REQUEST_HANDLER]
|
||||
-- Pool of separate connection handlers.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ inherit
|
||||
feature {CONCURRENT_POOL, HTTPD_CONNECTION_HANDLER_I} -- Basic operation
|
||||
|
||||
release
|
||||
-- <Precursor>
|
||||
local
|
||||
d: STRING
|
||||
do
|
||||
|
||||
@@ -24,24 +24,32 @@ feature {NONE} -- Initialization
|
||||
feature -- Access
|
||||
|
||||
count: INTEGER
|
||||
-- Number of concurrent items managed by Current pool.
|
||||
|
||||
capacity: INTEGER
|
||||
-- Maximum number of concurrent items managed by Current pool.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_full: BOOLEAN
|
||||
-- Pool is full?
|
||||
do
|
||||
Result := count >= capacity
|
||||
end
|
||||
|
||||
is_empty: BOOLEAN
|
||||
-- No concurrent item waiting in current pool.
|
||||
do
|
||||
Result := count = 0
|
||||
end
|
||||
|
||||
capacity: INTEGER
|
||||
|
||||
stop_requested: BOOLEAN
|
||||
-- Current pool received a request to terminate.
|
||||
|
||||
feature -- Access
|
||||
|
||||
separate_item (a_factory: separate CONCURRENT_POOL_FACTORY [G]): detachable separate G
|
||||
-- Reused, or new separate item of type {G} created by `a_factory'.
|
||||
require
|
||||
is_not_full: not is_full
|
||||
local
|
||||
@@ -94,6 +102,7 @@ feature -- Access
|
||||
feature -- Basic operation
|
||||
|
||||
gracefull_stop
|
||||
-- Request the Current pool to terminate.
|
||||
do
|
||||
stop_requested := True
|
||||
end
|
||||
@@ -101,8 +110,10 @@ feature -- Basic operation
|
||||
feature {NONE} -- Internal
|
||||
|
||||
items: SPECIAL [detachable separate G]
|
||||
-- List of concurrent items.
|
||||
|
||||
busy_items: SPECIAL [BOOLEAN]
|
||||
-- Map of items being proceed.
|
||||
|
||||
feature {CONCURRENT_POOL_ITEM} -- Change
|
||||
|
||||
@@ -140,6 +151,7 @@ feature {CONCURRENT_POOL_ITEM} -- Change
|
||||
feature -- Change
|
||||
|
||||
set_count (n: INTEGER)
|
||||
-- Set capacity of Current pool to `n'.
|
||||
local
|
||||
g: detachable separate G
|
||||
do
|
||||
@@ -149,6 +161,7 @@ feature -- Change
|
||||
end
|
||||
|
||||
terminate
|
||||
-- Terminate current pool.
|
||||
local
|
||||
l_items: like items
|
||||
do
|
||||
@@ -159,6 +172,7 @@ feature -- Change
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
register_item (a_item: separate G)
|
||||
-- Adopt `a_item' in current pool.
|
||||
do
|
||||
a_item.set_pool (Current)
|
||||
end
|
||||
|
||||
@@ -25,6 +25,7 @@ feature {CONCURRENT_POOL} -- Change
|
||||
feature {CONCURRENT_POOL, HTTPD_CONNECTION_HANDLER_I} -- Basic operation
|
||||
|
||||
release
|
||||
-- Release Current pool item from associated pool.
|
||||
do
|
||||
if attached pool as p then
|
||||
pool_release (p)
|
||||
|
||||
Reference in New Issue
Block a user