Hello! If this is not too much of a slowdown, you can just remove the userSeq field, and always use "igniteInstance.atomicLong("userSeq", maxId, true)" in its place, to make sure you always hold a fresh one.
Regards, -- Ilya Kasnacheev пт, 28 авг. 2020 г. в 04:47, xmw45688 <xw...@procurant.com>: > How do we enable the persistence for this atomicLong? My understanding is > that atomicLong or atomicReference can't be persisted. Even if it can be > persisted, isn't next value reset and started from the initial value. > > My issue is that the cached sequence was removed from Spring bean. How do > I > re-initialize this sequence once the Ignite server node restarted while the > client node was still running. > > The initialization of the sequence is from the client side using > @PostConstruct. We need a way to re-initialize with the max value from DB > when the ignite server restarted and the client node was connected to the > ignite server. > > @PostConstruct > @Override > public void initSequence() { > Long maxId = userRepository.getMaxId(); > if (maxId == null) { maxId = 0L; } > LOG.info("Max User id: {}", maxId); > userSeq = igniteInstance.atomicLong("userSeq", maxId, true); > userSeq.getAndSet(maxId); > } > > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >