// Path: src/main/java/com/officedrop/redis/failover/jedis/ConnectionException.java
// public class ConnectionException extends RuntimeException {
// 
//     public ConnectionException(final Throwable cause) {
//         super(cause);
//     }
// 
// }
// 
// Path: src/main/java/com/officedrop/redis/failover/jedis/JedisActions.java
// public interface JedisActions extends JedisCommands {
// 
//     public Long del(final String... keys);
// 
//     public String quit();
// 
//     public String ping();
// 
//     public String slaveof(final String host, final int port);
// 
//     public String slaveofNoOne();
// 
//     public String info();
// 
// }
// 
// Path: src/main/java/com/officedrop/redis/failover/jedis/JedisClientFactory.java
// public interface JedisClientFactory {
// 
//     public JedisClient create( HostConfiguration configuration  );
// 
// }


import com.officedrop.redis.failover.jedis.ConnectionException;
import com.officedrop.redis.failover.jedis.JedisActions;
import com.officedrop.redis.failover.jedis.JedisClientFactory;
import com.officedrop.redis.failover.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.StringReader;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
                        log.error(String.format("Failed to signal offline event to listener %s", listener), exception);
                    }
                }
            }
        }
    }

    private void nodeAction(final Action1<JedisActions> action) {
        this.nodeFunction(new Function1<JedisActions, Object>() {
            @Override
            public Object apply(final JedisActions parameter) {
                action.apply(parameter);
                return null;
            }
        });
    }

    private <OUT> OUT nodeFunction(Function1<JedisActions, OUT> function) {
        try {
            this.lock.lock();

            if (this.client == null) {
                this.client = this.factory.create(this.hostConfiguration);
            }

            return function.apply(this.client);

        } catch (Exception e) {
            this.client = null;
            this.fireErrorEvent(e);
// Path: src/main/java/com/officedrop/redis/failover/jedis/ConnectionException.java
// public class ConnectionException extends RuntimeException {
// 
//     public ConnectionException(final Throwable cause) {
//         super(cause);
//     }
// 
// }
// 
// Path: src/main/java/com/officedrop/redis/failover/jedis/JedisActions.java
// public interface JedisActions extends JedisCommands {
// 
//     public Long del(final String... keys);
// 
//     public String quit();
// 
//     public String ping();
// 
//     public String slaveof(final String host, final int port);
// 
//     public String slaveofNoOne();
// 
//     public String info();
// 
// }
// 
// Path: src/main/java/com/officedrop/redis/failover/jedis/JedisClientFactory.java
// public interface JedisClientFactory {
// 
//     public JedisClient create( HostConfiguration configuration  );
// 
// }


// Path: src/main/java/com/officedrop/redis/failover/Node.java
import com.officedrop.redis.failover.jedis.ConnectionException;
import com.officedrop.redis.failover.jedis.JedisActions;
import com.officedrop.redis.failover.jedis.JedisClientFactory;
import com.officedrop.redis.failover.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.StringReader;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

                        log.error(String.format("Failed to signal offline event to listener %s", listener), exception);
                    }
                }
            }
        }
    }

    private void nodeAction(final Action1<JedisActions> action) {
        this.nodeFunction(new Function1<JedisActions, Object>() {
            @Override
            public Object apply(final JedisActions parameter) {
                action.apply(parameter);
                return null;
            }
        });
    }

    private <OUT> OUT nodeFunction(Function1<JedisActions, OUT> function) {
        try {
            this.lock.lock();

            if (this.client == null) {
                this.client = this.factory.create(this.hostConfiguration);
            }

            return function.apply(this.client);

        } catch (Exception e) {
            this.client = null;
            this.fireErrorEvent(e);
            throw new ConnectionException(e);