AppserverIo\Appserver\Core\AbstractContainerThread::stop PHP Method

stop() public method

Stops the container instance.
public stop ( ) : void
return void
    public function stop()
    {
        // start container shutdown
        $this->synchronized(function ($self) {
            $self->containerState = ContainerStateKeys::get(ContainerStateKeys::HALT);
        }, $this);
        do {
            // wait for 0.5 seconds
            usleep(500000);
            // log a message that we'll wait till application has been shutdown
            $this->getInitialContext()->getSystemLogger()->info(sprintf('Wait for container %s to be shutdown', $this->getContainerNode()->getName()));
            // query whether application state key is SHUTDOWN or not
            $waitForShutdown = $this->synchronized(function ($self) {
                return $self->containerState->notEquals(ContainerStateKeys::get(ContainerStateKeys::SHUTDOWN));
            }, $this);
        } while ($waitForShutdown);
    }