// Path: src/main/java/com/groupon/vertx/memcache/client/response/RetrieveCommandResponse.java
// public final class RetrieveCommandResponse extends MemcacheCommandResponse {
//     private final Map<String, String> data;
// 
//     private RetrieveCommandResponse(Builder builder) {
//         super(builder);
//         data = Collections.unmodifiableMap(new HashMap<>(builder.data));
//     }
// 
//     public Map<String, String> getData() {
//         return data;
//     }
// 
//     /**
//      * Builder for the RetrieveCommandResponse
//      */
//     public static class Builder extends AbstractBuilder<Builder, RetrieveCommandResponse> {
//         private Map<String, String> data = new HashMap<>();
// 
//         @Override
//         protected Builder self() {
//             return this;
//         }
// 
//         public Builder setData(Map<String, String> value) {
//             if (value == null) {
//                 data = new HashMap<>();
//             } else {
//                 data = value;
//             }
//             return self();
//         }
// 
//         public Builder addData(String key, String value) {
//             data.put(key, value);
//             return self();
//         }
// 
//         @Override
//         public RetrieveCommandResponse build() {
//             return new RetrieveCommandResponse(this);
//         }
//     }
// }


import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import com.groupon.vertx.memcache.client.response.RetrieveCommandResponse;
import com.groupon.vertx.utils.Logger;
    private int failure = 0;

    public MemcacheClientMultiResponseHandler(Future<RetrieveCommandResponse> result, int totalCommands) {
        this.result = result;
        this.counter = new AtomicInteger(totalCommands);
        this.builder = new RetrieveCommandResponse.Builder();
        this.errors = new ArrayList<>();
    }

    /**
     * This handles the incoming Memcache command JSON.
     *
     * @param command - The JsonObject containing the command and arguments to send to Memcache.
     */
    public void handle(final AsyncResult<RetrieveCommandResponse> command) {
        if (command.succeeded()) {
            RetrieveCommandResponse body = command.result();
            if (body == null) {
                log.warn("handleCommand", "queueFailure", new String[]{"reason"}, "Missing message body");
                failure++;
            } else {
                log.trace("handleCommand", "queueReply", new String[]{"response"}, body);
                switch (body.getStatus()) {
                    case success:
                        for (Map.Entry<String, String> entry : body.getData().entrySet()) {
                            builder.addData(entry.getKey(), entry.getValue());
                        }
                        success++;
                        break;
                    case fail:
// Path: src/main/java/com/groupon/vertx/memcache/client/response/RetrieveCommandResponse.java
// public final class RetrieveCommandResponse extends MemcacheCommandResponse {
//     private final Map<String, String> data;
// 
//     private RetrieveCommandResponse(Builder builder) {
//         super(builder);
//         data = Collections.unmodifiableMap(new HashMap<>(builder.data));
//     }
// 
//     public Map<String, String> getData() {
//         return data;
//     }
// 
//     /**
//      * Builder for the RetrieveCommandResponse
//      */
//     public static class Builder extends AbstractBuilder<Builder, RetrieveCommandResponse> {
//         private Map<String, String> data = new HashMap<>();
// 
//         @Override
//         protected Builder self() {
//             return this;
//         }
// 
//         public Builder setData(Map<String, String> value) {
//             if (value == null) {
//                 data = new HashMap<>();
//             } else {
//                 data = value;
//             }
//             return self();
//         }
// 
//         public Builder addData(String key, String value) {
//             data.put(key, value);
//             return self();
//         }
// 
//         @Override
//         public RetrieveCommandResponse build() {
//             return new RetrieveCommandResponse(this);
//         }
//     }
// }


// Path: src/main/java/com/groupon/vertx/memcache/client/MemcacheClientMultiResponseHandler.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import com.groupon.vertx.memcache.client.response.RetrieveCommandResponse;
import com.groupon.vertx.utils.Logger;

    private int failure = 0;

    public MemcacheClientMultiResponseHandler(Future<RetrieveCommandResponse> result, int totalCommands) {
        this.result = result;
        this.counter = new AtomicInteger(totalCommands);
        this.builder = new RetrieveCommandResponse.Builder();
        this.errors = new ArrayList<>();
    }

    /**
     * This handles the incoming Memcache command JSON.
     *
     * @param command - The JsonObject containing the command and arguments to send to Memcache.
     */
    public void handle(final AsyncResult<RetrieveCommandResponse> command) {
        if (command.succeeded()) {
            RetrieveCommandResponse body = command.result();
            if (body == null) {
                log.warn("handleCommand", "queueFailure", new String[]{"reason"}, "Missing message body");
                failure++;
            } else {
                log.trace("handleCommand", "queueReply", new String[]{"response"}, body);
                switch (body.getStatus()) {
                    case success:
                        for (Map.Entry<String, String> entry : body.getData().entrySet()) {
                            builder.addData(entry.getKey(), entry.getValue());
                        }
                        success++;
                        break;
                    case fail:
                        failure++;