11package com .joy .queue ;
22
3+ import lombok .Setter ;
34import lombok .extern .slf4j .Slf4j ;
45import org .springframework .beans .factory .annotation .Qualifier ;
56import org .springframework .scheduling .concurrent .ThreadPoolTaskExecutor ;
@@ -25,8 +26,10 @@ public abstract class AbstractWaitQueueExecutor implements WaitQueueExecutor {
2526
2627 private volatile boolean isRunning = false ;
2728
29+ @ Setter
2830 private Long waitInterval = 30 * 1000L ;
2931
32+ @ Setter
3033 private Integer failFitCount = 100 ;
3134
3235 private Future <?> threadFuture ;
@@ -106,7 +109,7 @@ protected void waitSingle() throws InterruptedException {
106109
107110 private void runInternalSingle () throws InterruptedException {
108111 List <String > tmpList = new LinkedList <>(queueSet .keySet ());
109- if (tmpList .size () == 0 ) {
112+ if (tmpList .isEmpty () ) {
110113 this .waitSingle ();
111114 return ;
112115 }
@@ -159,17 +162,6 @@ protected boolean peekAndProcess(String queueName, CountDownLatch startCount) th
159162 return hasFetch ;
160163 }
161164
162- /**
163- * 具体业务实现
164- *
165- * @param queueName
166- * @param subject
167- * @return
168- */
169- public boolean processByQueueName (String queueName , String subject ) {
170- return this .processByQueueName (queueName , subject );
171- }
172-
173165 public boolean processByQueueName (String queueName , String subject , Object extData ) {
174166 return false ;
175167 }
@@ -187,27 +179,17 @@ protected void checkFaitCount(String queueName) {
187179 }
188180 }
189181
190-
191182 public Long getWaitInterval () {
192183 if (waitInterval == null || waitInterval <= 0L ) {
193184 waitInterval = 5000L ;
194185 }
195186 return waitInterval ;
196187 }
197188
198- public void setWaitInterval (Long waitInterval ) {
199- this .waitInterval = waitInterval ;
200- }
201-
202189 public Integer getFailFitCount () {
203190 if (failFitCount == null || failFitCount == 0 ) {
204191 failFitCount = 10 ;
205192 }
206193 return failFitCount ;
207194 }
208-
209- public void setFailFitCount (Integer failFitCount ) {
210- this .failFitCount = failFitCount ;
211- }
212-
213195}
0 commit comments