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.DispatcherNested classes/interfaces inherited from interface org.elasticsearch.node.ReportingService
ReportingService.Info -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CorsHandlerprotected final HttpServerTransport.Dispatcherfinal HttpHandlingSettingsprotected final ByteSizeValueprotected final NetworkServiceprotected final PortsRangeprotected final Recycler<org.apache.lucene.util.BytesRef> protected final Settingsprotected final ThreadPoolFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycleFields inherited from interface org.elasticsearch.http.HttpServerTransport
HTTP_PROFILE_NAME, HTTP_SERVER_WORKER_THREAD_NAME_PREFIX -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractHttpServerTransport(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 HttpServerChannelbind(InetSocketAddress hostAddress) protected voidprotected voiddoClose()Close this component.protected voiddoStop()Gracefully shut down.voidincomingRequest(HttpRequest httpRequest, HttpChannel httpChannel) This method handles an incoming http request.info()voidonException(HttpChannel channel, Exception e) protected static voidonServerException(HttpServerChannel channel, Exception e) protected voidpopulatePerRequestThreadContext(RestRequest restRequest, ThreadContext threadContext) Recycler<org.apache.lucene.util.BytesRef> recycler()protected voidserverAcceptedChannel(HttpChannel httpChannel) stats()protected abstract voidCalled to tear down internal resourcesMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, doStart, lifecycleState, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, start, stopMethods 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:
boundAddressin interfaceHttpServerTransport
-
info
- Specified by:
infoin interfaceHttpServerTransport- Specified by:
infoin interfaceReportingService<HttpInfo>
-
stats
- Specified by:
statsin interfaceHttpServerTransport
-
bindServer
protected void bindServer() -
bind
- Throws:
Exception
-
doStop
protected void doStop()Gracefully shut down. IfHttpTransportSettings.SETTING_HTTP_SERVER_SHUTDOWN_GRACE_PERIODis zero, the default, then forcefully close all open connections immediately. Serially run through the following steps:- Stop listening for new HTTP connections, which means no new HttpChannel are added to the
httpChannelslist.serverAcceptedChannel(HttpChannel)will close any new channels to ensure this is true. - Close the HttpChannel after a new request completes on all existing channels.
- Close all idle channels.
- If grace period is set, wait for all httpChannels 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. - Close all remaining open httpChannels even if requests are in flight.
- Specified by:
doStopin classAbstractLifecycleComponent
- Stop listening for new HTTP connections, which means no new HttpChannel are added to the
-
doClose
protected void doClose()Description copied from class:AbstractLifecycleComponentClose this component. Typically that means doing the reverse of whatever happened during initialization, such as releasing resources acquired there.This method is called while synchronized on
AbstractLifecycleComponent.lifecycle. It is called once in the lifetime of a component. If the component was started then it will be stopped before it is closed, and once it is closed it will not be started or stopped.- Specified by:
doClosein 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
-