Examples of ConnectionSpec


Examples of org.jredis.connector.ConnectionSpec

 
  /**
   * Using the synchronous interface
   */
  public static void usingSyncClient () {
    ConnectionSpec spec = DefaultConnectionSpec.newSpec()
    .setCredentials("jredis".getBytes())
    .setDatabase(10);

    JRedis jredis = new JRedisClient(spec);

View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

 
  /**
   * Using the asynchronous interface
   */
  public static void usingAsyncClient () {
    ConnectionSpec spec = DefaultConnectionSpec.newSpec()
    .setCredentials("jredis".getBytes())
    .setDatabase(10);

    JRedisFuture jredis = new JRedisAsyncClient(spec);

View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

 
  /**
   * Using the synchronous interface
   */
  public static void usingSyncClient () {
    ConnectionSpec spec = DefaultConnectionSpec.newSpec()
    .setCredentials("jredis".getBytes())
    .setDatabase(10);

    JRedis jredis = new JRedisClient(spec);

View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

  /**
   * Using the asynchronous interface
   */
  public static void usingAsyncClient () {
    ConnectionSpec spec = DefaultConnectionSpec.newSpec()
    .setCredentials("jredis".getBytes())
    .setDatabase(10);

    JRedisFuture jredis = new JRedisAsyncClient(spec);

View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

      byte[]       credentials
    )
    throws ClientRuntimeException
  {
//    return new DefaultConnectionSpec(address, port, database, credentials);
    ConnectionSpec spec = new DefaultConnectionSpec();
    return spec.setAddress(address).setPort(port).setDatabase(database).setCredentials(credentials);
   
  }
View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

   * @return
   */
  public static ClusterSpec newSpecForRange (ConnectionSpec templateConnSpec, int firstPort, int lastPort) {
    ClusterSpec spec = new DefaultClusterSpec();
    for(int i=firstPort; i<=lastPort; i++){
      ConnectionSpec connSpec = DefaultConnectionSpec.newSpec()
        .setAddress(templateConnSpec.getAddress())
        .setPort(i)
        .setDatabase(templateConnSpec.getDatabase())
        .setCredentials(templateConnSpec.getCredentials());
      ClusterNodeSpec nodeSpec = new DefaultClusterNodeSpec(connSpec);
View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

  // Interface
  // ------------------------------------------------------------------------
 
  public static ClusterNodeSpec getSpecFor(Socket conn){
    if(null == conn) throw new IllegalArgumentException("null arg [conn]");
    ConnectionSpec connSpec = DefaultConnectionSpec.newSpec(conn.getInetAddress(), conn.getPort(), 0, null);
    return new DefaultClusterNodeSpec(connSpec);
  }
View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

   */
  @Override
  protected JRedisFuture newProviderInstance () {
    JRedisFuture provider = null;
    try {
      ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(this.host, this.port, this.db2, this.password.getBytes());
      provider = new JRedisAsyncClient(connectionSpec);
        }
        catch (ClientRuntimeException e) {
          Log.error(e.getLocalizedMessage());
        }
View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

   */
  @Override
  protected JRedisFuture newProviderInstance () {
    JRedisFuture provider = null;
    try {
      ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(this.host, this.port, this.db2, this.password.getBytes());
      provider = new JRedisPipeline(connectionSpec);
        }
        catch (ClientRuntimeException e) {
          Log.error(e.getLocalizedMessage());
        }
View Full Code Here

Examples of org.jredis.connector.ConnectionSpec

   * @param timeout The socket timeout or 0 to use the default socket timeout
   * @param poolConfig The pool {@link Config}
   */
  public JredisPool(String hostName, int port, int dbIndex, String password, int timeout,
      GenericObjectPoolConfig poolConfig) {
    ConnectionSpec connectionSpec = DefaultConnectionSpec.newSpec(hostName, port, dbIndex, null);
    connectionSpec.setConnectionFlag(Connection.Flag.RELIABLE, false);
    if (StringUtils.hasLength(password)) {
      connectionSpec.setCredentials(password);
    }
    if (timeout > 0) {
      connectionSpec.setSocketProperty(Property.SO_TIMEOUT, timeout);
    }
    this.internalPool = new GenericObjectPool<JRedis>(new JredisFactory(connectionSpec), poolConfig);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.