java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.http.AbstractHttpServerTransport
- All Implemented Interfaces:
Closeable
,AutoCloseable
,LifecycleComponent
,Releasable
,HttpServerTransport
,ReportingService<HttpInfo>
public abstract class AbstractHttpServerTransport
extends AbstractLifecycleComponent
implements HttpServerTransport
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.http.HttpServerTransport
HttpServerTransport.Dispatcher
Nested classes/interfaces inherited from interface org.elasticsearch.node.ReportingService
ReportingService.Info
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CorsHandler
protected final HttpServerTransport.Dispatcher
final HttpHandlingSettings
protected final ByteSizeValue
protected final NetworkService
protected final PortsRange
protected final Recycler<org.apache.lucene.util.BytesRef>
protected final Settings
protected final ThreadPool
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle
Fields inherited from interface org.elasticsearch.http.HttpServerTransport
HTTP_PROFILE_NAME, HTTP_SERVER_WORKER_THREAD_NAME_PREFIX
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractHttpServerTransport
(Settings settings, NetworkService networkService, Recycler<org.apache.lucene.util.BytesRef> recycler, ThreadPool threadPool, NamedXContentRegistry xContentRegistry, HttpServerTransport.Dispatcher dispatcher, ClusterSettings clusterSettings, Tracer tracer) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract HttpServerChannel
bind
(InetSocketAddress hostAddress) protected void
protected void
doClose()
protected void
doStop()
Gracefully shut down.void
incomingRequest
(HttpRequest httpRequest, HttpChannel httpChannel) This method handles an incoming http request.info()
void
onException
(HttpChannel channel, Exception e) protected static void
onServerException
(HttpServerChannel channel, Exception e) protected void
populatePerRequestThreadContext
(RestRequest restRequest, ThreadContext threadContext) Recycler<org.apache.lucene.util.BytesRef>
recycler()
protected void
serverAcceptedChannel
(HttpChannel httpChannel) stats()
protected abstract void
Called to tear down internal resourcesMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, doStart, lifecycleState, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, start, stop
Methods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
settings
-
handlingSettings
-
networkService
-
recycler
-
threadPool
-
dispatcher
-
corsHandler
-
port
-
maxContentLength
-
-
Constructor Details
-
AbstractHttpServerTransport
protected AbstractHttpServerTransport(Settings settings, NetworkService networkService, Recycler<org.apache.lucene.util.BytesRef> recycler, ThreadPool threadPool, NamedXContentRegistry xContentRegistry, HttpServerTransport.Dispatcher dispatcher, ClusterSettings clusterSettings, Tracer tracer)
-
-
Method Details
-
recycler
-
boundAddress
- Specified by:
boundAddress
in interfaceHttpServerTransport
-
info
- Specified by:
info
in interfaceHttpServerTransport
- Specified by:
info
in interfaceReportingService<HttpInfo>
-
stats
- Specified by:
stats
in interfaceHttpServerTransport
-
bindServer
protected void bindServer() -
bind
- Throws:
Exception
-
doStop
protected void doStop()Gracefully shut down. IfHttpTransportSettings.SETTING_HTTP_SERVER_SHUTDOWN_GRACE_PERIOD
is zero, the default, then forcefully close all open connections immediately. Serially run through the following steps: 1) Stop listening for new HTTP connections, which means no new HttpChannel are added to thehttpChannels
list 2) Add theConnection: close
response header to all new requests on existinghttpChannels
and close the HttpChannel after the new request completes 3) If grace period is set, wait for allhttpChannels
to close via 2 for up to the configured grace period,shutdownGracePeriodMillis
. If all connections are closed before the expiration of the grace period, stop waiting early. 4) Close all open httpChannels even if requests are in flight.- Specified by:
doStop
in classAbstractLifecycleComponent
-
doClose
protected void doClose()- Specified by:
doClose
in classAbstractLifecycleComponent
-
stopInternal
protected abstract void stopInternal()Called to tear down internal resources -
onException
-
onServerException
-
serverAcceptedChannel
-
incomingRequest
This method handles an incoming http request.- Parameters:
httpRequest
- that is incominghttpChannel
- that received the http request
-
populatePerRequestThreadContext
protected void populatePerRequestThreadContext(RestRequest restRequest, ThreadContext threadContext) -
getThreadPool
-