
org.frameworkset.tran.plugin.mysqlbinlog.input.ClientConnectThread Maven / Gradle / Ivy
Show all versions of bboss-datatran-binlog Show documentation
package org.frameworkset.tran.plugin.mysqlbinlog.input;
/**
* Copyright 2023 bboss
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.github.shyiko.mysql.binlog.BinaryLogClient;
import org.frameworkset.tran.DataImportException;
import org.frameworkset.tran.context.ImportContext;
import org.frameworkset.tran.exception.ImportExceptionUtil;
import java.io.IOException;
/**
*
Description: 启动mysql binlog client线程
*
* Copyright (c) 2023
* @Date 2023/6/28
* @author biaoping.yin
* @version 1.0
*/
public class ClientConnectThread extends Thread{
private BinaryLogClient client;
private DataImportException dataImportException ;
protected ImportContext importContext;
public ClientConnectThread(ImportContext importContext,BinaryLogClient client){
this.client = client;
this.importContext = importContext;
setName("BinaryLogClient-connect-Thread");
// this.setDaemon(true);
}
@Override
public void run() {
try {
client.connect();
} catch (IOException e) {
dataImportException = ImportExceptionUtil.buildDataImportException(importContext,e);
}
catch (Exception e) {
dataImportException = ImportExceptionUtil.buildDataImportException(importContext,e);
}
catch (Throwable e) {
dataImportException = ImportExceptionUtil.buildDataImportException(importContext,e);
}
}
public DataImportException getDataImportException() {
return dataImportException;
}
}