增加jdk版本的判断,让jdk高低版本之间的核心代码一致。

This commit is contained in:
wuwei1972 2020-02-19 13:28:20 +08:00
parent 0b48497982
commit 38fd9e56f3
2 changed files with 25 additions and 8 deletions

View File

@ -51,7 +51,7 @@
artery {
#canonical.hostname = "192.168.10.155"
#canonical.hostname = "192.168.31.155"
canonical.hostname = "192.168.1.104"
canonical.hostname = "192.168.1.105"
#canonical.port = 0
}
}
@ -65,7 +65,7 @@
#artery模式下的配置
#seed-nodes = ["akka://Repchain@192.168.10.155:22522","akka://Repchain@192.168.10.155:22523","akka://Repchain@192.168.10.155:22524"]
#seed-nodes = ["akka://Repchain@192.168.31.155:22522", "akka://Repchain@192.168.31.155:22523", "akka://Repchain@192.168.31.155:22526"]
seed-nodes = ["akka://Repchain@192.168.1.104:22522", "akka://Repchain@192.168.1.104:22523", "akka://Repchain@192.168.1.104:22526"]
seed-nodes = ["akka://Repchain@192.168.1.105:22522", "akka://Repchain@192.168.1.105:22523", "akka://Repchain@192.168.1.105:22526"]
}

View File

@ -14,7 +14,16 @@ object RepChainMgr {
private var isSingle = false
private var nodelist : ArrayBuffer[String] = new ArrayBuffer[String]()
private def isJDK8OfRunEnv:Boolean={
var defaultvalue = false//默认未13
val javaVersion = System.getProperty("java.version").split("[+.\\-]+", 3)
if(javaVersion != null && javaVersion.length >= 2){
if(javaVersion(1) == "8"){
defaultvalue = true
}
}
defaultvalue
}
def Startups(param:Array[(String,Int)])={
param.foreach(f=>{
@ -36,14 +45,22 @@ object RepChainMgr {
def Startup4Multi(SystemName:String,port:Int)={
val sys1 = new ClusterSystem(SystemName,InitType.MULTI_INIT,true)
sys1.init2(port)//初始化参数和配置信息
if(this.isJDK8OfRunEnv){
sys1.init
}else{
sys1.init2(port)//初始化参数和配置信息
}
if(this.clusterAddr == null){
this.clusterAddr = sys1.getClusterAddr//获取组网地址
sys1.enableWS()//开启API接口
}else{
sys1.disableWS()
}
//sys1.joinCluster(this.clusterAddr)//加入网络
if(this.isJDK8OfRunEnv){
sys1.joinCluster(this.clusterAddr)//加入网络
}
this.instanceOfCluster += SystemName -> (sys1,port)
this.nodelist += SystemName
sys1.start//启动系统
@ -102,9 +119,9 @@ object RepChainMgr {
threadPool.shutdown()
}*/
//try{
this.scheduledExecutorService.scheduleWithFixedDelay(//).scheduleAtFixedRate(
new ClusterTestStub,100,600, TimeUnit.SECONDS
)
this.scheduledExecutorService.scheduleWithFixedDelay(//).scheduleAtFixedRate(
new ClusterTestStub,100,600, TimeUnit.SECONDS
)
/*}catch {
case e:Exception =>
try{