mirror of
https://gitee.com/BTAJL/repchain.git
synced 2024-12-02 11:48:10 +08:00
增加jdk版本的判断,让jdk高低版本之间的核心代码一致。
This commit is contained in:
parent
0b48497982
commit
38fd9e56f3
@ -51,7 +51,7 @@
|
|||||||
artery {
|
artery {
|
||||||
#canonical.hostname = "192.168.10.155"
|
#canonical.hostname = "192.168.10.155"
|
||||||
#canonical.hostname = "192.168.31.155"
|
#canonical.hostname = "192.168.31.155"
|
||||||
canonical.hostname = "192.168.1.104"
|
canonical.hostname = "192.168.1.105"
|
||||||
#canonical.port = 0
|
#canonical.port = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@
|
|||||||
#artery模式下的配置
|
#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.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.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"]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,16 @@ object RepChainMgr {
|
|||||||
private var isSingle = false
|
private var isSingle = false
|
||||||
private var nodelist : ArrayBuffer[String] = new ArrayBuffer[String]()
|
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)])={
|
def Startups(param:Array[(String,Int)])={
|
||||||
param.foreach(f=>{
|
param.foreach(f=>{
|
||||||
@ -36,14 +45,22 @@ object RepChainMgr {
|
|||||||
|
|
||||||
def Startup4Multi(SystemName:String,port:Int)={
|
def Startup4Multi(SystemName:String,port:Int)={
|
||||||
val sys1 = new ClusterSystem(SystemName,InitType.MULTI_INIT,true)
|
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){
|
if(this.clusterAddr == null){
|
||||||
this.clusterAddr = sys1.getClusterAddr//获取组网地址
|
this.clusterAddr = sys1.getClusterAddr//获取组网地址
|
||||||
sys1.enableWS()//开启API接口
|
sys1.enableWS()//开启API接口
|
||||||
}else{
|
}else{
|
||||||
sys1.disableWS()
|
sys1.disableWS()
|
||||||
}
|
}
|
||||||
//sys1.joinCluster(this.clusterAddr)//加入网络
|
|
||||||
|
if(this.isJDK8OfRunEnv){
|
||||||
|
sys1.joinCluster(this.clusterAddr)//加入网络
|
||||||
|
}
|
||||||
this.instanceOfCluster += SystemName -> (sys1,port)
|
this.instanceOfCluster += SystemName -> (sys1,port)
|
||||||
this.nodelist += SystemName
|
this.nodelist += SystemName
|
||||||
sys1.start//启动系统
|
sys1.start//启动系统
|
||||||
@ -102,9 +119,9 @@ object RepChainMgr {
|
|||||||
threadPool.shutdown()
|
threadPool.shutdown()
|
||||||
}*/
|
}*/
|
||||||
//try{
|
//try{
|
||||||
this.scheduledExecutorService.scheduleWithFixedDelay(//).scheduleAtFixedRate(
|
this.scheduledExecutorService.scheduleWithFixedDelay(//).scheduleAtFixedRate(
|
||||||
new ClusterTestStub,100,600, TimeUnit.SECONDS
|
new ClusterTestStub,100,600, TimeUnit.SECONDS
|
||||||
)
|
)
|
||||||
/*}catch {
|
/*}catch {
|
||||||
case e:Exception =>
|
case e:Exception =>
|
||||||
try{
|
try{
|
||||||
|
Loading…
Reference in New Issue
Block a user