-
Notifications
You must be signed in to change notification settings - Fork 6
feat: coordination recipes example #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
switch (state) { | ||
case RECONNECTED: { | ||
logger.debug("Session RECONNECTED"); | ||
reconnect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вот тут несовсем верно. Делать reconnect или нет зависит от того удалось ли сохранить сессию при потере связи или нет. Если сессия осталась (у нее не изменился идентификатор) - то все локи остались за нами, то ничего реконнектить не надо
} else { | ||
timeout = Duration.between(Instant.now(), deadline); // TODO: use external Clock instead of Instant? | ||
} | ||
CompletableFuture<Result<SemaphoreLease>> acquireTask = connectedSession().acquireEphemeralSemaphore( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Наверное нужно уметь работать не только с эфемерным семафором?
lockInternals.start(); | ||
// TODO: Share same lockInternals? | ||
this.readLock = new InternalLock(lockInternals, false); | ||
this.writeLock = new InternalLock(lockInternals, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется что такая схема не сработает. ReadWriteLock подразумевает что ты можешь сначала взять read лок, потом сделать upgrade до write лока. А если у тебя внутри это два разных лока - это не сработает
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А тут как раз лок один, просто две обертки - одна запрашивает эксклюзивный лок, а другая - неэксклюзивный
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, я почему то думал что стандратный ReentrantReadWriteLock позволяет апгрейд с read до write. Сейчас перечитал документацию - нет, такая операция не разрешена. Возможен только дайнгрейд с write до read.
No description provided.