Как следует уничтожить динамически выделенные FencedLocks в Hazelcast ⇐ JAVA
-
Anonymous
Как следует уничтожить динамически выделенные FencedLocks в Hazelcast
Hazelcast FencedLocks should be destroyed to avoid memory leaks but how/when should that be done when those locks are not known beforehand and created/allocated on demand (potentially by multiple processes)? Or are those locks not meant to be used that way?
example:
// this method can be called by multiple concurrent processes public void updateClient(ClientId id, ClientData data) { var lock = this.hz.getCPSubsystem().getLock(id.toString()); lock.lock(); try { // update the client } finally { lock.unlock(); } // where should lock.destroy() be called? }
Источник: https://stackoverflow.com/questions/781 ... -destroyed
Hazelcast FencedLocks should be destroyed to avoid memory leaks but how/when should that be done when those locks are not known beforehand and created/allocated on demand (potentially by multiple processes)? Or are those locks not meant to be used that way?
example:
// this method can be called by multiple concurrent processes public void updateClient(ClientId id, ClientData data) { var lock = this.hz.getCPSubsystem().getLock(id.toString()); lock.lock(); try { // update the client } finally { lock.unlock(); } // where should lock.destroy() be called? }
Источник: https://stackoverflow.com/questions/781 ... -destroyed
Мобильная версия