Browse Source

ебка с потоками и утечкой 3

master
gsd 2 years ago
parent
commit
d47a2dfe89
  1. 14
      src/main/java/app/entities/server/BaseServer.java

14
src/main/java/app/entities/server/BaseServer.java

@ -17,25 +17,35 @@ public abstract class BaseServer {
private ExecutorService executorServices_query;
@JsonIgnore
private ExecutorService executorServices_rcon;
@JsonIgnore
private SourceRconClient sourceRconClient;
@JsonIgnore
private SourceQueryClient sourceQueryClient;
@JsonIgnore
public SourceRconClient GetSourceRconClient() {
if (executorServices_rcon == null) executorServices_rcon = Executors.newCachedThreadPool();
if (sourceRconClient == null) {
SourceRconOptions options = SourceRconOptions.builder()
.option(FailsafeOptions.FAILSAFE_RATELIMIT_TYPE, RateLimitType.SMOOTH)
.option(GeneralOptions.THREAD_EXECUTOR_SERVICE, executorServices_rcon)
.build();
return new SourceRconClient(options);
sourceRconClient = new SourceRconClient(options);
}
return sourceRconClient;
}
@JsonIgnore
public SourceQueryClient GetSourceQueryClient() {
if (executorServices_query == null) executorServices_query = Executors.newCachedThreadPool();
if (sourceQueryClient == null) {
SourceQueryOptions options = SourceQueryOptions.builder()
.option(FailsafeOptions.FAILSAFE_RATELIMIT_TYPE, RateLimitType.SMOOTH)
.option(GeneralOptions.THREAD_EXECUTOR_SERVICE, executorServices_query)
.build();
return new SourceQueryClient(options);
sourceQueryClient = new SourceQueryClient(options);
}
return sourceQueryClient;
}
}

Loading…
Cancel
Save