Authored by zhengyouwei

fix influx

package com.monitor.nginxsync.nio.service;
import com.monitor.nginxsync.nio.handler.LogMsgHandler;
import com.squareup.okhttp.Call;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
... ...
package com.monitor.zabbix.comp;
import com.monitor.zabbix.constants.Constants;
import com.squareup.okhttp.OkHttpClient;
import okhttp3.OkHttpClient;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import org.influxdb.dto.BatchPoints;
... ... @@ -12,7 +12,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import retrofit.client.OkClient;
import javax.annotation.PostConstruct;
import java.util.concurrent.TimeUnit;
... ... @@ -38,15 +37,13 @@ public class InfluxdbComp {
@PostConstruct
public void init() {
OkHttpClient okHttpClient = new OkHttpClient();
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.connectTimeout(15, TimeUnit.SECONDS);
builder.readTimeout(40, TimeUnit.SECONDS);
builder.writeTimeout(20, TimeUnit.SECONDS);
okHttpClient.setConnectTimeout(15, TimeUnit.SECONDS);
okHttpClient.setReadTimeout(40, TimeUnit.SECONDS);
okHttpClient.setWriteTimeout(20, TimeUnit.SECONDS);
influxDBClient = InfluxDBFactory.connect(this.influxUrl, this.influxUser, this.influxPwd, new OkClient(okHttpClient));
influxDBClient = InfluxDBFactory.connect(this.influxUrl, this.influxUser, this.influxPwd, builder);
}
... ...