1313 */
1414package io .trino .gateway .baseapp ;
1515
16+ import com .google .common .collect .ImmutableList ;
1617import com .google .inject .Binder ;
1718import com .google .inject .Module ;
1819import com .google .inject .Scopes ;
@@ -107,6 +108,7 @@ public static List<Module> addModules(HaGatewayConfiguration configuration)
107108 }
108109 else {
109110 for (String clazz : configuration .getModules ()) {
111+ warnLoadingDefaultModules (clazz );
110112 modules .add (newModule (clazz , configuration ));
111113 }
112114 }
@@ -115,6 +117,19 @@ public static List<Module> addModules(HaGatewayConfiguration configuration)
115117 return modules ;
116118 }
117119
120+ private static void warnLoadingDefaultModules (String clazz )
121+ {
122+ // Remove this check when user finished the migration
123+ List <String > defaultModules = ImmutableList .of (
124+ "io.trino.gateway.ha.module.HaGatewayProviderModule" ,
125+ "io.trino.gateway.ha.module.ClusterStateListenerModule" ,
126+ "io.trino.gateway.ha.module.ClusterStatsMonitorModule" );
127+ if (defaultModules .contains (clazz )) {
128+ logger .error ("Default module [%s] is already being loaded. Please remove it from the config file" , clazz );
129+ System .exit (1 );
130+ }
131+ }
132+
118133 @ Override
119134 public void configure (Binder binder )
120135 {
@@ -138,6 +153,11 @@ private static void addManagedApps(HaGatewayConfiguration configuration, Binder
138153 }
139154 configuration .getManagedApps ().forEach (
140155 clazz -> {
156+ // Remove this check when user finished the migration
157+ if (clazz .equals ("io.trino.gateway.ha.clustermonitor.ActiveClusterMonitor" )) {
158+ logger .error ("Default class ActiveClusterMonitor is already being loaded. Please remove it from the config file" );
159+ System .exit (1 );
160+ }
141161 try {
142162 Class <?> c = Class .forName (clazz );
143163 binder .bind (c ).in (Scopes .SINGLETON );
0 commit comments