Skip to content

Commit c05eda1

Browse files
chore: expose server lifecycle into container environment
1 parent 248ec31 commit c05eda1

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

platform-grpc-service-framework/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
api("io.grpc:grpc-services")
1313
api("org.hypertrace.core.grpcutils:grpc-client-utils:0.7.5")
1414
api("com.typesafe:config:1.4.2")
15+
api(project(":service-framework-spi"))
1516

1617
annotationProcessor("org.projectlombok:lombok:1.18.24")
1718
compileOnly("org.projectlombok:lombok:1.18.24")

platform-grpc-service-framework/src/main/java/org/hypertrace/core/serviceframework/grpc/ConsolidatedGrpcPlatformServiceContainer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected InProcessGrpcChannelRegistry buildChannelRegistry() {
3131
protected GrpcServiceContainerEnvironment buildContainerEnvironment(
3232
InProcessGrpcChannelRegistry channelRegistry, HealthStatusManager healthStatusManager) {
3333
return new ConsolidatedGrpcServiceContainerEnvironment(
34-
channelRegistry, healthStatusManager, this.getInProcessServerName());
34+
channelRegistry, healthStatusManager, this.getInProcessServerName(), this.getLifecycle());
3535
}
3636

3737
@Override
@@ -51,7 +51,6 @@ protected Collection<GrpcPlatformServiceFactory> getServiceFactories() {
5151
return Collections.emptySet();
5252
}
5353

54-
@Deprecated
5554
protected int getServicePort() {
5655
return this.getAppConfig().getInt(DEFAULT_PORT_PATH);
5756
}

platform-grpc-service-framework/src/main/java/org/hypertrace/core/serviceframework/grpc/ConsolidatedGrpcServiceContainerEnvironment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import lombok.Getter;
88
import org.hypertrace.core.grpcutils.client.InProcessGrpcChannelRegistry;
99
import org.hypertrace.core.serviceframework.config.ConfigClientFactory;
10+
import org.hypertrace.core.serviceframework.spi.PlatformServiceLifecycle;
1011

1112
@AllArgsConstructor
1213
class ConsolidatedGrpcServiceContainerEnvironment implements GrpcServiceContainerEnvironment {
@@ -16,6 +17,8 @@ class ConsolidatedGrpcServiceContainerEnvironment implements GrpcServiceContaine
1617

1718
@Getter private final String inProcessChannelName;
1819

20+
@Getter private final PlatformServiceLifecycle lifecycle;
21+
1922
@Override
2023
public void reportServiceStatus(String serviceName, ServingStatus status) {
2124
this.healthStatusManager.setStatus(serviceName, status);

platform-grpc-service-framework/src/main/java/org/hypertrace/core/serviceframework/grpc/GrpcServiceContainerEnvironment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.typesafe.config.Config;
44
import io.grpc.health.v1.HealthCheckResponse.ServingStatus;
55
import org.hypertrace.core.grpcutils.client.InProcessGrpcChannelRegistry;
6+
import org.hypertrace.core.serviceframework.spi.PlatformServiceLifecycle;
67

78
public interface GrpcServiceContainerEnvironment {
89
InProcessGrpcChannelRegistry getChannelRegistry();
@@ -12,4 +13,6 @@ public interface GrpcServiceContainerEnvironment {
1213
Config getConfig(String serviceName);
1314

1415
String getInProcessChannelName();
16+
17+
PlatformServiceLifecycle getLifecycle();
1518
}

platform-grpc-service-framework/src/main/java/org/hypertrace/core/serviceframework/grpc/StandAloneGrpcPlatformServiceContainer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ protected List<GrpcPlatformServerDefinition> getServerDefinitions() {
4040
protected GrpcServiceContainerEnvironment buildContainerEnvironment(
4141
InProcessGrpcChannelRegistry channelRegistry, HealthStatusManager healthStatusManager) {
4242
return new StandAloneGrpcServiceContainerEnvironment(
43-
channelRegistry, healthStatusManager, this.configClient, this.getInProcessServerName());
43+
channelRegistry,
44+
healthStatusManager,
45+
this.configClient,
46+
this.getInProcessServerName(),
47+
this.getLifecycle());
4448
}
4549
}

platform-grpc-service-framework/src/main/java/org/hypertrace/core/serviceframework/grpc/StandAloneGrpcServiceContainerEnvironment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import lombok.Getter;
88
import org.hypertrace.core.grpcutils.client.InProcessGrpcChannelRegistry;
99
import org.hypertrace.core.serviceframework.config.ConfigClient;
10+
import org.hypertrace.core.serviceframework.spi.PlatformServiceLifecycle;
1011

1112
@AllArgsConstructor
1213
class StandAloneGrpcServiceContainerEnvironment implements GrpcServiceContainerEnvironment {
@@ -18,6 +19,8 @@ class StandAloneGrpcServiceContainerEnvironment implements GrpcServiceContainerE
1819

1920
@Getter private final String inProcessChannelName;
2021

22+
@Getter private final PlatformServiceLifecycle lifecycle;
23+
2124
@Override
2225
public void reportServiceStatus(String serviceName, ServingStatus status) {
2326
this.healthStatusManager.setStatus(serviceName, status);

0 commit comments

Comments
 (0)