@Override public void cleanup() throws DBException { client.close(); }
/** * Close connection. */ @Override public void disconnect() { client.close(); }
/** * Close connection. */ @Override public void disconnect() { client.close(); }
/** * Method to close aerospike client connections to database server nodes */ @Override public void close() { aerospikeClient.close(); LOG.info("Aerospike Gora datastore destroyed successfully."); }
/** * Method to close aerospike client connections to database server nodes */ @Override public void close() { aerospikeClient.close(); LOG.info("Aerospike Gora datastore destroyed successfully."); }
/** * closes the QueryEngine, clearing the cached information are closing the AerospikeClient. * Once the QueryEngine is closed, it cannot be used, nor can the AerospikeClient. */ @Override public void close() throws IOException { if (this.client != null) this.client.close(); indexCache.clear(); indexCache = null; updatePolicy = null; insertPolicy = null; infoPolicy = null; queryPolicy = null; moduleCache.clear(); moduleCache = null; }
c.close(); } catch (Exception error) {
log.info("Aerospike loader completed"); if (client != null) { client.close();
/** * Connect and run one or more client examples. */ public static void runExamples(Console console, Parameters params, List<String> examples) throws Exception { ClientPolicy policy = new ClientPolicy(); policy.user = params.user; policy.password = params.password; policy.authMode = params.authMode; policy.tlsPolicy = params.tlsPolicy; params.policy = policy.readPolicyDefault; params.writePolicy = policy.writePolicyDefault; Host[] hosts = Host.parseHosts(params.host, params.port); AerospikeClient client = new AerospikeClient(policy, hosts); try { params.setServerSpecific(client); for (String exampleName : examples) { runExample(exampleName, client, params, console); } } finally { client.close(); } }
public void insertEventsInTable(int numEvents) { AerospikeClient client = null; try { client = new AerospikeClient(NODE, PORT); Key key; Bin bin; for (int i = 0; i < numEvents; i++) { key = new Key(NAMESPACE,SET_NAME,String.valueOf(i)); bin = new Bin("ID",i); client.put(null, key, bin); } } catch (AerospikeException e) { throw e; } finally { if (null != client) { client.close(); } } }
static long getNumOfEventsInStore() { AerospikeClient client = null; try { long count = 0; client = new AerospikeClient(NODE, PORT); Statement stmnt = new Statement(); stmnt.setNamespace(NAMESPACE); stmnt.setSetName(SET_NAME); RecordSet rs = client.query(null, stmnt); while (rs.next()) { count++; } return count; } catch (AerospikeException e) { LOG.error("getNumOfEventsInStore failed: {}", e); throw e; } finally { if (null != client) { client.close(); } } }
static void cleanMetaTable() { AerospikeClient client = null; try { client = new AerospikeClient(NODE, PORT); Statement stmnt = new Statement(); stmnt.setNamespace(NAMESPACE); stmnt.setSetName(AerospikeTransactionalStore.DEFAULT_META_SET); RecordSet rs = client.query(null, stmnt); while (rs.next()) { client.delete(null, rs.getKey()); } } catch (AerospikeException e) { LOG.error("cleanMetaTable failed: {}", e); throw e; } finally { if (null != client) { client.close(); } } }
static void cleanTable() { AerospikeClient client = null; try { client = new AerospikeClient(NODE, PORT); Statement stmnt = new Statement(); stmnt.setNamespace(NAMESPACE); stmnt.setSetName(SET_NAME); RecordSet rs = client.query(null, stmnt); while (rs.next()) { client.delete(null, rs.getKey()); } } catch (AerospikeException e) { LOG.error("cleanTable failed: {}", e); throw e; } finally { if (null != client) { client.close(); } } }
static boolean checkEvents() { long count = 0; AerospikeClient client = null; try { client = new AerospikeClient(NODE, PORT); Statement stmnt = new Statement(); stmnt.setNamespace(NAMESPACE); stmnt.setSetName(SET_NAME); RecordSet rs = client.query(null, stmnt); while ( rs.next() ) { Record record = rs.getRecord(); Key key = rs.getKey(); if (!TestPOJO.check(key, record)) { return false; } count++; } } catch (AerospikeException e) { throw new RuntimeException("Error fetching records: ", e); } finally { if (null != client) { client.close(); } } return NUM_TUPLES == count; }