@Override
    public void close() {
	if (dataSource != null) {
	    boolean broken = false;

	    for (Jedis jedis : getAllShards()) {
		if (jedis.getClient().isBroken()) {
		    broken = true;
		}
	    }

	    if (broken) {
		dataSource.returnBrokenResource(this);
	    } else {
		this.resetState();
		dataSource.returnResource(this);
	    }

	} else {
	    disconnect();
	}
    }