class GridRedisRestCommandHandler implements GridRedisCommandHandler {
    /** Logger. */
    protected final IgniteLogger log;

    /** REST protocol handler. */
    protected final GridRestProtocolHandler hnd;

    /** Kernel context. */
    protected final GridKernalContext ctx;

    /**
     * Constructor.
     *
     * @param log Logger.
     * @param hnd REST protocol handler.
     * @param ctx Kernal context.
     */
    protected GridRedisRestCommandHandler(IgniteLogger log, GridRestProtocolHandler hnd, GridKernalContext ctx) {
        this.log = log;
        this.hnd = hnd;
        this.ctx = ctx;
    }

    /** {@inheritDoc} */
    @Override public IgniteInternalFuture<GridRedisMessage> handleAsync(final GridNioSession ses,
        final GridRedisMessage msg) {
        assert msg != null;

        try {
            return hnd.handleAsync(asRestRequest(msg))
                .chain(new CX1<IgniteInternalFuture<GridRestResponse>, GridRedisMessage>() {
                    @Override public GridRedisMessage applyx(IgniteInternalFuture<GridRestResponse> f)
                        throws IgniteCheckedException {
                        GridRestResponse restRes = f.get();

                        if (restRes.getSuccessStatus() == GridRestResponse.STATUS_SUCCESS)
                            msg.setResponse(makeResponse(restRes, msg.auxMKeys()));
                        else
                            msg.setResponse(GridRedisProtocolParser.toGenericError("Operation error"));

                        return msg;
                    }
                }, ctx.pools().getRestExecutorService());
        }
        catch (IgniteCheckedException e) {
            if (e instanceof GridRedisTypeException)
                msg.setResponse(GridRedisProtocolParser.toTypeError(e.getMessage()));
            else
                msg.setResponse(GridRedisProtocolParser.toGenericError(e.getMessage()));

            return new GridFinishedFuture<>(msg);
        }
    }

    /**
     * Retrieves long value following the parameter name from parameters list.
     *
     * @param name Parameter name.
     * @param params Parameters list.
     * @return Long value from parameters list or null if not exists.
     * @throws GridRedisGenericException If parsing failed.
     */
    @Nullable protected Long longValue(String name, List<String> params) throws GridRedisGenericException {<FILL_FUNCTION_BODY>}

    /**
     * Converts {@link GridRedisMessage} to {@link GridRestRequest}.
     *
     * @param msg {@link GridRedisMessage}
     * @return {@link GridRestRequest}
     * @throws IgniteCheckedException If fails.
     */
    public abstract GridRestRequest asRestRequest(GridRedisMessage msg) throws IgniteCheckedException;

    /**
     * Prepares a response according to the request.
     *
     * @param resp REST response.
     * @param params Auxiliary parameters.
     * @return Response for the command.
     */
    public abstract ByteBuffer makeResponse(GridRestResponse resp, List<String> params);
}

        assert name != null;

        Iterator<String> it = params.iterator();

        while (it.hasNext()) {
            if (name.equalsIgnoreCase(it.next())) {
                if (it.hasNext()) {
                    String val = it.next();

                    try {
                        return Long.valueOf(val);
                    }
                    catch (NumberFormatException ignore) {
                        throw new GridRedisGenericException("Failed to parse parameter of Long type [" + name + "=" + val + "]");
                    }
                }
                else
                    throw new GridRedisGenericException("Syntax error. Missing value for parameter: " + name);
            }
        }

        return null;
    
<no_super_class>