Skip to content

Commit

Permalink
禁用路径调试日志,优化MapDBStore关闭日志,提高代码可读性。
Browse files Browse the repository at this point in the history
  • Loading branch information
lcy362 committed May 16, 2024
1 parent 2228ea0 commit dd52288
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void printPathInfo(String station) {
String key = entry.getKey();
String dest = stations.get(key).getName();
List<String> pathDetail = entry.getValue().getDetail().stream().map(id -> stations.get(id).getName()).toList();
log.info("从{}到{}的路径为:{}", station, dest, pathDetail);
// log.info("从{}到{}的路径为:{}", station, dest, pathDetail);
}
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/mobo/mobosubway/store/MapDBStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.mapdb.Serializer;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
@Scope("singleton")
public class MapDBStore {

private DB store;
Expand Down Expand Up @@ -40,6 +44,7 @@ public <T> Map<String, T> load(String name) {

@PreDestroy
public void close() {
log.info("=======close mapdb==========");
if (store != null && !store.isClosed()) {
store.close();
}
Expand Down

0 comments on commit dd52288

Please sign in to comment.