// Path: core/src/main/java/com/offbynull/actors/shuttle/Shuttle.java
// public interface Shuttle {
//     /**
//      * Address prefix this shuttle is for.
//      * @return address prefix
//      */
//     String getPrefix();
//     /**
//      * Sends {@link Message}s to the specific actor or gateway this {@link Shuttle} is for. Each message's destination
//      * address must contain the same prefix as that returned by {@link #getPrefix() }, otherwise that message will be silently discarded.
//      * @param messages messages to send
//      * @throws NullPointerException if any argument is {@code null} or contains {@code null}
//      */
//     void send(Collection<Message> messages);
//     
//     /**
//      * Sends a {@link Message} to the specific actor or gateway this {@link Shuttle} is for. Equivalent to calling
//      * {@code send(Collections.singleton(message))}.
//      * @param message message to send
//      * @throws NullPointerException if any argument is {@code null}
//      */    
//     default void send(Message message) {
//         send(Collections.singleton(message));
//     }
// }


import com.offbynull.actors.shuttle.Message;
import com.offbynull.actors.shuttle.Shuttle;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
 * Copyright (c) 2017, Kasra Faghihi, All rights reserved.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 */
package com.offbynull.actors.shuttles.pump;


/**
 * Controls a {@link PumpShuttle}.
 * @author Kasra Faghihi
 */
public final class PumpShuttleController implements Closeable {
    
    private static final Logger LOG = LoggerFactory.getLogger(PumpShuttleController.class);

    private final LinkedBlockingQueue<Collection<Message>> queue;    
    private final PumpShuttle pumpShuttle;
// Path: core/src/main/java/com/offbynull/actors/shuttle/Shuttle.java
// public interface Shuttle {
//     /**
//      * Address prefix this shuttle is for.
//      * @return address prefix
//      */
//     String getPrefix();
//     /**
//      * Sends {@link Message}s to the specific actor or gateway this {@link Shuttle} is for. Each message's destination
//      * address must contain the same prefix as that returned by {@link #getPrefix() }, otherwise that message will be silently discarded.
//      * @param messages messages to send
//      * @throws NullPointerException if any argument is {@code null} or contains {@code null}
//      */
//     void send(Collection<Message> messages);
//     
//     /**
//      * Sends a {@link Message} to the specific actor or gateway this {@link Shuttle} is for. Equivalent to calling
//      * {@code send(Collections.singleton(message))}.
//      * @param message message to send
//      * @throws NullPointerException if any argument is {@code null}
//      */    
//     default void send(Message message) {
//         send(Collections.singleton(message));
//     }
// }


// Path: core/src/main/java/com/offbynull/actors/shuttles/pump/PumpShuttleController.java
import com.offbynull.actors.shuttle.Message;
import com.offbynull.actors.shuttle.Shuttle;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
 * Copyright (c) 2017, Kasra Faghihi, All rights reserved.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 */
package com.offbynull.actors.shuttles.pump;


/**
 * Controls a {@link PumpShuttle}.
 * @author Kasra Faghihi
 */
public final class PumpShuttleController implements Closeable {
    
    private static final Logger LOG = LoggerFactory.getLogger(PumpShuttleController.class);

    private final LinkedBlockingQueue<Collection<Message>> queue;    
    private final PumpShuttle pumpShuttle;
    private final Shuttle backingShuttle;