You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2019/04/01 16:17:22 UTC
[GitHub] [knox] rlevas opened a new pull request #82: KNOX-1819 - Ensure
services are started and stopped in the correct order
rlevas opened a new pull request #82: KNOX-1819 - Ensure services are started and stopped in the correct order
URL: https://github.com/apache/knox/pull/82
## What changes were proposed in this pull request?
Ensure services are started and stopped in the correct order in `org.apache.knox.gateway.services.DefaultGatewayServices` and `org.apache.knox.gateway.services.CLIGatewayServices`.
The following order is being enforced for starting services:
1. MasterService
1. KeystoreService
1. AliasService
1. SslService
1. TokenService
1. ServerInfoService
1. RemoteRegistryClientService
1. ClusterConfigurationMonitorervice
1. TopologyService
1. MetricsService
1. CryptoService
1. HostMappingService
1. ServiceDefinitionRegistry
1. ServiceRegistryService
The order is reversed for stopping.
A new class, `org.apache.knox.gateway.services.ServiceType`, was added to enumerate the different service types.
A new class, `org.apache.knox.gateway.services.AbstractGatewayServices`, was added to implement the starting and stopping order listed above. Only _registered_ services will be started and stopped. An associated unit test class was added as well - `org.apache.knox.gateway.services.AbstractGatewayServicesTest`
The rest of the changes are basically converting `GatewayServices` constants to `ServiceType` enums... for example, `GatewayServices.MASTER_SERVICE` to `ServiceType.MASTER_SERVICE`
## How was this patch tested?
Added new unit tests and executed them:
```
mvn -T.5C verify -Prelease,package
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16:22 min (Wall Clock)
[INFO] Finished at: 2019-04-01T11:19:15-04:00
[INFO] Final Memory: 274M/1472M
[INFO] ------------------------------------------------------------------------
```
Started server to see new logged messages:
```
2019-04-01 12:14:52,720 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: MasterService
2019-04-01 12:14:52,720 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: KeystoreService
2019-04-01 12:14:52,720 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: AliasService
2019-04-01 12:14:52,720 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: SSLService
2019-04-01 12:14:52,720 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: TokenService
2019-04-01 12:14:52,722 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: ServerInfoService
2019-04-01 12:14:52,722 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: RemoteConfigRegistryClientService
2019-04-01 12:14:52,722 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: ClusterConfigurationMonitorService
2019-04-01 12:14:52,723 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: TopologyService
2019-04-01 12:14:52,723 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: MetricsService
2019-04-01 12:14:52,723 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: CryptoService
2019-04-01 12:14:52,723 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: HostMappingService
2019-04-01 12:14:52,723 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: ServiceDefinitionRegistry
2019-04-01 12:14:52,723 INFO knox.gateway (AbstractGatewayServices.java:start(67)) - Starting service: ServiceRegistryService
```
Please review [Knox Contributing Process](https://cwiki.apache.org/confluence/display/KNOX/Contribution+Process#ContributionProcess-GithubWorkflow) before opening a pull request.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services