| @@ 263-274 (lines=12) @@ | ||
| 260 | $keepRunning = true; |
|
| 261 | ||
| 262 | // wait till container will be shutdown |
|
| 263 | while ($keepRunning) { |
|
| 264 | // query whether we've a profile logger, log resource usage |
|
| 265 | if ($profileLogger) { |
|
| 266 | $profileLogger->debug(sprintf('Container %s still waiting for shutdown', $this->getContainerNode()->getName())); |
|
| 267 | } |
|
| 268 | ||
| 269 | // wait a second to lower system load |
|
| 270 | $keepRunning = $this->synchronized(function ($self) { |
|
| 271 | $self->wait(1000000 * AbstractContainerThread::TIME_TO_LIVE); |
|
| 272 | return $self->containerState->equals(ContainerStateKeys::get(ContainerStateKeys::SERVERS_STARTED_SUCCESSFUL)); |
|
| 273 | }, $this); |
|
| 274 | } |
|
| 275 | ||
| 276 | // we need to stop all servers before we can shutdown the container |
|
| 277 | /** @var \AppserverIo\Server\Interfaces\ServerInterface $server */ |
|
| @@ 955-966 (lines=12) @@ | ||
| 952 | $keepRunning = true; |
|
| 953 | ||
| 954 | // wait till application will be shutdown |
|
| 955 | while ($keepRunning) { |
|
| 956 | // query whether we've a profile logger, log resource usage |
|
| 957 | if ($profileLogger) { |
|
| 958 | $profileLogger->debug(sprintf('Application %s is running', $this->getName())); |
|
| 959 | } |
|
| 960 | ||
| 961 | // wait a second to lower system load |
|
| 962 | $keepRunning = $this->synchronized(function ($self) { |
|
| 963 | $self->wait(100000 * Application::TIME_TO_LIVE); |
|
| 964 | return $self->applicationState->equals(ApplicationStateKeys::get(ApplicationStateKeys::INITIALIZATION_SUCCESSFUL)); |
|
| 965 | }, $this); |
|
| 966 | } |
|
| 967 | ||
| 968 | // log a message that we has successfully been shutdown now |
|
| 969 | \info(sprintf('%s start to shutdown managers', $this->getName())); |
|