Package org.apache.flink.runtime.rest
Class RestServerEndpoint
java.lang.Object
org.apache.flink.runtime.rest.RestServerEndpoint
- All Implemented Interfaces:
AutoCloseable,RestService,org.apache.flink.util.AutoCloseableAsync
- Direct Known Subclasses:
WebMonitorEndpoint
An abstract class for netty-based REST server endpoints.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classComparator for Rest URLs. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRestServerEndpoint(org.apache.flink.configuration.Configuration configuration) -
Method Summary
Modifier and TypeMethodDescriptionReturns the base URL of the REST server endpoint.intPort of the running rest service.Returns the address on which this endpoint is accepting requests.protected abstract List<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture) This method is called at the beginning ofstart()to setup all handlers that the REST server endpoint implementation requires.protected CompletableFuture<Void>Stops this REST server endpoint.final voidstart()Starts this REST server endpoint.protected abstract voidHook to start sub class specific services.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
Field Details
-
log
protected final org.slf4j.Logger log -
uploadDir
-
responseHeaders
-
-
Constructor Details
-
RestServerEndpoint
public RestServerEndpoint(org.apache.flink.configuration.Configuration configuration) throws IOException, org.apache.flink.util.ConfigurationException - Throws:
IOExceptionorg.apache.flink.util.ConfigurationException
-
-
Method Details
-
initializeHandlers
protected abstract List<org.apache.flink.api.java.tuple.Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture) This method is called at the beginning ofstart()to setup all handlers that the REST server endpoint implementation requires.- Parameters:
localAddressFuture- future rest address of the RestServerEndpoint- Returns:
- Collection of AbstractRestHandler which are added to the server endpoint
-
start
Starts this REST server endpoint.- Throws:
Exception- if we cannot start the RestServerEndpoint
-
startInternal
Hook to start sub class specific services.- Throws:
Exception- if an error occurred
-
getServerAddress
Returns the address on which this endpoint is accepting requests.- Returns:
- address on which this endpoint is accepting requests or null if none
-
getRestBaseUrl
Returns the base URL of the REST server endpoint.- Returns:
- REST base URL of this endpoint
-
getRestPort
public int getRestPort()Description copied from interface:RestServicePort of the running rest service.- Specified by:
getRestPortin interfaceRestService- Returns:
- port of the rest service if running; otherwise -1
-
closeAsync
- Specified by:
closeAsyncin interfaceorg.apache.flink.util.AutoCloseableAsync
-
shutDownInternal
Stops this REST server endpoint.- Returns:
- Future which is completed once the shut down has been finished.
-