// Path: fluency-core/src/main/java/org/komamitsu/fluency/ingester/sender/ErrorHandler.java
// public interface ErrorHandler
// {
//     void handle(Throwable e);
// }
// 
// Path: fluency-core/src/main/java/org/komamitsu/fluency/ingester/sender/Sender.java
// public interface Sender
// {
//     class Config
//     {
//         private ErrorHandler errorHandler;
// 
//         public ErrorHandler getErrorHandler()
//         {
//             return errorHandler;
//         }
// 
//         public void setErrorHandler(ErrorHandler errorHandler)
//         {
//             this.errorHandler = errorHandler;
//         }
// 
//         @Override
//         public String toString()
//         {
//             return "Config{" +
//                     "senderErrorHandler=" + errorHandler +
//                     '}';
//         }
//     }
// }


import org.komamitsu.fluency.ingester.sender.ErrorHandler;
import org.komamitsu.fluency.ingester.sender.Sender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
    }

    public synchronized void send(List<ByteBuffer> buffers)
            throws IOException
    {
        sendInternalWithRestoreBufferPositions(buffers, null);
    }

    public void sendWithAck(List<ByteBuffer> buffers, String ackToken)
            throws IOException
    {
        sendInternalWithRestoreBufferPositions(buffers, ackToken);
    }

    private void sendInternalWithRestoreBufferPositions(List<ByteBuffer> buffers, String ackToken)
            throws IOException
    {
        List<Integer> positions = new ArrayList<>(buffers.size());
        for (ByteBuffer data : buffers) {
            positions.add(data.position());
        }

        try {
            sendInternal(buffers, ackToken);
        }
        catch (Exception e) {
            for (int i = 0; i < buffers.size(); i++) {
                buffers.get(i).position(positions.get(i));
            }

// Path: fluency-core/src/main/java/org/komamitsu/fluency/ingester/sender/ErrorHandler.java
// public interface ErrorHandler
// {
//     void handle(Throwable e);
// }
// 
// Path: fluency-core/src/main/java/org/komamitsu/fluency/ingester/sender/Sender.java
// public interface Sender
// {
//     class Config
//     {
//         private ErrorHandler errorHandler;
// 
//         public ErrorHandler getErrorHandler()
//         {
//             return errorHandler;
//         }
// 
//         public void setErrorHandler(ErrorHandler errorHandler)
//         {
//             this.errorHandler = errorHandler;
//         }
// 
//         @Override
//         public String toString()
//         {
//             return "Config{" +
//                     "senderErrorHandler=" + errorHandler +
//                     '}';
//         }
//     }
// }


// Path: fluency-fluentd/src/main/java/org/komamitsu/fluency/fluentd/ingester/sender/FluentdSender.java
import org.komamitsu.fluency.ingester.sender.ErrorHandler;
import org.komamitsu.fluency.ingester.sender.Sender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

    }

    public synchronized void send(List<ByteBuffer> buffers)
            throws IOException
    {
        sendInternalWithRestoreBufferPositions(buffers, null);
    }

    public void sendWithAck(List<ByteBuffer> buffers, String ackToken)
            throws IOException
    {
        sendInternalWithRestoreBufferPositions(buffers, ackToken);
    }

    private void sendInternalWithRestoreBufferPositions(List<ByteBuffer> buffers, String ackToken)
            throws IOException
    {
        List<Integer> positions = new ArrayList<>(buffers.size());
        for (ByteBuffer data : buffers) {
            positions.add(data.position());
        }

        try {
            sendInternal(buffers, ackToken);
        }
        catch (Exception e) {
            for (int i = 0; i < buffers.size(); i++) {
                buffers.get(i).position(positions.get(i));
            }

            ErrorHandler errorHandler = config.getErrorHandler();