-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #275 from BidderOwn/develop
배포 환경
- Loading branch information
Showing
101 changed files
with
2,761 additions
and
1,648 deletions.
There are no files selected for viewing
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
19 changes: 0 additions & 19 deletions
19
src/main/java/site/bidderown/server/ServerApplication.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 |
---|---|---|
@@ -1,33 +1,14 @@ | ||
package site.bidderown.server; | ||
|
||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Primary; | ||
import org.springframework.core.task.TaskExecutor; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
|
||
@SpringBootApplication | ||
@EnableJpaAuditing | ||
@EnableBatchProcessing | ||
@EnableAsync | ||
public class ServerApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ServerApplication.class, args);////// | ||
} | ||
|
||
@Bean | ||
@Primary | ||
TaskExecutor taskExecutor() { | ||
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); | ||
taskExecutor.setCorePoolSize(10); | ||
taskExecutor.setMaxPoolSize(10); | ||
taskExecutor.setThreadNamePrefix("batch-thread-"); | ||
taskExecutor.initialize(); | ||
return taskExecutor; | ||
} | ||
} |
357 changes: 205 additions & 152 deletions
357
src/main/java/site/bidderown/server/base/data/NotProd.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
9 changes: 9 additions & 0 deletions
9
src/main/java/site/bidderown/server/base/redis/buffer/BufferTask.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,9 @@ | ||
package site.bidderown.server.base.redis.buffer; | ||
|
||
/** | ||
* Redis buffer에 들어갈 데이터 타입 | ||
*/ | ||
|
||
public interface BufferTask { | ||
Long getId(); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/site/bidderown/server/base/redis/buffer/CountBuffer.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,9 @@ | ||
package site.bidderown.server.base.redis.buffer; | ||
|
||
import java.util.List; | ||
|
||
public interface CountBuffer { | ||
void push(CountTask bufferTask); | ||
List<CountTask> popAll(); | ||
long size(); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/site/bidderown/server/base/redis/buffer/CountTask.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,6 @@ | ||
package site.bidderown.server.base.redis.buffer; | ||
|
||
public interface CountTask extends BufferTask { | ||
CounterTaskType getType(); | ||
int getDelta(); | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/site/bidderown/server/base/redis/buffer/CounterTaskType.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,5 @@ | ||
package site.bidderown.server.base.redis.buffer; | ||
|
||
public enum CounterTaskType { | ||
bid, comment, heart | ||
} |
2 changes: 1 addition & 1 deletion
2
...erver/base/redis/EmbeddedRedisConfig.java → ...ase/redis/config/EmbeddedRedisConfig.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
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
2 changes: 1 addition & 1 deletion
2
...server/base/redis/ExpirationListener.java → ...se/redis/listener/ExpirationListener.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
16 changes: 11 additions & 5 deletions
16
src/main/java/site/bidderown/server/base/scheduler/SchedulerRunner.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 |
---|---|---|
@@ -1,23 +1,29 @@ | ||
package site.bidderown.server.base.scheduler; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
import site.bidderown.server.bounded_context.item.scheduler.ItemCounterScheduler; | ||
import site.bidderown.server.bounded_context.item.scheduler.ItemCountScheduler; | ||
|
||
/** | ||
* Scheduler 를 실행시키는 클래스 | ||
*/ | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@Component | ||
@EnableScheduling | ||
public class SchedulerRunner { | ||
|
||
private final ItemCounterScheduler itemCounterScheduler; | ||
private final ItemCountScheduler itemCountScheduler; | ||
|
||
/** | ||
* 30초마다 아이템 댓글, 입찰 개수 업데이트 | ||
* 5초마다 아이템 댓글, 입찰 개수 업데이트 | ||
*/ | ||
@Scheduled(cron = "0/30 * * * * *") | ||
@Scheduled(cron = "0/5 * * * * *") | ||
public void itemCounterRun() { | ||
itemCounterScheduler.run(); | ||
log.info("itemCounterScheduler run"); | ||
itemCountScheduler.run(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/site/bidderown/server/base/swagger/SwaggerConfig.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,30 @@ | ||
package site.bidderown.server.base.swagger; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import org.springdoc.core.GroupedOpenApi; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
@Bean | ||
public GroupedOpenApi publicApi() { | ||
return GroupedOpenApi.builder() | ||
.group("v1") | ||
.pathsToMatch("/api/**") | ||
.build(); | ||
} | ||
|
||
@Bean | ||
public OpenAPI openAPI() { | ||
Info info = new Info() | ||
.title("BidderOwn API Document") | ||
.version("v0.0.1") | ||
.description("비더원 프로젝트 API 명세서입니다."); | ||
return new OpenAPI() | ||
.components(new Components()) | ||
.info(info); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/site/bidderown/server/base/util/BeanUtils.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,21 @@ | ||
package site.bidderown.server.base.util; | ||
|
||
import org.springframework.beans.BeansException; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class BeanUtils implements ApplicationContextAware { | ||
private static ApplicationContext applicationContext; | ||
|
||
@Override | ||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | ||
BeanUtils.applicationContext = applicationContext; | ||
} | ||
|
||
public static <T> T getBean(Class<T> clazz){ | ||
return applicationContext.getBean(clazz); | ||
} | ||
} | ||
|
34 changes: 0 additions & 34 deletions
34
src/main/java/site/bidderown/server/batch/BatchScheduler.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.