private IHazelcastClient getHazelcastClient() { IHazelcastClient hazelcastClient = hazelcastClientFactory.getHazelcastClient( hazelcastServers, hazelcastUsername, hazelcastPassword, poolConfig); if (hazelcastClient != null) { allocatedHazelcastClients.add(hazelcastClient); } return hazelcastClient; }
private void returnHazelcastClient(IHazelcastClient hazelcastClient) { if (hazelcastClient != null) { try { allocatedHazelcastClients.remove(hazelcastClient); } finally { hazelcastClientFactory.returnHazelcastClient(hazelcastClient); } } }
public void destroy() { for (IHazelcastClient hazelcastClient : allocatedHazelcastClients) { try { hazelcastClientFactory.returnHazelcastClient(hazelcastClient); } catch (Exception e) { } } allocatedHazelcastClients.clear(); }