Condition實現生產者消費者
阿新 • • 發佈:2019-06-28
package com.cjw.concurrent.scxf.lock;
import com.cjw.dto.goods.GoodsDto;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @author wucj
* @date 2019-06-27 17:48
**/
@Slf4j
public class GoodsLockService {
int maxDeque = 5;
private LinkedBlockingQueue storeLinkedBlockingQueue = new LinkedBlockingQueue();
private Lock lock = new ReentrantLock();
private Condition fullCondition = lock.newCondition();
private Condition emptyCondition = lock.newCondition();
public GoodsLockService(LinkedBlockingQueue storeLinkedBlockingQueue) {
this.storeLinkedBlockingQueue = storeLinkedBlockingQueue;
}
public void producer(Long id){
lock.lock();
try{
if(storeLinkedBlockingQueue.size()>=maxDeque){
fullCondition.await();
}
emptyCondition.signalAll();
GoodsDto dto = new GoodsDto();
dto.setId(id);
dto.setGoodsName("商品:"+id);
dto.setCreateTime(new Date());
log.info("生成產品:{}",dto.toString());
storeLinkedBlockingQueue.add(dto);
}catch (Exception e){
log.error("消費產品異常:{}",e);
}finally {
lock.unlock();
}
}
public void consumer(){
int zero = 0;
lock.lock();
try{
if(storeLinkedBlockingQueue.size()<=zero){
emptyCondition.await();
}
fullCondition.signalAll();
GoodsDto dto = (GoodsDto) storeLinkedBlockingQueue.take();
log.info("消費產品:{}",dto.toString());
}catch (Exception e){
log.error("消費產品異常:{}",e);
}finally {
lock.unlock();
}
}
}
package com.cjw.concurrent.scxf.lock;
import lombok.extern.slf4j.Slf4j;
/**
* @author wucj
* @date 2019-06-27 17:45
**/
@Slf4j
public class ProducerLock implements Runnable{
private GoodsLockService goodsLockService;
public ProducerLock(GoodsLockService goodsLockService) {
this.goodsLockService = goodsLockService;
}
@Override
public void run() {
int maxCount = 10;
for(int i=0;i<maxCount;i++){
goodsLockService.producer(Long.valueOf(i));
}
}
}
package com.cjw.concurrent.scxf.lock;
import lombok.extern.slf4j.Slf4j;
/**
* @author wucj
* @date 2019-06-27 17:47
**/
@Slf4j
public class ConsumerLock implements Runnable{
private GoodsLockService goodsLockService;
public ConsumerLock(GoodsLockService goodsLockService) {
this.goodsLockService = goodsLockService;
}
@Override
public void run() {
while (true){
goodsLockService.consumer();
}
}
}
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:62540,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Users/wugong/Library/Caches/IntelliJIdea2018.1/captureAgent/debugger-agent.jar=file:/private/var/folders/rw/tc7h1gf55y74qj1k668lr1n00000gn/T/capture.props -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/tools.jar:/Users/wugong/mine/project/demo-boot-parent/demo-boot-provider/target/test-classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-provider/target/classes:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter/2.1.2.RELEASE/spring-boot-starter-2.1.2.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot/2.1.5.RELEASE/spring-boot-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.5.RELEASE/spring-boot-autoconfigure-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-logging/2.1.5.RELEASE/spring-boot-starter-logging-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/wugong/mryx/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/wugong/mryx/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar:/Users/wugong/mryx/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar:/Users/wugong/mryx/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar:/Users/wugong/mryx/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/wugong/mryx/repository/org/springframework/spring-core/5.1.7.RELEASE/spring-core-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-jcl/5.1.7.RELEASE/spring-jcl-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-web/2.1.2.RELEASE/spring-boot-starter-web-2.1.2.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-json/2.1.5.RELEASE/spring-boot-starter-json-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.8/jackson-datatype-jdk8-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.8/jackson-datatype-jsr310-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.8/jackson-module-parameter-names-2.9.8.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.5.RELEASE/spring-boot-starter-tomcat-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.19/tomcat-embed-core-9.0.19.jar:/Users/wugong/mryx/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.19/tomcat-embed-el-9.0.19.jar:/Users/wugong/mryx/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.19/tomcat-embed-websocket-9.0.19.jar:/Users/wugong/mryx/repository/org/hibernate/validator/hibernate-validator/6.0.16.Final/hibernate-validator-6.0.16.Final.jar:/Users/wugong/mryx/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/wugong/mryx/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/wugong/mryx/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/wugong/mryx/repository/org/springframework/spring-web/5.1.7.RELEASE/spring-web-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-beans/5.1.7.RELEASE/spring-beans-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-webmvc/5.1.7.RELEASE/spring-webmvc-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-aop/5.1.7.RELEASE/spring-aop-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-expression/5.1.7.RELEASE/spring-expression-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-test/2.1.2.RELEASE/spring-boot-starter-test-2.1.2.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-test/2.1.5.RELEASE/spring-boot-test-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-test-autoconfigure/2.1.5.RELEASE/spring-boot-test-autoconfigure-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/com/jayway/jsonpath/json-path/2.4.0/json-path-2.4.0.jar:/Users/wugong/mryx/repository/net/minidev/json-smart/2.3/json-smart-2.3.jar:/Users/wugong/mryx/repository/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar:/Users/wugong/mryx/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar:/Users/wugong/mryx/repository/junit/junit/4.12/junit-4.12.jar:/Users/wugong/mryx/repository/org/assertj/assertj-core/3.11.1/assertj-core-3.11.1.jar:/Users/wugong/mryx/repository/org/mockito/mockito-core/2.23.4/mockito-core-2.23.4.jar:/Users/wugong/mryx/repository/net/bytebuddy/byte-buddy/1.9.12/byte-buddy-1.9.12.jar:/Users/wugong/mryx/repository/net/bytebuddy/byte-buddy-agent/1.9.12/byte-buddy-agent-1.9.12.jar:/Users/wugong/mryx/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/wugong/mryx/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/wugong/mryx/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar:/Users/wugong/mryx/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0.jar:/Users/wugong/mryx/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar:/Users/wugong/mryx/repository/org/springframework/spring-test/5.1.7.RELEASE/spring-test-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/xmlunit/xmlunit-core/2.6.2/xmlunit-core-2.6.2.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-jdbc/2.1.5.RELEASE/spring-boot-starter-jdbc-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-jdbc/5.1.7.RELEASE/spring-jdbc-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-tx/5.1.7.RELEASE/spring-tx-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar:/Users/wugong/mryx/repository/org/mybatis/spring/boot/mybatis-spring-boot-starter/1.3.2/mybatis-spring-boot-starter-1.3.2.jar:/Users/wugong/mryx/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/1.3.2/mybatis-spring-boot-autoconfigure-1.3.2.jar:/Users/wugong/mryx/repository/org/mybatis/mybatis/3.4.6/mybatis-3.4.6.jar:/Users/wugong/mryx/repository/org/mybatis/mybatis-spring/1.3.2/mybatis-spring-1.3.2.jar:/Users/wugong/mryx/repository/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar:/Users/wugong/mryx/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar:/Users/wugong/mryx/repository/com/alibaba/druid-spring-boot-starter/1.1.9/druid-spring-boot-starter-1.1.9.jar:/Users/wugong/mryx/repository/com/alibaba/druid/1.1.9/druid-1.1.9.jar:/Users/wugong/mryx/repository/com/github/pagehelper/pagehelper/5.0.4/pagehelper-5.0.4.jar:/Users/wugong/mryx/repository/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar:/Users/wugong/mryx/repository/org/projectlombok/lombok/1.18.2/lombok-1.18.2.jar:/Users/wugong/mryx/repository/org/apache/dubbo/dubbo/2.7.1-SNAPSHOT/dubbo-2.7.1-20190318.092944-5.jar:/Users/wugong/mryx/repository/org/springframework/spring-context/5.1.7.RELEASE/spring-context-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar:/Users/wugong/mryx/repository/io/netty/netty-all/4.1.36.Final/netty-all-4.1.36.Final.jar:/Users/wugong/mryx/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar:/Users/wugong/mryx/repository/org/apache/zookeeper/zookeeper/3.4.10/zookeeper-3.4.10.jar:/Users/wugong/mryx/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/Users/wugong/mryx/repository/jline/jline/0.9.94/jline-0.9.94.jar:/Users/wugong/mryx/repository/io/netty/netty/3.10.5.Final/netty-3.10.5.Final.jar:/Users/wugong/mryx/repository/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar:/Users/wugong/mryx/repository/org/apache/curator/curator-recipes/4.0.1/curator-recipes-4.0.1.jar:/Users/wugong/mryx/repository/org/apache/curator/curator-framework/4.0.1/curator-framework-4.0.1.jar:/Users/wugong/mryx/repository/org/apache/curator/curator-client/4.0.1/curator-client-4.0.1.jar:/Users/wugong/mine/project/demo-boot-parent/demo-boot-service/target/classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-entity/target/classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-api/target/classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-common/target/classes:/Users/wugong/mryx/repository/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar:/Users/wugong/mryx/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/wugong/mryx/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/wugong/mryx/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar:/Users/wugong/mryx/repository/org/apache/httpcomponents/httpcore/4.4.11/httpcore-4.4.11.jar:/Users/wugong/mryx/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar:/Users/wugong/mryx/repository/com/google/guava/guava/18.0/guava-18.0.jar:/Users/wugong/mryx/repository/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-client/4.5.1/rocketmq-client-4.5.1.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-common/4.5.1/rocketmq-common-4.5.1.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-remoting/4.5.1/rocketmq-remoting-4.5.1.jar:/Users/wugong/mryx/repository/com/alibaba/fastjson/1.2.51/fastjson-1.2.51.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-logging/4.5.1/rocketmq-logging-4.5.1.jar:/Users/wugong/mryx/repository/io/netty/netty-tcnative-boringssl-static/2.0.25.Final/netty-tcnative-boringssl-static-2.0.25.Final.jar:/Users/wugong/mryx/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-configuration-processor/2.1.2.RELEASE/spring-boot-configuration-processor-2.1.2.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.cjw.concurrent.BlockingQueueTest,blockQueueLockTest
Connected to the target VM, address: '127.0.0.1:62540', transport: 'socket'
21:44:26.432 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=0, goodsName=商品:0, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.436 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=1, goodsName=商品:1, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.436 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=2, goodsName=商品:2, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=3, goodsName=商品:3, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=4, goodsName=商品:4, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=0, goodsName=商品:0, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=1, goodsName=商品:1, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=2, goodsName=商品:2, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=3, goodsName=商品:3, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=4, goodsName=商品:4, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=5, goodsName=商品:5, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=6, goodsName=商品:6, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=7, goodsName=商品:7, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=8, goodsName=商品:8, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成產品:GoodsDto(id=9, goodsName=商品:9, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=5, goodsName=商品:5, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=6, goodsName=商品:6, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=7, goodsName=商品:7, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=8, goodsName=商品:8, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消費產品:GoodsDto(id=9, goodsName=商品:9, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
Disconnected from the target VM, address: '127.0.0.1:62540', transport: 'socket'
Process finished with exit code 0