SynchronousQueue、LinkedTransferQueue 设置队列大小 0.

pull/10/head
chen.ma 3 years ago
parent 5c59511813
commit 5d4885ae95

@ -17,10 +17,15 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.SynchronousQueue;
/** /**
* Config service impl. * Config service impl.
* *
@ -100,6 +105,7 @@ public class ConfigServiceImpl implements ConfigService {
.eq(ConfigAllInfo::getTenantId, config.getTenantId()); .eq(ConfigAllInfo::getTenantId, config.getTenantId());
config.setGmtCreate(null); config.setGmtCreate(null);
config.setCapacity(getQueueCapacityByType(config));
config.setContent(ContentUtil.getPoolContent(config)); config.setContent(ContentUtil.getPoolContent(config));
config.setMd5(Md5Util.getTpContentMd5(config)); config.setMd5(Md5Util.getTpContentMd5(config));
@ -111,4 +117,17 @@ public class ConfigServiceImpl implements ConfigService {
} }
} }
/**
* .
* <p>
* {@link SynchronousQueue} {@link LinkedTransferQueue}
*
* @param config
* @return
*/
private Integer getQueueCapacityByType(ConfigAllInfo config) {
List<Integer> noCapacityBlockingQueues = Lists.newArrayList(4, 5);
return noCapacityBlockingQueues.contains(config.getQueueType()) ? 0 : config.getCapacity();
}
} }

Loading…
Cancel
Save