3 changed files with 48 additions and 21 deletions
@ -0,0 +1,41 @@ |
|||
package app.entities.server; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.ibasco.agql.core.enums.RateLimitType; |
|||
import com.ibasco.agql.core.util.FailsafeOptions; |
|||
import com.ibasco.agql.core.util.GeneralOptions; |
|||
import com.ibasco.agql.protocols.valve.source.query.SourceQueryClient; |
|||
import com.ibasco.agql.protocols.valve.source.query.SourceQueryOptions; |
|||
import com.ibasco.agql.protocols.valve.source.query.rcon.SourceRconClient; |
|||
import com.ibasco.agql.protocols.valve.source.query.rcon.SourceRconOptions; |
|||
|
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.Executors; |
|||
|
|||
public abstract class BaseServer { |
|||
@JsonIgnore |
|||
private ExecutorService executorServices_query; |
|||
@JsonIgnore |
|||
private ExecutorService executorServices_rcon; |
|||
|
|||
@JsonIgnore |
|||
public SourceRconClient GetSourceRconClient() { |
|||
if (executorServices_rcon == null) executorServices_rcon = Executors.newCachedThreadPool(); |
|||
SourceRconOptions options = SourceRconOptions.builder() |
|||
.option(FailsafeOptions.FAILSAFE_RATELIMIT_TYPE, RateLimitType.SMOOTH) |
|||
.option(GeneralOptions.THREAD_EXECUTOR_SERVICE, executorServices_rcon) |
|||
.build(); |
|||
return new SourceRconClient(options); |
|||
} |
|||
|
|||
|
|||
@JsonIgnore |
|||
public SourceQueryClient GetSourceQueryClient() { |
|||
if (executorServices_query == null) executorServices_query = Executors.newCachedThreadPool(); |
|||
SourceQueryOptions options = SourceQueryOptions.builder() |
|||
.option(FailsafeOptions.FAILSAFE_RATELIMIT_TYPE, RateLimitType.SMOOTH) |
|||
.option(GeneralOptions.THREAD_EXECUTOR_SERVICE, executorServices_query) |
|||
.build(); |
|||
return new SourceQueryClient(options); |
|||
} |
|||
} |
Loading…
Reference in new issue