congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AerospikeClient.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.aerospike.client.AerospikeClient
constructor

Best Java code snippets using com.aerospike.client.AerospikeClient.<init> (Showing top 20 results out of 315)

origin: brianfrankcooper/YCSB

@Override
public void init() throws DBException {
 insertPolicy.recordExistsAction = RecordExistsAction.CREATE_ONLY;
 updatePolicy.recordExistsAction = RecordExistsAction.REPLACE_ONLY;
 Properties props = getProperties();
 namespace = props.getProperty("as.namespace", DEFAULT_NAMESPACE);
 String host = props.getProperty("as.host", DEFAULT_HOST);
 String user = props.getProperty("as.user");
 String password = props.getProperty("as.password");
 int port = Integer.parseInt(props.getProperty("as.port", DEFAULT_PORT));
 int timeout = Integer.parseInt(props.getProperty("as.timeout",
   DEFAULT_TIMEOUT));
 readPolicy.timeout = timeout;
 insertPolicy.timeout = timeout;
 updatePolicy.timeout = timeout;
 deletePolicy.timeout = timeout;
 ClientPolicy clientPolicy = new ClientPolicy();
 if (user != null && password != null) {
  clientPolicy.user = user;
  clientPolicy.password = password;
 }
 try {
  client =
    new com.aerospike.client.AerospikeClient(clientPolicy, host, port);
 } catch (AerospikeException e) {
  throw new DBException(String.format("Error while creating Aerospike " +
    "client for %s:%d.", host, port), e);
 }
}
origin: benmfaul/XRTB

public static AerospikeHandler getInstance(String host, int port, int connections) {
  INSTANCE.host = host;
  INSTANCE.port = port;
  INSTANCE.count = connections / 300;
  if (connections % 300 > 0)
    INSTANCE.count++;
  
  for (int i=0;i<INSTANCE.count;i++) {
    AerospikeClient x = new AerospikeClient(host,port);
    INSTANCE.clients.add(x);
  }
  INSTANCE.count = INSTANCE.clients.size();
  return INSTANCE;
}

origin: org.apache.apex/malhar-contrib

/**
 * Create connection with database.
 */
@Override
public void connect() {
 try {
  client = new AerospikeClient(node, port);
  logger.debug("Aerospike connection Success");
 }
 catch (AerospikeException ex) {
  throw new RuntimeException("closing database resource", ex);
 }
 catch (Throwable t) {
  DTThrowable.rethrow(t);
 }
}
origin: apache/apex-malhar

/**
 * Create connection with database.
 */
@Override
public void connect()
{
 try {
  client = new AerospikeClient(node, port);
  logger.debug("Aerospike connection Success");
 } catch (AerospikeException ex) {
  throw new RuntimeException("closing database resource", ex);
 } catch (Throwable t) {
  DTThrowable.rethrow(t);
 }
}
origin: spring-projects/spring-data-aerospike

@Bean(name = "aerospikeClient", destroyMethod = "close")
public AerospikeClient aerospikeClient() {
  Collection<Host> hosts = getHosts();
  return new AerospikeClient(getClientPolicy(), hosts.toArray(new Host[hosts.size()]));
}
origin: benmfaul/XRTB

  public static void main(String args[]) throws Exception {
    AerospikeClient client = new AerospikeClient(args[0], 3000);
    String skey = "accountingsystem";
    Key key = new Key("test", "cache", skey);
    
    while(true) {
      Record record = null;
      record = client.get(null, key);
      String value = (String)record.bins.get("value");
      System.out.println(value);
      Thread.sleep(1000);
    }
  }
}
origin: benmfaul/XRTB

  /**
   * Let's test this mess.
   * @param args
   * @throws Exception
   */
  public static void main(String args[]) throws Exception {
    AerospikeClient client = new AerospikeClient("localhost",3000);
    Membership m = new Membership("c1x-cookies", "/home/ben/Downloads/c1x_cookies.csv", client);
    System.out.println(m.query("9786B01215534DEB9AAC2D5FEE23A497"));
  }
}
origin: benmfaul/XRTB

AerospikeClient x = new AerospikeClient(host,port);
clients.add(x);
origin: benmfaul/XRTB

boolean range = false;
AerospikeClient client = new AerospikeClient("localhost",3000);
origin: aerospike/aerospike-loader

private static AerospikeClient getAerospikeClient(CommandLine cl) {
  ClientPolicy clientPolicy = new ClientPolicy();	
  
  initClientPolicy(cl, clientPolicy);
  
  AerospikeClient client = new AerospikeClient(clientPolicy, params.hosts);
  if (!client.isConnected()) {
    log.error("Client is not able to connect:" + params.hosts);
    return null;
  }
  try {
    // Check read-write role is given to user.
    if (!client.queryUser(null, clientPolicy.user).roles.contains(Role.ReadWrite)) {
      log.error("User role:" + client.queryUser(null, clientPolicy.user).roles.toString() + " Expected:" + Role.ReadWrite);
      return null;
    }
  }
  catch (AerospikeException e) {
    // Ignore if security is not enabled.
  }
  return client;
}
origin: Playtika/testcontainers-spring-boot

@Override
protected boolean isReady() {
  String containerId = waitStrategyTarget.getContainerId();
  log.debug("Check Aerospike container {} status", containerId);
  InspectContainerResponse containerInfo = waitStrategyTarget.getContainerInfo();
  if (containerInfo == null) {
    log.debug("Aerospike container[{}] doesn't contain info. Abnormal situation, should not happen.", containerId);
    return false;
  }
  int port = getMappedPort(containerInfo.getNetworkSettings(), properties.port);
  String host = DockerClientFactory.instance().dockerHostIpAddress();
  //TODO: Remove dependency to client https://www.aerospike.com/docs/tools/asmonitor/common_tasks.html
  try (AerospikeClient client = new AerospikeClient(host, port)) {
    return client.isConnected();
  } catch (AerospikeException.Connection e) {
    log.debug("Aerospike container: {} not yet started. {}", containerId, e.getMessage());
  }
  return false;
}
origin: aerospike/aerospike-client-java

/**
 * 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();
  }
}
origin: apache/apex-malhar

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();
  }
 }
}
origin: apache/apex-malhar

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();
  }
 }
}
origin: org.apache.gora/gora-aerospike

aerospikeClient = new AerospikeClient(policy, aerospikeParameters.getHost(),
    aerospikeParameters.getPort());
aerospikeParameters.setServerSpecificParameters(aerospikeClient);
origin: aerospike/aerospike-client-java

AerospikeClient client = new AerospikeClient(policy, hosts);
origin: apache/gora

aerospikeClient = new AerospikeClient(policy, aerospikeParameters.getHost(),
    aerospikeParameters.getPort());
aerospikeParameters.setServerSpecificParameters(aerospikeClient);
origin: apache/apex-malhar

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();
  }
 }
}
origin: apache/apex-malhar

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();
  }
 }
}
origin: apache/apex-malhar

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;
}
com.aerospike.clientAerospikeClient<init>

Javadoc

Asynchronous default constructor. Do not use directly.

Popular methods of AerospikeClient

  • put
    Write record bin(s). The policy specifies the transaction timeout, record expiration and how the tra
  • close
    Close all client connections to database server nodes. If event loops are defined, the client will s
  • delete
    Delete record for specified key. The policy specifies the transaction timeout.
  • get
    Read record header and bins for specified key. The policy can be used to specify timeouts.
  • query
    Execute query on all server nodes and return record iterator. The query executor puts records on a q
  • getNodes
    Return array of active server nodes in the cluster.
  • createIndex
  • execute
    Apply user defined function on records that match the statement filter. Records are not returned to
  • queryAggregate
    Execute query, apply statement's aggregation function, and return result iterator. The query executo
  • isConnected
    Determine if we are ready to talk to the database server cluster.
  • operate
    Perform multiple read/write operations on a single key in one batch call. An example would be to add
  • register
    Register package located in a file containing user defined functions with server. This asynchronous
  • operate,
  • register,
  • add,
  • dropIndex,
  • exists,
  • getHeader,
  • getNodeNames,
  • scanAll,
  • scanNode

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now