forked from datavane/tis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade version to 2.0.0 and make employee incr process pass
- Loading branch information
莫正华
authored and
莫正华
committed
Oct 19, 2020
1 parent
94ea23a
commit 62dd49e
Showing
60 changed files
with
1,522 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mvn versions:set -DnewVersion=2.0.0 -DprocessDependencies=true -DgenerateBackupPoms=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/** | ||
* Copyright (c) 2020 QingLang, Inc. <[email protected]> | ||
* | ||
* <p> | ||
* This program is free software: you can use, redistribute, and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3 | ||
* or later ("AGPL"), as published by the Free Software Foundation. | ||
* | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* <p> | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
@@ -34,6 +34,7 @@ | |
import org.apache.zookeeper.Watcher; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
import java.net.InetSocketAddress; | ||
|
@@ -69,6 +70,7 @@ public static AtomicReference<AssembleSvcCompsite> getService(ITISCoordinator zo | |
// public void close() { | ||
// } | ||
// }; | ||
|
||
/** | ||
* 连接日志收集节点地址 | ||
* | ||
|
@@ -79,12 +81,11 @@ public static AtomicReference<AssembleSvcCompsite> getService(ITISCoordinator zo | |
private void connect2RemoteIncrStatusServer(final ITISCoordinator zookeeper, boolean reConnect, final AssembleSvcCompsiteCallback rpcCallback) throws Exception { | ||
// 增量状态收集节点 | ||
final String incrStateCollectAddress = ZkUtils.getFirstChildValue(zookeeper, ZkUtils.ZK_ASSEMBLE_LOG_COLLECT_PATH, new AbstractWatcher() { | ||
|
||
@Override | ||
protected void process(Watcher watcher) throws KeeperException, InterruptedException { | ||
try { | ||
connect2RemoteIncrStatusServer(zookeeper, false, /* reConnect */ | ||
rpcCallback); | ||
rpcCallback); | ||
} catch (Exception e) { | ||
error(e.getMessage(), e); | ||
logger.error(e.getMessage(), e); | ||
|
@@ -162,29 +163,34 @@ public void close() { | |
private AtomicReference<AssembleSvcCompsite> connect2RemoteIncrStatusServer(ITISCoordinator zookeeper, AdapterAssembleSvcCompsiteCallback... callbacks) throws Exception { | ||
final AtomicReference<AssembleSvcCompsite> ref = new AtomicReference<>(); | ||
ref.set(AssembleSvcCompsite.MOCK_PRC); | ||
if (!zookeeper.shallConnect2RemoteIncrStatusServer()) { | ||
return ref; | ||
} | ||
|
||
|
||
StatusRpcClient statusRpcClient = new StatusRpcClient(); | ||
statusRpcClient.connect2RemoteIncrStatusServer(zookeeper, true, /* reConnect */ | ||
new AssembleSvcCompsiteCallback() { | ||
|
||
@Override | ||
public AssembleSvcCompsite process(AssembleSvcCompsite oldrpc, AssembleSvcCompsite newrpc) { | ||
ref.compareAndSet(oldrpc, newrpc); | ||
for (AdapterAssembleSvcCompsiteCallback c : callbacks) { | ||
c.process(oldrpc, newrpc); | ||
} | ||
return newrpc; | ||
} | ||
new AssembleSvcCompsiteCallback() { | ||
|
||
@Override | ||
public AssembleSvcCompsite process(AssembleSvcCompsite oldrpc, AssembleSvcCompsite newrpc) { | ||
ref.compareAndSet(oldrpc, newrpc); | ||
for (AdapterAssembleSvcCompsiteCallback c : callbacks) { | ||
c.process(oldrpc, newrpc); | ||
} | ||
return newrpc; | ||
} | ||
|
||
@Override | ||
public AssembleSvcCompsite getOld() { | ||
return ref.get(); | ||
} | ||
@Override | ||
public AssembleSvcCompsite getOld() { | ||
return ref.get(); | ||
} | ||
|
||
@Override | ||
public void errorOccur(AssembleSvcCompsite oldrpc, Exception e) { | ||
ref.compareAndSet(oldrpc, AssembleSvcCompsite.MOCK_PRC); | ||
} | ||
}); | ||
@Override | ||
public void errorOccur(AssembleSvcCompsite oldrpc, Exception e) { | ||
ref.compareAndSet(oldrpc, AssembleSvcCompsite.MOCK_PRC); | ||
} | ||
}); | ||
return ref; | ||
} | ||
|
||
|
@@ -204,7 +210,6 @@ public interface AssembleSvcCompsiteCallback { | |
public abstract static class AssembleSvcCompsite { | ||
|
||
public static final AssembleSvcCompsite MOCK_PRC = new AssembleSvcCompsite(new MockIncrStatusUmbilicalProtocol(), new MockLogReporter()) { | ||
|
||
@Override | ||
public void close() { | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
/** | ||
* Copyright (c) 2020 QingLang, Inc. <[email protected]> | ||
* | ||
* <p> | ||
* This program is free software: you can use, redistribute, and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3 | ||
* or later ("AGPL"), as published by the Free Software Foundation. | ||
* | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* <p> | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.qlangtech.tis.cloud; | ||
|
||
import org.apache.zookeeper.Watcher; | ||
import org.apache.zookeeper.data.Stat; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
|
@@ -26,6 +27,13 @@ | |
*/ | ||
public interface ITISCoordinator { | ||
|
||
/** | ||
* 是否应该连接Assemble日志收集服务,单元测试过程中需要返回false | ||
* | ||
* @return | ||
*/ | ||
boolean shallConnect2RemoteIncrStatusServer(); | ||
|
||
List<String> getChildren(String zkPath, Watcher watcher, boolean b); | ||
|
||
void addOnReconnect(IOnReconnect onReconnect); | ||
|
Oops, something went wrong.