Package org.scale7.cassandra.pelops

Examples of org.scale7.cassandra.pelops.Selector


     *         are not provided.
     *
     */
    public static SimpleConnectionAuthenticator getAuthenticationRequest(String userName, String password)
    {
        SimpleConnectionAuthenticator authenticator = null;
        if (userName != null || password != null)
        {
            authenticator = new SimpleConnectionAuthenticator(userName, password);
        }
        return authenticator;
    }
View Full Code Here


public class Validation {

    public static ByteBuffer safeGetRowKey(Bytes rowKey) {
      if (rowKey == null || rowKey.isNull())
        throw new ModelException("Row Key is null");
      return rowKey.getBytes();
    }
View Full Code Here

    }

    public static List<String> validateRowKeysUtf8(List<String> rowKeys) {
      for (String s : rowKeys)
        if (s == null)
          throw new ModelException("Row key is null");
      return rowKeys;
    }
View Full Code Here

      return rowKeys;
    }

    public static Bytes validateRowKey(Bytes rowKey) {
      if (rowKey == null || rowKey.isNull())
        throw new ModelException("Row Key is null");
      return rowKey;
    }
View Full Code Here

      return rowKey;
    }

    public static void validateColumn(Column column) {
      if (!column.isSetName())
        throw new ModelException("Column name is null");
      if (!column.isSetValue())
        throw new ModelException("Column value is null");
  }
View Full Code Here

        throw new ModelException("Column value is null");
  }

    public static void validateColumn(CounterColumn column) {
      if (!column.isSetName())
        throw new ModelException("Column name is null");
      if (!column.isSetValue())
        throw new ModelException("Column value is null");
  }
View Full Code Here

      for (Bytes n : names) validateColumnName(n);
  }

    public static void validateColumnName(Bytes name) {
    if (name == null || name.isNull())
      throw new ModelException("Column name is null");
  }
View Full Code Here

       
        try {
            connection = new PooledConnection(nodes[index], keyspace);
            connection.open();
        } catch (Exception e) {
            throw new NoConnectionsAvailableException();
        }

        return connection;
    }
View Full Code Here

            logger.error(
                    "Failed to get a connection within the configured wait time because there are no available nodes. " +
                            "This possibly indicates that either the suspension strategy is too aggressive or that your " +
                            "cluster is in a bad way."
            );
            throw new NoConnectionsAvailableException("Failed to get a connection within the configured max wait time.");
        }

        if (connection == null) {
            logger.error(
                    "Failed to get a connection within the maximum allowed wait time.  " +
                            "Try increasing the either the number of allowed connections or the max wait time."
            );
            throw new NoConnectionsAvailableException("Failed to get a connection within the configured max wait time.");
        }

        logger.debug("Borrowing connection '{}'", connection);
        statistics.connectionsActive.incrementAndGet();
        reportConnectionBorrowed(connection.getNode().getAddress());
View Full Code Here

                logger.debug("Attempting to borrow free connection for node '{}'", node.getAddress());
                // note that if no connections are currently available for this node then the pool will sleep for
                // DEFAULT_WAIT_PERIOD milliseconds
                connection = pool.borrowObject(node.getAddress());
            } catch (IllegalStateException e) {
                throw new PelopsException("The pool has been shutdown", e);
            } catch (Exception e) {
                if (e instanceof NoSuchElementException) {
                    logger.debug("No free connections available for node '{}'.  Trying another node...", node.getAddress());
                } else if (e instanceof TTransportException) {
                    logger.warn(String.format("A TTransportException was thrown while attempting to create a connection to '%s'.  " +
View Full Code Here

TOP

Related Classes of org.scale7.cassandra.pelops.Selector

Copyright © 2018 www.massapicom. 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.