Skip to content

Sequence & Class Diagram

John Park edited this page Apr 14, 2026 · 3 revisions

목차


sequenceDiagram

  

  

actor Developer

  

participant WAS as WebAppServer

  

participant Srv as Server

  

participant STM as ShutdownTasksManager

  

participant WS as WebService

  

participant HPH as HttpProtocolHandler

  

participant AEP as AbstractEndpoint

  

participant ACC as Acceptor

  

participant EXE as Executor

  

participant AST as AbstractSocketTask

  

participant CH as ConnectionHandler

  

participant PR as ProcessorRecycler

  

participant AHP as AbstractHttpProcessor<br/>(org.dochi.internal)

  

participant IADP as InternalAdapter<br/>(org.dochi.connector)

  

participant API as HttpApiHandler<br/>(org.dochi.external)

  

actor Client

  

rect rgb(220, 235, 255)

  

note over Developer,EXE: 1. Server Startup (Startup)

  

  

Developer->>WAS: new WebAppServer(port) / start()

  

WAS->>Srv: getServer() / start()

  

note over Srv: AbstractLifecycle.start()<br/>if state == NEW, init() is called first

  

  

Srv->>Srv: initInternal() - propagateLifecycles(init)

  

Srv->>WS: init() - initInternal()

  

WS->>WS: Create WebResourceProvider

  

WS->>WS: Iterate HttpApiHandler - handler.init(webServiceProperty)

  

  

Srv->>HPH: init() - initInternal()

  

HPH->>AEP: setHandler(new ConnectionHandler())

  

HPH->>AEP: init() - initInternal()

  

AEP->>AEP: Create Acceptor

  

AEP->>AEP: bind(host:port)

  

AEP->>AEP: Initialize ThreadPoolConfig, SocketConfig, SocketTaskPool

  

  

Srv->>Srv: startInternal()

  

Srv->>STM: addShutdownHook(serverShutdownHook)

  

Srv->>Srv: propagateLifecycles(start)

  

Srv->>WS: start() - startInternal() [no-op]

  

Srv->>HPH: start() - startInternal()

  

HPH->>AEP: start() - startInternal()

  

AEP->>AEP: createExecutor() - Executor / VirtualThreads creation

  

AEP->>ACC: new Thread(acceptor).start()

  

note right of ACC: Acceptor thread loop waiting

  

  

end

  

  

rect rgb(220, 255, 230)

  

note over Client,AEP: 2. Accept Client Connection (Acceptor Thread)

  

  

Client->>ACC: TCP connect

  

ACC->>AEP: serverSocketAccept()

  

AEP-->>ACC: return socket

  

ACC->>AEP: processSocketTask(socket)

  

end

  
  

rect rgb(255, 250, 210)

  

note over AEP,CH: 3. Transform a network-level task into an application-level task, then run it

  
  
  

AEP->>AEP: SocketTask.reset(socket) / new SocketTask(socket)

  

note over EXE: When using ThreadPoolExecutor (default)<br/>Expand/shrink based on min~max thread pool size<br/>If exceeded max, enqueue into ScalableTaskQueue

  

AEP->>EXE: executor.execute(socketTask)

  

note over EXE,AST: 1 Worker Thread run 1 Socket Task

  

EXE->>AST: Worker Thread - run() → doRun()

  

note over AST,CH: 1 Socket Task : 1 ConnectionHandler

  

AST->>CH: handler.process(socketWrapper)

  

  

end

  

  

rect rgb(255, 235, 210)

  

note over CH,API: 4. ConnectionHandler.process() - Handling based on Socket Connection State

  

  

loop while (SocketState != CLOSED)

  

  

CH->>PR: processorRecycler.getProcessor(HTTP/1.1)

  

PR-->>CH: AbstractHttpProcessor - pollFirst() or new instance

  

  

CH->>AHP: processor.process(socketWrapper)

  

activate AHP

  

AHP->>AHP: start service(socketWrapper)

  

  

note over AHP,API: 5. AbstractHttpProcessor.service() - Independent request processing in HTTP version

  

  

loop Http11Processor.service() - while (isKeepAlive)

  

AHP->>AHP: socketWrapper.setConnectionTimeout(keepAliveTimeout)

  

AHP->>AHP: Http11inputBuffer.parseHeader(internal.Request)

  

AHP-->>AHP: true(success) / false(EOF - return CLOSED)

  

  

alt HTTP Upgrade request h2c

  

AHP-->>CH: SocketState.UPGRADING

  

note over CH: UPGRADING - exit while loop (currently no HTTP/2 support)

  

end

  

  

AHP->>AHP: shouldKeepAlive(socketWrapper)<br/>- set Connection/Keep-Alive headers<br/>- if false, schedule loop termination

  

  

AHP->>IADP: adapter.service(internal.Request, internal.Response)

  

IADP->>IADP: ensureRequestFacade() - create or reuse connector.Request wrapping internal.Request

  

IADP->>IADP: ensureResponseFacade() - create or reuse connector.Response wrapping internal.Response

  

IADP->>API: httpApiHandler.service(request, response)

  

API->>API: method dispatch - get/post/put/patch/delete

  

API->>IADP: commit HTTP response message

  

IADP->>AHP: commit

  

AHP->>AHP: serialize and send HTTP response

  

AHP-->>IADP: return

  

IADP->>IADP: connector.Request.recycle()

  

IADP->>IADP: connector.Response.recycle()

  

IADP-->>AHP: return

  

  

AHP->>AHP: ensure HTTP response fully sent

  

AHP->>AHP: internal.Request.recycle()

  

AHP->>AHP: internal.Response.recycle()

  

end

  

  

AHP-->>CH: SocketState.CLOSED/UPGRADING/...

  

  

alt IllegalArgumentException

  

note over AHP: parsing or input error

  

AHP->>AHP: 400 BAD_REQUEST → Client

  

else SocketTimeoutException

  

note over AHP: timeout set by java.net.Socket.setSoTimeout()

  

AHP->>AHP: 408 REQUEST_TIMEOUT → Client

  

else SocketException

  

note over AHP: IGNORE - read/write after Client disconnect

  

else Throwable

  

note over AHP: internal server error

  

AHP->>AHP: 500 INTERNAL_SERVER_ERROR → Client

  

end

  

  

AHP-->>CH: SocketState.CLOSED

  

deactivate AHP

  

  

CH->>AHP: processor.recycle()

  

CH->>PR: release(processor)

  

PR->>PR: httpProcessorPool.addFirst()

  

PR-->>CH: return

  

CH-->>AST: SocketState.CLOSED

  

  

end

  

end

  

  

rect rgb(255, 215, 215)

  

note over AEP,Client: 6. Disconnection and Socket Task Release

  

  

AST->>AST: socketWrapper.close()

  

AST->>Client: TCP disconnect

  

AST->>AEP: socketTaskPool.addFirst(socketTask)

  

  

end

  

  

rect rgb(230, 225, 255)

  

note over Developer,ACC: 7. Server Shutdown

  

  

Developer->>WAS: stop()

  

WAS->>Srv: stop() - stopInternal()

  

note over Srv: propagateLifecycles(stop) first, then remove ShutdownHook

  

  

Srv->>WS: stop() - stopInternal() [no-op]

  

Srv->>HPH: stop() - stopInternal()

  

HPH->>AEP: stop() - stopInternal()

  

AEP->>ACC: acceptor.close() - running=false + closeServerSocket()

  

note right of ACC: Acceptor thread loop terminated

  

AEP->>EXE: shutdownExecutor() - shutdownNow() + awaitTermination(3s)

  

  

Srv->>STM: removeShutdownHook(serverShutdownHook)

  

note over Srv: AbstractLifecycle.stop() finally block - destroy() automatically called

  

Srv->>Srv: destroyInternal() - propagateLifecycles(destroy)

  

  

Srv->>WS: destroy() - destroyInternal()

  

WS->>WS: iterate HttpApiHandler - handler.destroy()

  

  

Srv->>HPH: destroy() - destroyInternal()

  

HPH->>AEP: destroy() - destroyInternal()

  

AEP->>AEP: unbound()

  

  

end
Loading
classDiagram

  

direction TB

  

  

%% ══════════════════════════════════════════════════════════════

  

%% lifecycle (org.dochi.webserver.lifecycle)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace lifecycle {

  

  

class Lifecycle {

  

<<interface>>

  

+init()

  

+start()

  

+stop()

  

+destroy()

  

+addLifecycle(Lifecycle)

  

+addLifecycle(int, Lifecycle)

  

+getLifecycles() Lifecycle[]

  

}

  

  

class AbstractLifecycle {

  

<<abstract>>

  

-List~Lifecycle~ lifecycles

  

-volatile State state

  

+getState() State

  

#initInternal()*

  

#startInternal()*

  

#stopInternal()*

  

#destroyInternal()*

  

#propagateLifecycles(LifecycleAction)

  

}

  

  

class LifecycleException {

  

+LifecycleException(String)

  

+LifecycleException(String, Throwable)

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% bootstrap (org.dochi.webserver.bootstrap)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace bootstrap {

  

  

class WebAppServer {

  

-int port

  

-String hostName

  

-WebService webService

  

-SocketProperty socket

  

-ThreadPoolProperty threadPool

  

-HttpProperty http

  

+start()

  

+stop()

  

+getServer() Server

  

+getWebService() WebService

  

+getSocket() SocketProperty

  

+getThreadPool() ThreadPoolProperty

  

+getHttp() HttpProperty

  

}

  

  

class Server {

  

-Thread serverShutdownHook

  

+setWebService(WebService)

  

+setHttpProtocolHandler(HttpProtocolHandler)

  

}

  

  

class WebService {

  

-services : Map~String, HttpApiHandler~

  

-String rootResourcePath

  

+addService(path, handler) WebService

  

+getService(path) HttpApiHandler

  

+getSize() int

  

}

  

  

class ShutdownTasksManager {

  

<<Singleton>>

  

+addShutdownHook(Runnable)

  

+removeShutdownHook(Runnable)

  

+getShutdownHookCount() int

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% net (org.dochi.net)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace net {

  

  

class AbstractEndpoint {

  

<<abstract>>

  

#int port

  

#String hostName

  

#Handler handler

  

#Executor executor

  

#Acceptor acceptor

  

#Thread acceptorThread

  

#Deque~AbstractSocketTask~ socketTaskPool

  

+processSocketTask(S) boolean

  

+setHandler(Handler)

  

+setSocketConfig(SocketConfig)

  

+setThreadPoolConfig(ThreadPoolConfig)

  

#bind()*

  

#serverSocketAccept()*

  

#wrapSocket(S)* AbstractSocketWrapper

  

#createSocketTask(AbstractSocketWrapper)* AbstractSocketTask

  

#closeServerSocket()*

  

}

  

  

class BioEndpoint {

  

-ServerSocket serverSocket

  

#bind()

  

+serverSocketAccept() Socket

  

#wrapSocket(Socket) BioSocketWrapper

  

#createSocketTask(wrapper) BioSocketTask

  

+closeServerSocket()

  

}

  

  

class Acceptor {

  

-volatile boolean running

  

-AbstractEndpoint endpoint

  

+run()

  

+close()

  

}

  

  

class AbstractSocketWrapper {

  

<<abstract>>

  

-int keepAliveCount

  

+read(byte[], int, int)* int

  

+write(byte[], int, int)*

  

+flush()*

  

+isConnected()* boolean

  

+isClosed()* boolean

  

+incrementKeepAliveCount() int

  

+setConnectionTimeout(int)

  

+setReceiveBufferSize(int)

  

+setSendBufferSize(int)

  

+getKeepAliveTimeout() int

  

+getMaxKeepAliveRequests() int

  

+close()*

  

}

  

  

class BioSocketWrapper {

  

-Socket socket

  

+read(byte[], int, int) int

  

+write(byte[], int, int)

  

+flush()

  

+isConnected() boolean

  

+isClosed() boolean

  

+close()

  

}

  

  

class AbstractSocketTask {

  

<<abstract>>

  

-AbstractSocketWrapper socketWrapper

  

+reset(AbstractSocketWrapper)

  

+run()

  

#doRun()*

  

}

  

  

class BioSocketTask {

  

#doRun()

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% thread (org.dochi.thread)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace thread {

  

  

class ScalableTaskQueue {

  

+forceOffer(Runnable) boolean

  

+offer(Runnable) boolean

  

}

  

  

class ForceTaskQueuePolicy {

  

+rejectedExecution(Runnable, ThreadPoolExecutor)

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% internal (org.dochi.internal + .buffer + .http11)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace internal {

  

  

class RequestLifecycle {

  

<<interface>>

  

+setInputBuffer(InputBuffer)

  

+recycle()

  

}

  

  

class ResponseLifecycle {

  

<<interface>>

  

+setOutputStream(OutputStream)

  

+recycle()

  

}

  

  

class HttpProtocolHandler {

  

-AbstractEndpoint endpoint

  

-Adapter adapter

  

-HttpConfig config

  

+setAdapter(Adapter)

  

+setHttpConfig(HttpConfig)

  

+setSocketConfig(SocketConfig)

  

+setThreadPoolConfig(ThreadPoolConfig)

  

}

  

  

class ConnectionHandler {

  

-ProcessorRecycler processorRecycler

  

+process(AbstractSocketWrapper) SocketState

  

}

  

  

class ProcessorRecycler {

  

-ConcurrentLinkedDeque~Http11Processor~ http11Pool

  

+getProcessor() HttpProcessor

  

+release(HttpProcessor)

  

}

  

  

class HttpProcessor {

  

<<interface>>

  

+process(AbstractSocketWrapper) SocketState

  

+recycle()

  

}

  

  

class AbstractHttpProcessor {

  

<<abstract>>

  

#internal.Request request

  

#internal.Response response

  

#Adapter adapter

  

+process(AbstractSocketWrapper) SocketState

  

#service(AbstractSocketWrapper)* SocketState

  

+recycle()

  

}

  

  

class internal.Request {

  

-HeaderBytes method

  

-HeaderBytes requestPath

  

-HeaderBytes queryString

  

-HeaderBytes uri

  

-HeaderBytes protocol

  

-Headers headers

  

-RequestLifecycle facade

  

+setInputBuffer(InputBuffer)

  

+recycle()

  

+getFacade() RequestLifecycle

  

+setFacade(RequestLifecycle)

  

+getContentType() String

  

+getContentLength() int

  

+getCharacterEncoding() String

  

}

  

  

class internal.Response {

  

-OutputStream out

  

-ResponseHeaders headers

  

-ResponseLifecycle facade

  

+setOutputStream(OutputStream)

  

+setStatus(HttpStatus)

  

+setConnection(String)

  

+setContentType(String)

  

+setContentLength(int)

  

+setCookie(String)

  

+addHeader(String, String)

  

+commit()

  

+commitMessage(byte[])

  

+flush()

  

+recycle()

  

+getFacade() ResponseLifecycle

  

+setFacade(ResponseLifecycle)

  

}

  

  

class Headers {

  

-HeaderField[] headers

  

-int count

  

-int len

  

+createHeader() HeaderField

  

+size() int

  

+getHeader(name) String

  

+getValue(name) HeaderBytes

  

+recycle()

  

}

  

  

class HeaderField {

  

-HeaderBytes name

  

-HeaderBytes value

  

+name() HeaderBytes

  

+getValue() HeaderBytes

  

+recycle()

  

+toString() String

  

}

  

  

class HeaderBytes {

  

-ByteChunk byteChunk

  

-int type

  

-String strValue

  

-int intValue

  

-boolean hasIntValue

  

+setBytes(byte[], int, int)

  

+getByteChunk() ByteChunk

  

+isNull() boolean

  

+getLength() int

  

+toString() String

  

+toInt() int

  

+setString(String)

  

+toByte()

  

+setCharset(Charset)

  

+getCharset() Charset

  

+equalsIgnoreCase(String) boolean

  

+recycle()

  

}

  

  

class ByteChunk {

  

-Charset charset

  

-byte[] buffer

  

-int start

  

-int end

  

+setBytes(byte[], int, int)

  

+setCharset(Charset)

  

+getBuffer() byte[]

  

+getLength() int

  

+getStart() int

  

+getEnd() int

  

+getCharset() Charset

  

+toString() String

  

+toInt() int

  

+equalsIgnoreCase(String) boolean

  

+recycle()

  

}

  

  

class InputBuffer {

  

<<interface>>

  

+doRead(ApplicationBufferHandler) int

  

+init(AbstractSocketWrapper)

  

+recycle()

  

}

  

  

class TmpBufferedOutputStream {

  

-AbstractSocketWrapper socketWrapper

  

-byte[] buffer

  

-int bufferPosition

  

+init(AbstractSocketWrapper)

  

+write(int)

  

+flush()

  

+recycle()

  

}

  

  

class Http11Processor {

  

-Http11InputBuffer inputBuffer

  

-TmpBufferedOutputStream tempBufferOutputStream

  

#service(AbstractSocketWrapper) SocketState

  

-shouldKeepAlive(wrapper) boolean

  

+recycle()

  

}

  

  

class Http11InputBuffer {

  

-ByteBuffer buffer

  

-SocketInputBuffer socketInputBuffer

  

-Http11Parser parser

  

+init(AbstractSocketWrapper)

  

+parseHeader(internal.Request) boolean

  

+doRead(ApplicationBufferHandler) int

  

+recycle()

  

}

  

  

class Http11Parser {

  

+parseRequestLine(internal.Request) boolean

  

+parseHeaders(internal.Request) boolean

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% connector (org.dochi.connector)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace connector {

  

  

class Adapter {

  

<<interface>>

  

+service(internal.Request, internal.Response)

  

}

  

  

class InternalAdapter {

  

-WebService webService

  

-HttpConfig httpConfig

  

+service(internal.Request, internal.Response)

  

-ensureRequestFacade(req) connector.Request

  

-ensureResponseFacade(res) connector.Response

  

}

  

  

class RequestFacade {

  

<<abstract>>

  

#internal.Request request

  

#connector.InputBuffer inputBuffer

  

+setInputBuffer(InputBuffer)

  

+recycle()

  

}

  

  

class ResponseFacade {

  

<<abstract>>

  

#internal.Response response

  

#OutputStream out

  

+setOutputStream(OutputStream)

  

+recycle()

  

}

  

  

class connector.InputBuffer {

  

-InputBuffer inputbuffer

  

-ByteBuffer buffer

  

-boolean isClosed

  

+setInputBuffer(InputBuffer)

  

+setByteBuffer(ByteBuffer)

  

+getByteBuffer() ByteBuffer

  

+read() int

  

+read(byte[]) int

  

+read(byte[], int, int) int

  

+recycle()

  

+close()

  

}

  

  

class InternalInputStream {

  

-connector.InputBuffer inputBuffer

  

+read() int

  

+read(byte[]) int

  

+read(byte[], int, int) int

  

+close()

  

}

  

  

class connector.Request {

  

-Parameters parameters

  

-Multipart multipart

  

-InternalInputStream inputStream

  

-boolean parametersParsed

  

-boolean multipartParsed

  

+getMethod() String

  

+getPath() String

  

+getRequestURI() String

  

+getQueryString() String

  

+getProtocol() String

  

+getHeader(name) String

  

+getContentType() String

  

+getContentLength() int

  

+getCharacterEncoding() String

  

+getParameter(name) String

  

+getPart(name) Part

  

+getInputStream() InputStream

  

+recycle()

  

}

  

  

class connector.Response {

  

-HttpResConfig httpResConfig

  

+setStatus(HttpStatus) ExternalResponse

  

+setHeader(name, value) ExternalResponse

  

+setCookie(String) ExternalResponse

  

+setConnection(String) ExternalResponse

  

+setContentType(String) ExternalResponse

  

+setContentLength(int) ExternalResponse

  

+send()

  

+send(byte[], String)

  

+send(String, String)

  

+sendError(HttpStatus)

  

+sendError(HttpStatus, String)

  

+getOutputStream() OutputStream

  

+getStatus() HttpStatus

  

+recycle()

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% external (org.dochi.external)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace external {

  

  

class ExternalRequest {

  

<<interface>>

  

+getMethod() String

  

+getRequestURI() String

  

+getPath() String

  

+getQueryString() String

  

+getProtocol() String

  

+getHeader(name) String

  

+getContentType() String

  

+getContentLength() int

  

+getParameter(name) String

  

+getCharacterEncoding() String

  

+getPart(name) Part

  

+getInputStream() InputStream

  

}

  

  

class ExternalResponse {

  

<<interface>>

  

+setStatus(HttpStatus) ExternalResponse

  

+setHeader(name, value) ExternalResponse

  

+setCookie(String) ExternalResponse

  

+setConnection(String) ExternalResponse

  

+setContentType(String) ExternalResponse

  

+setContentLength(int) ExternalResponse

  

+send()

  

+send(byte[], String)

  

+send(String, String)

  

+sendError(HttpStatus)

  

+sendError(HttpStatus, String)

  

+getOutputStream() OutputStream

  

+getStatus() HttpStatus

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% api_handler (org.dochi.api.handler)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace api_handler {

  

  

class HttpApiHandler {

  

<<interface>>

  

+init(WebServiceConfig)

  

+service(ExternalRequest, ExternalResponse)

  

+destroy()

  

}

  

  

class AbstractHttpApiHandler {

  

<<abstract>>

  

#WebResourceProvider webResourceProvider

  

+init(WebServiceConfig)

  

+service(ExternalRequest, ExternalResponse)

  

#doGet(req, res)

  

#doPost(req, res)

  

#doPut(req, res)

  

#doPatch(req, res)

  

#doDelete(req, res)

  

}

  

  

class DefaultHttpApiHandler {

  

+doGet(req, res)

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% webresource (org.dochi.webresource)

  

%% ══════════════════════════════════════════════════════════════

  

  

namespace webresource {

  

  

class WebResourceProvider {

  

-Path rootPath

  

+getResource(path) Resource

  

}

  

  

class Resource {

  

-byte[] data

  

-String mimeType

  

+getData() byte[]

  

+getContentType(parameter) String

  

+isEmpty() boolean

  

}

  

  

class ResourceType {

  

<<enumeration>>

  

HTML

  

CSS

  

JS

  

PNG

  

+fromMimeType(String) ResourceType

  

+getContentType(String) String

  

}

  

  

}

  

  

%% ══════════════════════════════════════════════════════════════

  

%% Relationships

  

%% ══════════════════════════════════════════════════════════════

  

  

%% lifecycle

  

Lifecycle <|.. AbstractLifecycle

  

AbstractLifecycle <|-- Server

  

AbstractLifecycle <|-- WebService

  

AbstractLifecycle <|-- HttpProtocolHandler

  

AbstractLifecycle <|-- AbstractEndpoint

  

  

%% bootstrap

  

WebAppServer --> Server : creates & starts

  

WebAppServer --> WebService : owns

  

WebAppServer --> HttpProtocolHandler : configures

  

Server --> WebService : manages lifecycle

  

Server --> HttpProtocolHandler : manages lifecycle

  

Server --> ShutdownTasksManager : registers hook

  

  

%% net

  

AbstractEndpoint <|-- BioEndpoint

  

AbstractSocketWrapper <|-- BioSocketWrapper

  

AbstractSocketTask <|-- BioSocketTask

  

BioEndpoint --> Acceptor : creates & runs

  

BioEndpoint --> BioSocketWrapper : wraps socket

  

BioEndpoint --> BioSocketTask : creates

  

  

%% thread

  

AbstractEndpoint --> ScalableTaskQueue : uses in ThreadPoolExecutor

  

ScalableTaskQueue --> ForceTaskQueuePolicy : paired with

  

  

%% internal — ProtocolHandler

  

HttpProtocolHandler --> AbstractEndpoint : wraps

  

HttpProtocolHandler --> ConnectionHandler : uses

  

HttpProtocolHandler --> ProcessorRecycler : uses

  

ConnectionHandler --> ProcessorRecycler : uses

  

ProcessorRecycler --> Http11Processor : pools LIFO

  

  

%% internal — Context interfaces

  

RequestLifecycle <|.. RequestFacade

  

ResponseLifecycle <|.. ResponseFacade

  

  

%% internal — Processor

  

HttpProcessor <|.. AbstractHttpProcessor

  

AbstractHttpProcessor <|-- Http11Processor

  

AbstractHttpProcessor *-- internal.Request

  

AbstractHttpProcessor *-- internal.Response

  

  

%% internal — Header structure

  

internal.Request *-- Headers

  

internal.Request --> HeaderBytes : method, path, uri, queryString, protocol

  

Headers *-- HeaderField

  

HeaderField *-- HeaderBytes

  

HeaderBytes *-- ByteChunk

  

  

%% internal — buffer / http11

  

Http11Processor --> Http11InputBuffer : uses

  

Http11Processor --> TmpBufferedOutputStream : uses

  

Http11InputBuffer --> Http11Parser : delegates

  

InputBuffer <|.. Http11InputBuffer

  

  

%% internal — facade back-reference

  

internal.Request --> RequestLifecycle : holds facade ref

  

internal.Response --> ResponseLifecycle : holds facade ref

  

  

%% connector — inheritance

  

Adapter <|.. InternalAdapter

  

RequestFacade <|-- connector.Request

  

ResponseFacade <|-- connector.Response

  

  

%% connector — InputBuffer & InputStream

  

RequestFacade *-- connector.InputBuffer

  

connector.InputBuffer --> InputBuffer : delegates doRead

  

InternalInputStream --> connector.InputBuffer : delegates reads

  

connector.Request --> InternalInputStream : creates on demand

  

  

%% connector

  

InternalAdapter --> WebService : routes by path

  

InternalAdapter --> connector.Request : ensure facade

  

InternalAdapter --> connector.Response : ensure facade

  

connector.Request ..|> ExternalRequest

  

connector.Response ..|> ExternalResponse

  

  

%% api_handler

  

HttpApiHandler <|.. AbstractHttpApiHandler

  

AbstractHttpApiHandler <|-- DefaultHttpApiHandler

  

AbstractHttpApiHandler --> WebResourceProvider : uses

  

WebService --> HttpApiHandler : dispatches

  

  

%% webresource

  

WebResourceProvider --> Resource : provides

  

Resource --> ResourceType : references
Loading

3. 핵심 클래스 & 인터페이스 역할 설명

클래스 설명
HttpApiHandler HTTP API 핸들러 인터페이스 (init, service, destroy)
AbstractHttpApiHandler HTTP 메서드별 분기 처리 추상 클래스
DefaultHttpApiHandler 정적 리소스 서빙 기본 핸들러
Adapter 고수준 HTTP API로 연결하는 인터페이스
InternalAdapter 저수준 요청/응답 객체를 고수준 객체로 래핑해서 HTTP API를 호출
RequestFacade 고수준 요청 객체의 추상화 (저수준 요청 객체 내장)
ResponseFacade 고수준 응답 객체의 추상화 (저수준 요청 객체 내장)
connector.Request 고수준 요청 객체 (RequestFacade 상속과 ExternalRequest 구현)
connector.Response 고수준 응답 객체 (ResponseFacade 상속과 ExternalResponse 구현)
ExternalRequest 개발자에게 노출되는 HTTP 요청 인터페이스
ExternalResponse 개발자에게 노출되는 HTTP 응답 인터페이스
internal.Request 저수준 요청 객체
internal.Response 저수준 응답 객체
RequestLifecycle 요청 객체에서 구현하는 공통의 입력 버퍼링 및 파싱 객체 주입과 재사용 인터페이스
ResponseLifecycle 응답 객체에서 구현하는 공통의 출력 버퍼링 및 직렬화 객체 주입과 재사용 인터페이스
HttpProcessor 독립적인 HTTP 요청 처리 단위 인터페이스
AbstractHttpProcessor 독립적인 HTTP 요청 처리 및 예외에 따른 응답 공통 로직 추상 클래스
HttpProtocolHandler Endpoint/Adapter/Processor를 조합, HTTP 프로토콜 버전에 따른 요청 처리 객체 핸들링
ConnectionHandler 소켓 연결 상태에 따라 요청 핸들링
ProcessorRecycler Http11Processor를 LIFO 방식으로 풀링하여 재사용
InputBuffer 소켓으로부터 입력 버퍼링을 수행하는 인터페이스
ApplicationBufferHandler 입력 버퍼링 객체가 호출자의 ByteBuffer를 역제어하기 위한 인터페이스
TmpBufferedOutputStream 응답 데이터를 내부 버퍼에 모아 소켓에 일괄 출력 (임시 객체, 추후 리팩토링)
Http11Processor HTTP/1.1 요청 처리 및 Keep-Alive 루프 관리
Http11InputBuffer 헤더 전체 버퍼링 및 바디 버퍼 통합 관리, 파서에 데이터 제공
Http11Parser 바이트 단위로 요청 라인과 헤더 필드 파싱
AbstractEndpoint 네트워크 단위에서 애플리케이션 처리 단위로 변환해서 실행 (워커 스레드풀, Acceptor 공통 로직 추상화)
AbstractSocketWrapper 소켓 read/write/close 추상화
AbstractSocketTask 소켓 작업 실행 단위 추상 클래스
BioEndpoint java.net.ServerSocket 기반 BIO Endpoint 구현체
BioSocketWrapper java.net.Socket 기반 BIO SocketWrapper 구현체
Acceptor 서버 소켓의 accept 루프 실행
ScalableTaskQueue 유휴 스레드 여부에 따라 최소 ~ 최대 크기 동적 확장을 유도하는 큐
ForceTaskQueuePolicy 최대 스레드 풀 크기 도달 후 reject된 작업을 큐에 강제 적재하는 핸들러
WebResourceProvider 루트 디렉터리 또는 Embedded JAR에서 정적 리소스 탐색 및 제공
WebAppServer WAS 설정 진입점, 모든 컴포넌트를 조립하고 start/stop 제공
Server WAS 인스턴스의 구성 요소인 WebService와 HttpProtocolHandler의 라이프사이클 루트
WebService 경로별 HttpApiHandler 등록과 라이프사이클 관리
ShutdownTasksManager JVM 종료 시 실행할 Shutdown 작업을 관리하는 싱글톤 객체
ShutdownTasksProcessor Shutdown 작업 목록을 저장하고 순차대로 처리자
Lifecycle init/start/stop/destroy 상태 전이 인터페이스
AbstractLifecycle 상태 동기화, 라이프사이클 전파, 실패 시 롤백 공통 구현
LifecycleException 라이프사이클 상태 전이 실패 예외

Clone this wiki locally