Skip to content

Commit

Permalink
React Deploy And WebConfig Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
akageun committed Jul 18, 2024
1 parent 4054d4c commit 4923d65
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
import kr.hakdang.cassdio.common.utils.Jsons;
import lombok.extern.slf4j.Slf4j;
import org.mapdb.DB;
import org.mapdb.DBMaker;
import org.mapdb.Serializer;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import java.io.File;
import java.util.List;
import java.util.concurrent.ConcurrentMap;

Expand All @@ -20,13 +24,10 @@
*/
@Slf4j
@Service
public class ClusterManager {
public class ClusterManager implements InitializingBean, DisposableBean {

private final DB mapDb;
private static DB mapDb;

public ClusterManager(DB mapDb) {
this.mapDb = mapDb;
}

public void register(ClusterInfoArgs args) {
ConcurrentMap<String, String> map = mapDb
Expand Down Expand Up @@ -85,4 +86,33 @@ public void deleteById(String clusterId) {
mapDb.commit();
}

@Override
public void destroy() throws Exception {
if (mapDb != null) {
mapDb.close();
}
}

@Override
public void afterPropertiesSet() throws Exception {
File file = new File(System.getProperty("user.home") + "/.cassdio");
if (!file.exists()) {
file.mkdir();
}

DBMaker.Maker maker = DBMaker
//TODO : 추후 프로퍼티 받아서 주입할 수 있도록 변경 예정
.fileDB(System.getProperty("user.home") + "/.cassdio/cassdio_v1.db")
.fileMmapEnable() // Always enable mmap
.fileMmapEnableIfSupported() // Only enable mmap on supported platforms
.fileMmapPreclearDisable() // Make mmap file faster
.transactionEnable()
.fileLockDisable()
// Unmap (release resources) file when its closed.
// That can cause JVM crash if file is accessed after it was unmapped
// (there is possible race condition).
.cleanerHackEnable();

mapDb = maker.make();
}
}

This file was deleted.

This file was deleted.

0 comments on commit 4923d65

Please sign in to comment.