Skip to content

Commit

Permalink
style: 코드 위치 변경
Browse files Browse the repository at this point in the history
- VarHandle 부분을 코드 최하단으로 옮겼습니다.
- docs를 수정했습니다.
  • Loading branch information
tidavid1 committed Aug 25, 2024
1 parent bcbe4bd commit 131dea8
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions sdk/java/logbat-sdk/src/main/java/info/logbat/LogBatFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,14 @@
* be set using the {@link LogBatOptions} class.
* </p>
*
* @author KyungMin Lee <a href="https://github.com/tidavid1">GitHub</a>
* @version 0.1.0
* @author KyungMin Lee <a href="https://github.com/tidavid1">GitHub</a>, JungJae Park <a
* href="https://github.com/LuizyHub">GitHub</a>
* @version 0.1.2
* @since 0.1.0
*/
public final class LogBatFactory {

private static volatile LogBat instance;
/**
* VarHandle for the LogBat instance, used for thread-safe lazy initialization.
*/
private static final VarHandle INSTANCE;

static {
try {
INSTANCE = MethodHandles.lookup()
.findStaticVarHandle(LogBatFactory.class, "instance", LogBat.class);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new ExceptionInInitializerError(e);
}
}

/**
* Returns the singleton instance of LogBat.
Expand Down Expand Up @@ -116,4 +104,18 @@ private static LogBat createLogbat() throws InvalidOptionException {
private LogBatFactory() {
throw new UnsupportedOperationException("LogBatFactory cannot be instantiated");
}

/**
* VarHandle for the LogBat instance, used for thread-safe lazy initialization.
*/
private static final VarHandle INSTANCE;

static {
try {
INSTANCE = MethodHandles.lookup()
.findStaticVarHandle(LogBatFactory.class, "instance", LogBat.class);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new ExceptionInInitializerError(e);
}
}
}

0 comments on commit 131dea8

Please sign in to comment.