Example usage for org.springframework.dao InvalidDataAccessApiUsageException InvalidDataAccessApiUsageException

List of usage examples for org.springframework.dao InvalidDataAccessApiUsageException InvalidDataAccessApiUsageException

Introduction

In this page you can find the example usage for org.springframework.dao InvalidDataAccessApiUsageException InvalidDataAccessApiUsageException.

Prototype

public InvalidDataAccessApiUsageException(String msg) 

Source Link

Document

Constructor for InvalidDataAccessApiUsageException.

Usage

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public void multi() {
    throw new InvalidDataAccessApiUsageException("MUTLI is currently not supported in cluster mode.");
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public List<Object> exec() {
    throw new InvalidDataAccessApiUsageException("EXEC is currently not supported in cluster mode.");
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public void discard() {
    throw new InvalidDataAccessApiUsageException("DISCARD is currently not supported in cluster mode.");
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public void watch(byte[]... keys) {
    throw new InvalidDataAccessApiUsageException("WATCH is currently not supported in cluster mode.");
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public void unwatch() {
    throw new InvalidDataAccessApiUsageException("UNWATCH is currently not supported in cluster mode.");
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

@Override
public void select(int dbIndex) {

    if (dbIndex != 0) {
        throw new InvalidDataAccessApiUsageException("Cannot SELECT non zero index in cluster mode.");
    }/*from w w  w . j a  v  a2  s.  co m*/
}

From source file:org.springframework.data.redis.connection.jedis.JedisConnectionFactory.java

@Override
public RedisClusterConnection getClusterConnection() {

    if (cluster == null) {
        throw new InvalidDataAccessApiUsageException("Cluster is not configured!");
    }//from   ww  w. j  a  v  a 2s . com
    return new JedisClusterConnection(cluster, clusterCommandExecutor);
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.java

@Override
public void clusterSetSlot(RedisClusterNode node, int slot, AddSlots mode) {

    Assert.notNull(node, "Node must not be null.");
    Assert.notNull(mode, "AddSlots mode must not be null.");

    RedisClusterNode nodeToUse = topologyProvider.getTopology().lookup(node);
    String nodeId = nodeToUse.getId();

    clusterCommandExecutor.executeCommandOnSingleNode((LettuceClusterCommandCallback<String>) client -> {
        switch (mode) {
        case MIGRATING:
            return client.clusterSetSlotMigrating(slot, nodeId);
        case IMPORTING:
            return client.clusterSetSlotImporting(slot, nodeId);
        case NODE:
            return client.clusterSetSlotNode(slot, nodeId);
        case STABLE:
            return client.clusterSetSlotStable(slot);
        default://from w  ww  .  j a  v  a2  s.  c o m
            throw new InvalidDataAccessApiUsageException("Invalid import mode for cluster slot: " + slot);
        }
    }, node);
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.java

@Override
public void multi() {
    throw new InvalidDataAccessApiUsageException("MULTI is currently not supported in cluster mode.");
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.java

@Override
public RedisClusterConnection getClusterConnection() {

    if (!isClusterAware()) {
        throw new InvalidDataAccessApiUsageException("Cluster is not configured!");
    }//w  w w.  jav a  2 s .co  m

    return new LettuceClusterConnection((RedisClusterClient) client, clusterCommandExecutor);
}