synchronized void listenerStarted(HttpEndpointImpl endpoint, VirtualHostConfig targetConfig, String resolvedHostName, int port, boolean isHttps) {
        if (!activated)
            return;

        // If allowed endpoints are specified for the host and this isn't one of them, don't add this endpoint
        Collection<String> allowedEndpoints = targetConfig.getAllowedEndpoints();
        if (!allowedEndpoints.isEmpty() && !allowedEndpoints.contains(endpoint.getPid()))
            return;

        EndpointState oldState = myEndpoints.get(endpoint);
        if (oldState == null) {
            oldState = EndpointState.notStarted;
        }

        int newHttpPort = isHttps ? oldState.httpPort : port;
        int newHttpsPort = isHttps ? port : oldState.httpsPort;

        EndpointState newState = new EndpointState(resolvedHostName, newHttpPort, newHttpsPort);

        //Check if we are changing an already listening port.. 
        boolean updatedPort = (oldState.httpPort > 0 && oldState.httpPort != newHttpPort)
                              || (oldState.httpsPort > 0 && oldState.httpsPort != newHttpsPort);

        boolean addedPort = (oldState.httpPort == 0 && oldState.httpPort != newHttpPort)
                            || (oldState.httpsPort == 0 && oldState.httpsPort != newHttpsPort);

        myEndpoints.put(endpoint, newState);

        int numPorts;
        if (addedPort)
            numPorts = listeningPorts.incrementAndGet();
        else
            numPorts = listeningPorts.get();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "listener started: " + listeningPorts.get(), oldState, newState, addedPort, updatedPort);
        }

        if (addedPort || updatedPort) {
            // Update registration if a port changed.. 
            osgiService.updateRegistration(activated, targetConfig, true);
        }

        // Notify that the endpoint is available only if it is a first port, or a changed port for an endpoint  
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "listener started for " + this + " on host " + resolvedHostName + " on port " + port, endpoint);
        }

        for (HttpContainerContext ctx : httpContainers) {
            ctx.notifyExistingContexts(true, resolvedHostName, port, isHttps, numPorts);
        }
    }
synchronized void listenerStarted ( HttpEndpointImpl endpoint , VirtualHostConfig targetConfig , String resolvedHostName , int port , boolean isHttps ) { if ( ! activated ) return ; Collection < String > allowedEndpoints = targetConfig . getAllowedEndpoints ( ) ; if ( ! allowedEndpoints . isEmpty ( ) && ! allowedEndpoints . contains ( endpoint . getPid ( ) ) ) return ; EndpointState oldState = myEndpoints . get ( endpoint ) ; if ( oldState == null ) { oldState = EndpointState . notStarted ; } int newHttpPort = isHttps ? oldState . httpPort : port ; int newHttpsPort = isHttps ? port : oldState . httpsPort ; EndpointState newState = new EndpointState ( resolvedHostName , newHttpPort , newHttpsPort ) ; boolean updatedPort = ( oldState . httpPort > 0 && oldState . httpPort != newHttpPort ) || ( oldState . httpsPort > 0 && oldState . httpsPort != newHttpsPort ) ; boolean addedPort = ( oldState . httpPort == 0 && oldState . httpPort != newHttpPort ) || ( oldState . httpsPort == 0 && oldState . httpsPort != newHttpsPort ) ; myEndpoints . put ( endpoint , newState ) ; int numPorts ; if ( addedPort ) numPorts = listeningPorts . incrementAndGet ( ) ; else numPorts = listeningPorts . get ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "listener started: " + listeningPorts . get ( ) , oldState , newState , addedPort , updatedPort ) ; } if ( addedPort || updatedPort ) { osgiService . updateRegistration ( activated , targetConfig , true ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "listener started for " + this + " on host " + resolvedHostName + " on port " + port , endpoint ) ; } for ( HttpContainerContext ctx : httpContainers ) { ctx . notifyExistingContexts ( true , resolvedHostName , port , isHttps , numPorts ) ; } }
This method is called by the VirtualHostMap when an endpoint that applies to
this virtual host (matches one of the configured aliases) is started.
<p>
Note that because host aliases are specified with the virtual host and not
with the endpoint that it is possible to split the http and https ports defined
with an endpoint across two virtual hosts, which would prevent redirecting.
Make sure that the endpoint is used only as an index, and that the parameters
passed to this and {@link #listenerStopped(HttpEndpointImpl, String, int, boolean)} are
what is used to determine whether or not a redirect is available.
<p>
Note also that this method can be called as a side-effect
of {@link VirtualHostMap#addVirtualHost(VirtualHostConfig, VirtualHostConfig)}. That is
why a "target configuration" is passed in as a parameter to this method: the aliases associated
with the configuration are being updated before the modified method completes.

@param endpoint The endpoint that was started
@param targetConfig The configuration that is being notified
@param resolvedHostName A suitable hostname for use in messages
@param port The port that is now listening
@param isHttps True if this is an https port
@see #listenerStopped(HttpEndpointImpl, String, int, boolean)