package org.ts.ddcs.Worker;

import org.ts.ddcs.DataTemplate.TemplateLineNode;
import org.ts.ddcs.Log.LogHelper;
import org.ts.ddcs.Tool.BytesHelp;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;

import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;

@SuppressWarnings("all")
public class DataRelayToDatabaseProcess implements Callable<Integer> {

    private TemplateLineNode templateLineNode;

    DataRelayToDatabaseProcess(TemplateLineNode templateLineNode) {
        this.templateLineNode = templateLineNode;
    }

    @Override
    public Integer call() throws Exception {
        try {
            if (null != templateLineNode.getDataRelayProcess()){
                templateLineNode.getDataRelayProcess().Save(templateLineNode.getDataTemplate());
            }
        }catch (Exception e){
            LogHelper.error(e);
        }
        return 0;
    }
}
