Update Client.java

This commit is contained in:
Andrea Cavalli 2020-09-02 16:01:58 +02:00
parent 05f455f416
commit 319df71154
1 changed files with 10 additions and 8 deletions

View File

@ -15,12 +15,20 @@ public class Client extends NativeClient implements TelegramClient {
private long clientId;
private final ReentrantLock receiveLock = new ReentrantLock();
private final StampedLock executionLock = new StampedLock();
private volatile Long stampedLockValue = 1L;
private volatile Long stampedLockValue;
/**
* Creates a new TDLib client.
*/
public Client() {}
public Client() {
try {
Init.start();
} catch (Throwable throwable) {
throwable.printStackTrace();
System.exit(1);
}
this.clientId = createNativeClient();
}
@Override
public void send(Request request) {
@ -105,12 +113,6 @@ public class Client extends NativeClient implements TelegramClient {
public void initializeClient() {
this.executionLock.tryUnlockWrite();
stampedLockValue = null;
try {
Init.start();
} catch (Throwable throwable) {
throwable.printStackTrace();
System.exit(1);
}
this.clientId = createNativeClient();
}
}