embedded-redis
embedded-redis copied to clipboard
Enable force stop
Hey team,
In our project, we're using embedded Redis instances with fixed ports and we occasionally encounter situations, when the Redis instance is not terminated properly leaving the port busy after the JVM is shut down, forcing us in turn to do kill -9.
With this PR I'd like to introduce a builder flag for standalone, sentinel and cluster that enables force-stopping of the instance by passing a SIGKILL via Process#destroyForcibly() instead a graceful SIGTERM. The new config would be enabled solely on Java side like this:
Redis redis = RedisServer.builder()
.onShutdownForceStop(true)
.build();
Apart from this change, I've also taken upon myself the liberty of doing a bit of a clean-up:
- fixed maven warnings (absent compiler version and use of
<prerequisites>) - made a few tweaks to the test classes (replacing deprecated Jedis API calls and silencing other non-critical warnings).
All changes introduced go in separate commits, let me know if you want to go with some of them and not accept others or to squash them into bigger change sets.
I like this idea so I built this into my fork of the project.
This fork saves my day!