mirror of
https://gitee.com/52itstyle/spring-boot-seckill.git
synced 2025-12-30 10:22:26 +00:00
:bug:坏蛋说 抛异常影响最终效果
This commit is contained in:
42
pom.xml
42
pom.xml
@@ -138,24 +138,34 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>spring-boot-seckill</finalName><plugins>
|
||||
<finalName>spring-boot-seckill</finalName>
|
||||
<!-- 打包项目 mvn clean package -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<dependencies>
|
||||
<!-- mvn spring-boot:run 热部署启动 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>springloaded</artifactId>
|
||||
<version>1.2.7.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<dependencies>
|
||||
<!-- mvn spring-boot:run 热部署启动 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>springloaded</artifactId>
|
||||
<version>1.2.7.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.itstyle.seckill.web;
|
||||
|
||||
import com.itstyle.seckill.common.exception.RrException;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@@ -56,12 +57,19 @@ public class SeckillController {
|
||||
for(int i=0;i<skillNum;i++){
|
||||
final long userId = i;
|
||||
Runnable task = () -> {
|
||||
Result result = seckillService.startSeckil(killId, userId);
|
||||
if(result!=null){
|
||||
LOGGER.info("用户:{}{}",userId,result.get("msg"));
|
||||
}else{
|
||||
LOGGER.info("用户:{}{}",userId,"哎呦喂,人也太多了,请稍后!");
|
||||
}
|
||||
/**
|
||||
* 坏蛋说 抛异常影响最终效果
|
||||
*/
|
||||
try{
|
||||
Result result = seckillService.startSeckil(killId, userId);
|
||||
if(result!=null){
|
||||
LOGGER.info("用户:{}{}",userId,result.get("msg"));
|
||||
}else{
|
||||
LOGGER.info("用户:{}{}",userId,"哎呦喂,人也太多了,请稍后!");
|
||||
}
|
||||
}catch (RrException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
latch.countDown();
|
||||
};
|
||||
executor.execute(task);
|
||||
|
||||
Reference in New Issue
Block a user