class RandomSelectStrategy implements ConnectionSelectStrategy {

    private static final Logger logger    = BoltLoggerFactory.getLogger("CommonDefault");

    private static final int    MAX_TIMES = 5;
    private final Random        random    = new Random();
    private final Configuration configuration;

    public RandomSelectStrategy(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public Connection select(List<Connection> connections) {<FILL_FUNCTION_BODY>}

    /**
     * get one connection randomly
     * 
     * @param connections source connections
     * @return result connection
     */
    private Connection randomGet(List<Connection> connections) {
        if (null == connections || connections.isEmpty()) {
            return null;
        }

        int size = connections.size();
        int tries = 0;
        Connection result = null;
        while ((result == null || !result.isFine()) && tries++ < MAX_TIMES) {
            result = connections.get(this.random.nextInt(size));
        }

        if (result != null && !result.isFine()) {
            result = null;
        }
        return result;
    }
}

        try {
            if (connections == null) {
                return null;
            }
            int size = connections.size();
            if (size == 0) {
                return null;
            }

            Connection result;
            if (configuration != null && configuration.option(BoltClientOption.CONN_MONITOR_SWITCH)) {
                List<Connection> serviceStatusOnConnections = new ArrayList<Connection>();
                for (Connection conn : connections) {
                    String serviceStatus = (String) conn.getAttribute(Configs.CONN_SERVICE_STATUS);
                    if (!StringUtils.equals(serviceStatus, Configs.CONN_SERVICE_STATUS_OFF)) {
                        serviceStatusOnConnections.add(conn);
                    }
                }
                if (serviceStatusOnConnections.size() == 0) {
                    throw new Exception(
                        "No available connection when select in RandomSelectStrategy.");
                }
                result = randomGet(serviceStatusOnConnections);
            } else {
                result = randomGet(connections);
            }
            return result;
        } catch (Throwable e) {
            logger.error("Choose connection failed using RandomSelectStrategy!", e);
            return null;
        }
    
<no_super_class>