Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add aop lockretries #44

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'io.spring.dependency-management' version '1.1.7'
}

group = 'com.f-lab'
group = 'com.f-lab.la_planete'
version = '0.0.1-SNAPSHOT'

java {
Expand Down Expand Up @@ -38,8 +38,56 @@ dependencies {
// lombok 테스트에서도 사용
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

implementation project(":core")
testImplementation project(":core")
}

subprojects {
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.f-lab.la_planete'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

// lombok 테스트에서도 사용
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}

tasks.named('test') {
useJUnitPlatform()
}
}

project(":notifications") {
dependencies {
compileOnly project(":core")
}
}


tasks.named('test') {
useJUnitPlatform()
}

17 changes: 17 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version = '0.0.1-SNAPSHOT'

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

bootJar {
enabled = false
}

jar {
enabled = true
}
1 change: 1 addition & 0 deletions core/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "core"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.f_lab.la_planete.aspect;
package com.f_lab.la_planete.core.aspect;

import com.f_lab.la_planete.util.time.TimeConstantsString;
import com.f_lab.la_planete.core.util.time.TimeConstantsString;
import jakarta.persistence.LockTimeoutException;
import jakarta.persistence.PessimisticLockException;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -20,12 +20,10 @@ public class LockRetryAspect {
private static final int FIRST_WAIT_INTERVAL = Integer.parseInt(TimeConstantsString.ONE_SECOND);
private static final int MULTIPLIER = 2;

@Around("@annotation(com.f_lab.la_planete.aspect.RetryOnLockFailure)")
@Around("@annotation(com.f_lab.la_planete.core.aspect.RetryOnLockFailure)")
public Object lockRetry(ProceedingJoinPoint joinPoint) {
int attempts = 0, stopInterval = FIRST_WAIT_INTERVAL;

log.info("ARGS={}", joinPoint.getArgs());

while (attempts < MAX_RETRY) {
try {
return joinPoint.proceed();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.aspect;
package com.f_lab.la_planete.core.aspect;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.config;
package com.f_lab.la_planete.core.config;


import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.config;
package com.f_lab.la_planete.core.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package com.f_lab.la_planete.domain;

import com.f_lab.la_planete.domain.base.BaseTimeEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
package com.f_lab.la_planete.core.domain;
import com.f_lab.la_planete.core.domain.base.BaseTimeEntity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.f_lab.la_planete.domain;

import com.f_lab.la_planete.domain.base.BaseEntity;

package com.f_lab.la_planete.core.domain;

import com.f_lab.la_planete.core.domain.base.BaseEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import com.f_lab.la_planete.domain.base.BaseEntity;

import com.f_lab.la_planete.core.domain.base.BaseEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
Expand All @@ -11,7 +11,6 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import com.f_lab.la_planete.domain.base.BaseEntity;
import com.f_lab.la_planete.core.domain.base.BaseEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import com.f_lab.la_planete.domain.base.BaseTimeEntity;

import com.f_lab.la_planete.core.domain.base.BaseTimeEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import com.f_lab.la_planete.domain.base.BaseTimeEntity;
import com.f_lab.la_planete.core.domain.base.BaseTimeEntity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain.base;
package com.f_lab.la_planete.core.domain.base;



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain.base;
package com.f_lab.la_planete.core.domain.base;

import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.util.time;
package com.f_lab.la_planete.core.util.time;

public class TimeConstantsString {
public static final String FIVE_SECONDS = "5000";
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.DisplayName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.f_lab.la_planete.domain;
package com.f_lab.la_planete.core.domain;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down
3 changes: 3 additions & 0 deletions notifications/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
37 changes: 37 additions & 0 deletions notifications/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
14 changes: 14 additions & 0 deletions notifications/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version = '0.0.1-SNAPSHOT'

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

runtimeOnly 'com.h2database:h2'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// swagger 패키지
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
}
Binary file added notifications/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions notifications/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading