本文整理汇总了Java中com.alibaba.otter.canal.parse.support.AuthenticationInfo类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationInfo类的具体用法?Java AuthenticationInfo怎么用?Java AuthenticationInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationInfo类属于com.alibaba.otter.canal.parse.support包,在下文中一共展示了AuthenticationInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMysqlConnection
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
private MysqlConnection buildMysqlConnection(AuthenticationInfo runningInfo) {
MysqlConnection connection = new MysqlConnection(runningInfo.getAddress(),
runningInfo.getUsername(),
runningInfo.getPassword(),
connectionCharsetNumber,
runningInfo.getDefaultDatabaseName());
connection.getConnector().setReceiveBufferSize(receiveBufferSize);
connection.getConnector().setSendBufferSize(sendBufferSize);
connection.getConnector().setSoTimeout(defaultConnectionTimeoutInSeconds * 1000);
connection.setCharset(connectionCharset);
// 随机生成slaveId
if (this.slaveId <= 0) {
this.slaveId = generateUniqueServerId();
}
connection.setSlaveId(this.slaveId);
return connection;
}
示例2: createFrom
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public static AuthenticationInfo createFrom(DatasourceInfo datasourceInfo) {
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
try {
BeanUtils.copyProperties(authenticationInfo, datasourceInfo);
} catch (Exception e) {
throw new CanalException(e);
}
return authenticationInfo;
}
示例3: start
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public void start() throws CanalHAException {
super.start();
if (this.supplier == null) {
validate();
this.supplier = MediaDatasourceSupplier.newInstance(group);
}
if (!this.supplier.isStart()) {
this.supplier.start();
}
DatasourceInfo fetched = this.supplier.fetchMaster();
AuthenticationInfo masterFetched = AuthenticationInfoUtils.createFrom(fetched);
log.info(String.format("medialHAController started for goup:[%s], and first auth info is : [%s]", this.group,
masterFetched));
this.availableAuthenticationInfo = customInfoIfNecessay(masterFetched);
log.info(String.format("medialHAController customed for goup:[%s], and first auth info is : [%s]", this.group,
this.availableAuthenticationInfo));
this.supplier.addSwtichCallback(new DatasourceChangeCallback() {
@Override
public void masterChanged(DatasourceInfo newMaster) {
AuthenticationInfo newAuthenticationInfo = AuthenticationInfoUtils.createFrom(newMaster);
switchEventSource(newAuthenticationInfo);
}
});
}
示例4: switchEventSource
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
private void switchEventSource(AuthenticationInfo newMaster) {
log.warn(String.format("MediaHAController received a datasource swith from [%s] to [%s]",
availableAuthenticationInfo, newMaster));
customInfoIfNecessay(newMaster);
log.warn(String.format("MediaHAController customed a datasource swith from [%s] to [%s]",
availableAuthenticationInfo, newMaster));
availableAuthenticationInfo = newMaster;
this.canalHASwitchable.doSwitch(newMaster);
}
示例5: customInfoIfNecessay
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
/**
* override custom field
*
* @param authenticationInfo
*/
protected AuthenticationInfo customInfoIfNecessay(AuthenticationInfo authenticationInfo) {
if (StringUtils.isNotBlank(customUser)) {
authenticationInfo.setUsername(customUser);
}
if (StringUtils.isNotBlank(customPasswd)) {
authenticationInfo.setPassword(customPasswd);
}
if (StringUtils.isNotBlank(customSchema)) {
authenticationInfo.setDefaultDatabaseName(customSchema);
}
return authenticationInfo;
}
示例6: MysqlConnection
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public MysqlConnection(InetSocketAddress address, String username, String password){
authInfo = new AuthenticationInfo();
authInfo.setAddress(address);
authInfo.setUsername(username);
authInfo.setPassword(password);
connector = new MysqlConnector(address, username, password);
// 将connection里面的参数透传下
connector.setSoTimeout(soTimeout);
connector.setConnTimeout(connTimeout);
}
示例7: doSwitch
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public void doSwitch(AuthenticationInfo newRunningInfo) {
// 1. 需要停止当前正在复制的过程
// 2. 找到新的position点
// 3. 重新建立链接,开始复制数据
// 切换ip
String alarmMessage = null;
if (this.runningInfo.equals(newRunningInfo)) {
alarmMessage = "same runingInfo switch again : " + runningInfo.getAddress().toString();
logger.warn(alarmMessage);
return;
}
if (newRunningInfo == null) {
alarmMessage = "no standby config, just do nothing, will continue try:"
+ runningInfo.getAddress().toString();
logger.warn(alarmMessage);
sendAlarm(destination, alarmMessage);
return;
} else {
stop();
alarmMessage = "try to ha switch, old:" + runningInfo.getAddress().toString() + ", new:"
+ newRunningInfo.getAddress().toString();
logger.warn(alarmMessage);
sendAlarm(destination, alarmMessage);
runningInfo = newRunningInfo;
start();
}
}
示例8: buildParser
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
private BinlogParser buildParser(AuthenticationInfo info) {
return new AbstractBinlogParser<LogEvent>() {
@Override
public Entry parse(LogEvent event, boolean isSeek) throws CanalParseException {
return null;
}
};
}
示例9: getAvailableAuthenticationInfo
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public AuthenticationInfo getAvailableAuthenticationInfo() {
return availableAuthenticationInfo;
}
示例10: setAvailableAuthenticationInfo
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public void setAvailableAuthenticationInfo(AuthenticationInfo availableAuthenticationInfo) {
this.availableAuthenticationInfo = availableAuthenticationInfo;
}
示例11: setMasterInfo
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public void setMasterInfo(AuthenticationInfo masterInfo) {
this.masterInfo = masterInfo;
}
示例12: getAuthInfo
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public AuthenticationInfo getAuthInfo() {
return authInfo;
}
示例13: setAuthInfo
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public void setAuthInfo(AuthenticationInfo authInfo) {
this.authInfo = authInfo;
}
示例14: setStandbyInfo
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
public void setStandbyInfo(AuthenticationInfo standbyInfo) {
this.standbyInfo = standbyInfo;
}
示例15: buildAuthentication
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; //导入依赖的package包/类
private AuthenticationInfo buildAuthentication() {
return new AuthenticationInfo(new InetSocketAddress(MYSQL_ADDRESS, 3306), USERNAME, PASSWORD);
}