MCPcopy Create free account
hub / github.com/e2wugui/zeze / start

Method start

ZezeJava/ZezeJava/src/main/java/Zeze/Application.java:646–740  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

644 }
645
646 public void start() throws Exception {
647 lock();
648 try {
649 if (startState == StartState.eStarted)
650 return;
651 if (startState == StartState.eStartingOrStopping)
652 stop();
653
654 logSystemProperties();
655 logZezeVersion();
656 var serverId = conf.getServerId();
657 logger.info("Start ServerId={}", serverId);
658
659 var noDatabase = isNoDatabase();
660 if (!noDatabase) {
661 if ("true".equalsIgnoreCase(System.getProperty(Daemon.propertyNameClearInUse))) {
662 conf.clearInUseAndIAmSureAppStopped(this, databases);
663 //var defaultDb = getDatabase(conf.getDefaultTableConf().getDatabaseName());
664 //defaultDb.getDirectOperates().unlock();
665 }
666
667 // Set Database InUse
668 for (var db : databases.values())
669 db.getDirectOperates().setInUse(serverId, conf.getGlobalCacheManagerHostNameOrAddress());
670 addShutdownHook();
671
672 // Open RocksCache
673 var dbConf = new Config.DatabaseConf();
674 dbConf.setName("zeze_cache_" + serverId);
675 dbConf.setDatabaseUrl(dbConf.getName());
676 deleteDirectory(new File(dbConf.getDatabaseUrl()));
677 dbConf.setDatabaseType(Config.DbType.RocksDb);
678 LocalRocksCacheDb = new DatabaseRocksDb(this, dbConf);
679 LocalRocksCacheDb.open(this);
680 } else
681 addShutdownHook();
682
683 var serviceManagerConf = conf.getServiceConf(Agent.defaultServiceName);
684 if (serviceManagerConf != null && serviceManager != null) {
685 serviceManager.start();
686 try {
687 serviceManager.waitReady();
688 } catch (Exception ignored) {
689 // raft 版第一次等待由于选择leader原因肯定会失败一次。
690 serviceManager.waitReady();
691 }
692 }
693
694 if (!noDatabase) {
695 atomicOpenDatabase();
696
697 // Open Global
698 var hosts = Str.trim(conf.getGlobalCacheManagerHostNameOrAddress().split(";"));
699 if (hosts.length > 0) {
700 var isRaft = hosts[0].endsWith(".xml");
701 if (!isRaft) {
702 var impl = new GlobalAgent(this, hosts, conf.getGlobalCacheManagerPort());
703 globalAgent = impl;

Callers

nothing calls this directly

Calls 15

stopMethod · 0.95
logSystemPropertiesMethod · 0.95
logZezeVersionMethod · 0.95
isNoDatabaseMethod · 0.95
addShutdownHookMethod · 0.95
setNameMethod · 0.95
setDatabaseUrlMethod · 0.95
getNameMethod · 0.95
deleteDirectoryMethod · 0.95
getDatabaseUrlMethod · 0.95
setDatabaseTypeMethod · 0.95
atomicOpenDatabaseMethod · 0.95

Tested by

no test coverage detected