// Path: src/main/java/org/codelibs/fess/suggest/exception/SuggesterException.java
// public class SuggesterException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public SuggesterException(final String msg) {
//         super(msg);
//     }
// 
//     public SuggesterException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SuggesterException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// }
// 
// Path: src/main/java/org/codelibs/fess/suggest/request/Response.java
// public interface Response {
// }


import java.util.ArrayList;
import java.util.Queue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.codelibs.fess.suggest.exception.SuggesterException;
import org.codelibs.fess.suggest.request.Response;
            }
            return this;
        }

        public Promise error(final Consumer<Throwable> consumer) {
            final ArrayList<Consumer<Throwable>> executeCallbacks;
            synchronized (Deferred.this) {
                errorCallbacks.add(consumer);
                executeCallbacks = new ArrayList<>(errorCallbacks.size());
                if (error != null) {
                    Consumer<Throwable> callback;
                    while ((callback = errorCallbacks.poll()) != null) {
                        executeCallbacks.add(callback);
                    }
                }
            }
            if (executeCallbacks.size() > 0) {
                executeCallbacks.stream().forEach(callback -> callback.accept(error));
            }
            return this;
        }

        public RESPONSE getResponse() {
            return getResponse(1, TimeUnit.MINUTES);
        }

        public RESPONSE getResponse(final long time, final TimeUnit unit) {
            try {
                final boolean isTimeout = !latch.await(time, unit);
                if (isTimeout) {
// Path: src/main/java/org/codelibs/fess/suggest/exception/SuggesterException.java
// public class SuggesterException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public SuggesterException(final String msg) {
//         super(msg);
//     }
// 
//     public SuggesterException(final Throwable cause) {
//         super(cause);
//     }
// 
//     public SuggesterException(final String msg, final Throwable cause) {
//         super(msg, cause);
//     }
// }
// 
// Path: src/main/java/org/codelibs/fess/suggest/request/Response.java
// public interface Response {
// }


// Path: src/main/java/org/codelibs/fess/suggest/concurrent/Deferred.java
import java.util.ArrayList;
import java.util.Queue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import org.codelibs.fess.suggest.exception.SuggesterException;
import org.codelibs.fess.suggest.request.Response;

            }
            return this;
        }

        public Promise error(final Consumer<Throwable> consumer) {
            final ArrayList<Consumer<Throwable>> executeCallbacks;
            synchronized (Deferred.this) {
                errorCallbacks.add(consumer);
                executeCallbacks = new ArrayList<>(errorCallbacks.size());
                if (error != null) {
                    Consumer<Throwable> callback;
                    while ((callback = errorCallbacks.poll()) != null) {
                        executeCallbacks.add(callback);
                    }
                }
            }
            if (executeCallbacks.size() > 0) {
                executeCallbacks.stream().forEach(callback -> callback.accept(error));
            }
            return this;
        }

        public RESPONSE getResponse() {
            return getResponse(1, TimeUnit.MINUTES);
        }

        public RESPONSE getResponse(final long time, final TimeUnit unit) {
            try {
                final boolean isTimeout = !latch.await(time, unit);
                if (isTimeout) {
                    throw new SuggesterException("Request timeout. time:" + time + " unit:" + unit.name());