Class ContainerProvider


  • public abstract class ContainerProvider
    extends Object
    Provider class that allows the developer to get a reference to the implementation of the WebSocketContainer. The provider class uses the ServiceLoader to load an implementation of ContainerProvider. Specifically, the fully qualified class name of the container implementation of ContainerProvider must be listed in the "META-INF/services/jakarta.websocket.ContainerProvider" file in the implementation JAR file.
    Author:
    dannycoward
    • Constructor Detail

      • ContainerProvider

        public ContainerProvider()
    • Method Detail

      • getWebSocketContainer

        public static WebSocketContainer getWebSocketContainer()
        Obtain a new instance of a WebSocketContainer. The method looks for the ContainerProvider implementation class in the order listed in the "META-INF/services/jakarta.websocket.ContainerProvider" file, returning the first WebSocketContainer implementation from the ContainerProvider implementation that is not null.
        Returns:
        an implementation provided instance of type WebSocketContainer
        Throws:
        ServiceConfigurationError - If there is a problem loading one of the discovered ContainerProvider implementations. A ServiceConfigurationError is viewed as a serious problem so the exception is allowed to propagate rather than swallowing the exception and attempting to load the next provider (if any).
      • getContainer

        protected abstract WebSocketContainer getContainer()
        Create a new instance of the the WebSocket container implementation.
        Returns:
        the new instance