Code example for Supplier

Methods: get

0
        this.consistencyLevel = consistencyLevel;
        return this;
    } 
 
    public String isUnique(K key) throws ConnectionException {
        String unique = uniqueColumnSupplier.get();
 
        // Phase 1: Write a unique column 
        MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel);
        m.withRow(columnFamily, key).putEmptyColumn(prefix + unique, ttl);
 
        m.execute();
 
        // Phase 2: Read back all columns. There should be only 1 
        ColumnList<String> result = keyspace.prepareQuery(columnFamily).setConsistencyLevel(consistencyLevel)
                .getKey(key)
                .withColumnRange(new RangeBuilder().setStart(prefix + "\u0000").setEnd(prefix + "\uFFFF").build())
                .execute().getResult(); 
 
        if (result.size() == 1) {