Package net.officefloor.server.http
Class HttpServerSocketManagedObjectSource
java.lang.Object
net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource<O,F>
net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource<None,Indexed>
net.officefloor.server.http.HttpServerSocketManagedObjectSource
- All Implemented Interfaces:
ManagedFunction<Indexed,,None> ThreadCompletionListener,ManagedObjectSource<None,Indexed>
@PrivateSource
public class HttpServerSocketManagedObjectSource
extends AbstractManagedObjectSource<None,Indexed>
implements ManagedFunction<Indexed,None>, ThreadCompletionListener
- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested classes/interfaces inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.DependencyLabeller<K extends Enum<K>>, AbstractAsyncManagedObjectSource.ExecutionLabeller, AbstractAsyncManagedObjectSource.Labeller<K extends Enum<K>>, AbstractAsyncManagedObjectSource.MetaDataContext<O extends Enum<O>,F extends Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of theFlowto handle the request.static final StringName ofPropertyfor the maximum entity length for HTTP parsing.static final Stringstatic final StringName ofPropertyfor the maximum text length for HTTP parsing.static final StringName ofPropertyindicating if secure.static final StringName of theTeamto execute the SSL tasks.static final StringName ofSystemproperty to obtain the maximumThreadLocalStreamBufferPoolcore pool size.static final StringName ofSystemproperty to obtain the maximum number of active requests on the socket.static final StringName ofSystemproperty to obtain the maximum number of reads for aSocketChannelper select.static final StringName ofSystemproperty to obtain the memory threshold percentage.static final Stringstatic final Stringstatic final StringName ofSystemproperty to specify the number ofSocketServicerinstances.static final StringName ofSystemproperty to obtain the pooledStreamBuffersize.static final String -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor to configure fromPropertyList.HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace) Instantiate for non-secure servicing.HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, SSLContext sslContext) Instantiate for secure servicing. -
Method Summary
Modifier and TypeMethodDescriptionstatic SocketManagercreateSocketManager(ThreadFactory[] executionStrategy, Consumer<ThreadCompletionListener> threadCompletionListenerCapture) Creates theSocketManagerconfigured fromSystemproperties.voidexecute(ManagedFunctionContext<Indexed, None> context) Executes the function.protected AcceptedSocketDecoratorEnables overriding to configure theAcceptedSocketDecorator.protected ManagedObjectSynchronously obtains theManagedObject.protected ServerSocketDecoratorEnables overriding to configure aServerSocketDecorator.static booleanIndicates if there is an activeSocketManagerforHttpServerSocketManagedObjectSourceinstances.protected voidOverridden to load meta-data.protected voidOverridden to load specifications.voidstart(ManagedObjectExecuteContext<Indexed> context) Called once afterManagedObjectSource.init(ManagedObjectSourceContext)to indicate thisManagedObjectSourceshould start execution.voidNotifies that theThreadhas completed.Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObjectMethods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
getSpecification, init, stop
-
Field Details
-
SYSTEM_PROPERTY_SOCKET_LISTENER_COUNT
Name ofSystemproperty to specify the number ofSocketServicerinstances. If not specified, will default toRuntime.availableProcessors().- See Also:
-
SYSTEM_PROPERTY_STREAM_BUFFER_SIZE
Name ofSystemproperty to obtain the pooledStreamBuffersize.- See Also:
-
SYSTEM_PROPERTY_RECEIVE_BUFFER_SIZE
- See Also:
-
SYSTEM_PROPERTY_MAX_READS_ON_SELECT
Name ofSystemproperty to obtain the maximum number of reads for aSocketChannelper select.- See Also:
-
SYSTEM_PROPERTY_MAX_ACTIVE_SOCKET_REQUESTS
Name ofSystemproperty to obtain the maximum number of active requests on the socket.- See Also:
-
SYSTEM_PROPERTY_SEND_BUFFER_SIZE
- See Also:
-
SYSTEM_PROPERTY_THREADLOCAL_BUFFER_POOL_MAX_SIZE
- See Also:
-
SYSTEM_PROPERTY_CORE_BUFFER_POOL_MAX_SIZE
Name ofSystemproperty to obtain the maximumThreadLocalStreamBufferPoolcore pool size.- See Also:
-
SYSTEM_PROPERTY_MEMORY_THRESHOLD_PERCENTAGE
Name ofSystemproperty to obtain the memory threshold percentage.- See Also:
-
PROPERTY_SECURE
Name ofPropertyindicating if secure.- See Also:
-
PROPERTY_MAX_HEADER_COUNT
- See Also:
-
PROPERTY_MAX_TEXT_LENGTH
Name ofPropertyfor the maximum text length for HTTP parsing.- See Also:
-
PROPERTY_MAX_ENTITY_LENGTH
Name ofPropertyfor the maximum entity length for HTTP parsing.- See Also:
-
HANDLE_REQUEST_FLOW_NAME
Name of theFlowto handle the request.- See Also:
-
SSL_TEAM_NAME
Name of theTeamto execute the SSL tasks.- See Also:
-
-
Constructor Details
-
HttpServerSocketManagedObjectSource
public HttpServerSocketManagedObjectSource()Default constructor to configure fromPropertyList. -
HttpServerSocketManagedObjectSource
public HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace) Instantiate for non-secure servicing.- Parameters:
serverLocation-HttpServerLocation.serverName-ServerHttpHeaderValue.dateHttpHeaderClock-DateHttpHeaderClock.isIncludeEscalationStackTrace- Indicates if include theEscalationstack trace on theHttpResponse.
-
HttpServerSocketManagedObjectSource
public HttpServerSocketManagedObjectSource(HttpServerLocation serverLocation, HttpHeaderValue serverName, DateHttpHeaderClock dateHttpHeaderClock, boolean isIncludeEscalationStackTrace, SSLContext sslContext) Instantiate for secure servicing.- Parameters:
serverLocation-HttpServerLocation.serverName-ServerHttpHeaderValue.dateHttpHeaderClock-DateHttpHeaderClock.isIncludeEscalationStackTrace- Indicates if include theEscalationstack trace on theHttpResponse.sslContext-SSLContext. May benullif behind reverse proxy handling secure communication.
-
-
Method Details
-
createSocketManager
public static SocketManager createSocketManager(ThreadFactory[] executionStrategy, Consumer<ThreadCompletionListener> threadCompletionListenerCapture) throws IOException Creates theSocketManagerconfigured fromSystemproperties.- Parameters:
executionStrategy-ThreadFactoryinstances for theExecutionStrategyfor theSocketManager.threadCompletionListenerCapture- Captures theThreadCompletionListenerfor theSocketManager. May benull.- Returns:
SocketManagerconfigured fromSystemproperties.- Throws:
IOException- If fails to create theSocketManager.
-
isSocketManagerActive
public static boolean isSocketManagerActive()Indicates if there is an activeSocketManagerforHttpServerSocketManagedObjectSourceinstances.- Returns:
trueif activeSocketManager.
-
getServerSocketDecorator
protected ServerSocketDecorator getServerSocketDecorator(AbstractAsyncManagedObjectSource.MetaDataContext<None, Indexed> context) Enables overriding to configure aServerSocketDecorator.- Parameters:
context-AbstractAsyncManagedObjectSource.MetaDataContext.- Returns:
ServerSocketDecorator.
-
getAcceptedSocketDecorator
protected AcceptedSocketDecorator getAcceptedSocketDecorator(AbstractAsyncManagedObjectSource.MetaDataContext<None, Indexed> context) Enables overriding to configure theAcceptedSocketDecorator.- Parameters:
context-AbstractAsyncManagedObjectSource.MetaDataContext.- Returns:
AcceptedSocketDecorator.
-
loadSpecification
Description copied from class:AbstractAsyncManagedObjectSourceOverridden to load specifications.- Specified by:
loadSpecificationin classAbstractAsyncManagedObjectSource<None,Indexed> - Parameters:
context- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None, Indexed> context) throws ExceptionDescription copied from class:AbstractAsyncManagedObjectSourceOverridden to load meta-data.- Specified by:
loadMetaDatain classAbstractAsyncManagedObjectSource<None,Indexed> - Parameters:
context- Meta-data.- Throws:
Exception- If fails to load the meta-data.
-
start
Description copied from interface:ManagedObjectSourceCalled once after
ManagedObjectSource.init(ManagedObjectSourceContext)to indicate thisManagedObjectSourceshould start execution.On invocation of this method,
ProcessStateinstances may be invoked via theManagedObjectExecuteContext.- Specified by:
startin interfaceManagedObjectSource<None,Indexed> - Overrides:
startin classAbstractAsyncManagedObjectSource<None,Indexed> - Parameters:
context-ManagedObjectExecuteContextto use in starting thisManagedObjectSource.- Throws:
Exception- Should theManagedObjectSourcefail to start execution.
-
getManagedObject
Description copied from class:AbstractManagedObjectSourceSynchronously obtains theManagedObject.- Specified by:
getManagedObjectin classAbstractManagedObjectSource<None,Indexed> - Returns:
ManagedObject.- Throws:
Throwable- If fails to obtain theManagedObject.
-
execute
Description copied from interface:ManagedFunctionExecutes the function.- Specified by:
executein interfaceManagedFunction<Indexed,None> - Parameters:
context-ManagedFunctionContextfor theManagedFunction.- Throws:
Throwable- Indicating failure of theManagedFunction.
-
threadComplete
public void threadComplete()Description copied from interface:ThreadCompletionListenerNotifies that theThreadhas completed.- Specified by:
threadCompletein interfaceThreadCompletionListener
-