advantageous/qbit

SimpleVertxHttpServerWrapper should not create a HashMap on every request.

RichardHightower opened this issue · 1 comments

SimpleVertxHttpServerWrapper should not create a HashMap on every request.

    private void handleHttpRequest(final HttpServerRequest request) {
        handleHttpRequest(request, new HashMap<>());
    }

Part of the issue is HttpRequest holds a final map.

public class HttpRequest implements Request<Object> {

    private final Map<String, Object> data;

We should probably create a final atomicReference to a Map so that the map can be set by the users. Then add an addDataObject("foo", foo) method that will lazy init the map if needed.