spring-projects / spring-integration-extensions

The Spring Integration Extensions project provides extension components for Spring Integration
http://www.springintegration.org/
280 stars 266 forks source link

GH-259: Ensure lock state after HZ cluster shutdown #260

Closed RobbanHoglund closed 2 years ago

RobbanHoglund commented 2 years ago

I have tested this implementation/fix against a running HZ cluster (client/server mode) running version 5.1.1.

This will ensure that, if a HZ cluster is totally shut down and then restarted the leader state will be reset if the client still possess/regain the lock.

RobbanHoglund commented 2 years ago

The actual fix is here:

if (LeaderInitiator.this.getLock().isLockedByCurrentThread()) {
    if (!this.leader) {
      // Since we have the lock we need to ensure that the leader flag is set
     this.leader = true;
    }

Btw, Thanks for reviewing my code. :)

artembilan commented 2 years ago

Merged as https://github.com/spring-projects/spring-integration-extensions/commit/e11e65e3f542beb76058bc8e277dff6705a59168.

@RobbanHoglund ,

thank you very much for the contribution; looking forward for more!

BTW, we are in agreement to merge this Extensions project with main Spring Integration one: https://github.com/spring-projects/spring-integration-extensions/issues/254. So, if you wish to contribute more, feel free to migrate HZ module and upgrade it respectively to the latest deps and so!

RobbanHoglund commented 2 years ago

Thanks for the good collaboration. And indeed I would gladly contribute if needed, especially with the Hazelcast parts.

artembilan commented 2 years ago

I would gladly contribute if needed

Right, as I said: we need now to migrate HZ extension project to Spring Integration as a module. We did recently something similar for SMB one: https://github.com/spring-projects/spring-integration/pull/3791.

So, that's kinda the story we may consider as a contribution at the moment for HZ.

Thanks

RobbanHoglund commented 2 years ago

Hi, I did an attempt here: https://github.com/spring-projects/spring-integration/pull/3812