forked from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: CompletableFuture 을 활용한 비동기처리
- Loading branch information
1 parent
906d639
commit 168e855
Showing
11 changed files
with
180 additions
and
69 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/java/capstone/facefriend/bucket/BucketException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package capstone.facefriend.bucket; | ||
|
||
import capstone.facefriend.common.exception.BaseException; | ||
import capstone.facefriend.common.exception.ExceptionType; | ||
|
||
public class BucketException extends BaseException { | ||
|
||
public BucketException(ExceptionType exceptionType) { | ||
super(exceptionType); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/capstone/facefriend/bucket/BucketExceptionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package capstone.facefriend.bucket; | ||
|
||
import capstone.facefriend.common.exception.ExceptionType; | ||
import capstone.facefriend.common.exception.Status; | ||
|
||
public enum BucketExceptionType implements ExceptionType { | ||
|
||
FAIL_TO_UPLOAD(Status.SERVER_ERROR, 9001, "S3 업로드에 실패했습니다."), | ||
FAIL_TO_GET_INPUT_STREAM(Status.SERVER_ERROR, 9002, "Input Stream 추출에 실패했습니다."), | ||
; | ||
|
||
private final Status status; | ||
private final int exceptionCode; | ||
private final String message; | ||
|
||
BucketExceptionType(Status status, int exceptionCode, String message) { | ||
this.status = status; | ||
this.exceptionCode = exceptionCode; | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
public Status status() { | ||
return status; | ||
} | ||
|
||
@Override | ||
public int exceptionCode() { | ||
return exceptionCode; | ||
} | ||
|
||
@Override | ||
public String message() { | ||
return message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
src/main/java/capstone/facefriend/chat/config/ChatAsyncConfig.java
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/main/java/capstone/facefriend/common/aop/TimeTrace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package capstone.facefriend.common.aop; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface TimeTrace { | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/capstone/facefriend/common/aop/TimeTraceAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package capstone.facefriend.common.aop; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.annotation.Pointcut; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.util.StopWatch; | ||
|
||
@Slf4j | ||
@Component | ||
@Aspect | ||
public class TimeTraceAspect { | ||
|
||
@Pointcut("@annotation(capstone.facefriend.common.aop.TimeTrace)") | ||
private void timeTracePointcut() { | ||
} | ||
|
||
@Around("timeTracePointcut()") | ||
public Object traceTime(ProceedingJoinPoint joinPoint) throws Throwable { | ||
StopWatch stopWatch = new StopWatch(); | ||
|
||
try { | ||
stopWatch.start(); | ||
return joinPoint.proceed(); | ||
} finally { | ||
stopWatch.stop(); | ||
log.info("{} 소요 시간 = {}s", joinPoint.getSignature().toShortString(), stopWatch.getTotalTimeSeconds()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.