1,完成热门模块的数据中心

2,完成api接口
This commit is contained in:
userA
2023-07-22 16:50:58 +08:00
parent a55490c184
commit e5e4cb41de
43 changed files with 895 additions and 247 deletions

View File

@@ -213,7 +213,7 @@ public class FileCache <T extends ConfigFile>{
* @param key
* @return
*/
public Object get(String key){
private Object get(String key){
return jsonFile.get(key);
}
@@ -238,7 +238,7 @@ public class FileCache <T extends ConfigFile>{
*/
public void forceSync(){
if(writeByte.get()==0){
logger.info("未发生版本变化");
logger.debug("未发生版本变化");
return;
}
clearWriteBytes();

View File

@@ -76,7 +76,7 @@ public class FileCacheManager {
fileCaches.add(fileCache);
fileCacheMap.put(fileCache.getFullFilePath(),fileCache);
initSleepTime();
FileModuleLogger.logger.info("FileCacheManager add a new FileCache:{}",fileCache.getFullFilePath());
FileModuleLogger.logger.debug("FileCacheManager add a new FileCache:{}",fileCache.getFullFilePath());
}
return false;
}
@@ -99,7 +99,7 @@ public class FileCacheManager {
BlockingQueue fileChannel = cache.getFileChannel();
if(fileChannel.isEmpty()){
if(cache.needAutoSync()){
logger.info("检测到需要强制刷新的文件 {}",cache.getFileName());
FileModuleLogger.logger.debug("检测到需要强制刷新的文件 {}",cache.getFileName());
autoSyncer.submit(new AutoSyncer(cache));
}
}

View File

@@ -1,19 +0,0 @@
package org.example.service;
import org.example.pojo.vo.ConfigVO;
import java.util.List;
/**
* @author Genius
* @date 2023/04/26 00:59
**/
public interface FileService {
//获取所有模块
List<String> getAllModule();
//获取所有文件
List<ConfigVO> getAllConfigs();
}

View File

@@ -1,46 +0,0 @@
package org.example.service.impl;
import org.example.cache.FileCache;
import org.example.cache.FileCacheManagerInstance;
import org.example.bean.FileType;
import org.example.pojo.vo.ConfigVO;
import org.example.service.FileService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author Genius
* @date 2023/04/26 01:01
**/
@Service
public class FileServiceImpl implements FileService {
@Override
public List<String> getAllModule() {
List<String> moduleList = new ArrayList<>();
for (FileType value : FileType.values()) {
if(!value.equals(FileType.COMMON)){
moduleList.add(value.getName());
}
}
return moduleList;
}
@Override
public List<ConfigVO> getAllConfigs() {
List<ConfigVO> configVOList = new ArrayList<>();
List<FileCache> runnableFileCaches = FileCacheManagerInstance.getInstance().getRunnableFileCaches();
for (FileCache runnableFileCache : runnableFileCaches) {
if (runnableFileCache.getFileType().equals(FileType.COMMON)) {
continue;
}
configVOList.add(new ConfigVO(runnableFileCache.getFileName()
,runnableFileCache.getFullFilePath()
,runnableFileCache.getFileType().getName()));
}
return configVOList;
}
}

View File

@@ -71,7 +71,6 @@ public class JsonFileUtil {
T t = null;
Path dir = Paths.get(fullPath);
try{
System.out.println(dir);
if (FileUtil.isFileExist(dir.toString())) {
String res = Files.readString(dir, StandardCharsets.UTF_8);
// logger.debug("读取json文件成功, 文件内容为: {}", res);