Update
This commit is contained in:
parent
a288e59189
commit
603adef875
2
pom.xml
2
pom.xml
@ -154,7 +154,7 @@
|
||||
<dependency>
|
||||
<groupId>it.tdlight</groupId>
|
||||
<artifactId>tdlight-java</artifactId>
|
||||
<version>1.7.7.1</version>
|
||||
<version>2.7.8.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.cavallium</groupId>
|
||||
|
@ -20,6 +20,7 @@ import io.vertx.reactivex.core.eventbus.MessageConsumer;
|
||||
import io.vertx.reactivex.core.shareddata.SharedData;
|
||||
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager;
|
||||
import it.tdlight.common.ConstructorDetector;
|
||||
import it.tdlight.jni.TdApi;
|
||||
import it.tdlight.utils.MonoUtils;
|
||||
import java.nio.channels.AlreadyBoundException;
|
||||
import java.util.ArrayList;
|
||||
@ -58,16 +59,21 @@ public class TdClusterManager {
|
||||
.registerDefaultCodec(TdResultMessage.class, new TdResultMessageCodec())
|
||||
.registerDefaultCodec(StartSessionMessage.class, new StartSessionMessageCodec())
|
||||
.registerDefaultCodec(EndSessionMessage.class, new EndSessionMessageCodec());
|
||||
var constructors = ConstructorDetector.getTDConstructorsUnsafe();
|
||||
if (constructors != null) {
|
||||
for (Class<?> value : constructors.values()) {
|
||||
vertx.eventBus().getDelegate().registerDefaultCodec(value, new TdMessageCodec(value));
|
||||
for (Class<?> declaredClass : TdApi.class.getDeclaredClasses()) {
|
||||
if (declaredClass.isAssignableFrom(declaredClass)) {
|
||||
vertx.eventBus().getDelegate().registerDefaultCodec(declaredClass, new TdMessageCodec(declaredClass));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Mono<TdClusterManager> ofMaster(@Nullable JksOptions keyStoreOptions, @Nullable JksOptions trustStoreOptions, boolean onlyLocal, String masterHostname, String netInterface, int port, Set<String> nodesAddresses) {
|
||||
public static Mono<TdClusterManager> ofMaster(@Nullable JksOptions keyStoreOptions,
|
||||
@Nullable JksOptions trustStoreOptions,
|
||||
boolean onlyLocal,
|
||||
String masterHostname,
|
||||
String netInterface,
|
||||
int port,
|
||||
Set<String> nodesAddresses) {
|
||||
if (definedMasterCluster.compareAndSet(false, true)) {
|
||||
var vertxOptions = new VertxOptions();
|
||||
netInterface = onlyLocal ? "127.0.0.1" : netInterface;
|
||||
@ -86,7 +92,13 @@ public class TdClusterManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static Mono<TdClusterManager> ofNodes(@Nullable JksOptions keyStoreOptions, @Nullable JksOptions trustStoreOptions, boolean onlyLocal, String masterHostname, String netInterface, int port, Set<String> nodesAddresses) {
|
||||
public static Mono<TdClusterManager> ofNodes(@Nullable JksOptions keyStoreOptions,
|
||||
@Nullable JksOptions trustStoreOptions,
|
||||
boolean onlyLocal,
|
||||
String masterHostname,
|
||||
String netInterface,
|
||||
int port,
|
||||
Set<String> nodesAddresses) {
|
||||
return Mono.defer(() -> {
|
||||
if (definedNodesCluster.compareAndSet(false, true)) {
|
||||
var vertxOptions = new VertxOptions();
|
||||
@ -98,7 +110,8 @@ public class TdClusterManager {
|
||||
} else {
|
||||
cfg = null;
|
||||
}
|
||||
return of(cfg, vertxOptions, keyStoreOptions, trustStoreOptions, masterHostname, netInterfaceF, port, nodesAddresses, false);
|
||||
return of(cfg, vertxOptions, keyStoreOptions, trustStoreOptions, masterHostname, netInterfaceF, port,
|
||||
nodesAddresses, false);
|
||||
} else {
|
||||
return Mono.error(new AlreadyBoundException());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user