java.lang.IllegalStateException: Queue full

其实异常说的很清楚 队列满了!

ArrayBlockingQueue

 

FIFO 的队列:

ArrayBlockingQueue内部是通过一个Object数组和一个ReentrantLock实现的。同时ReentrantLock在使用时也提供了公平和非公平两种。
因为数组是有界的,所以在数组为空和数组已满两种情况下需要阻塞线程,所以使用了Condition来实现线程的阻塞。

 

初始化时候:

public ArrayBlockingQueue(int capacity) {
this(capacity, false);
}

public ArrayBlockingQueue(int capacity, boolean fair) {
if (capacity <= 0)
throw new IllegalArgumentException();
this.items = new Object[capacity];
lock = new ReentrantLock(fair);
notEmpty = lock.newCondition();
notFull = lock.newCondition();
}

 

 

 

其他的api 自己看源码吧,。都有

 

转载于:https://www.cnblogs.com/java-synchronized/p/8309195.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
java.lang.IllegalStateException: No properties是一个异常,表示在代码中找不到配置属性。这个异常通常发生在使用Spring Boot时,没有正确配置@ConfigurationProperties注解的情况下。 解决这个问题的方法是确保在需要配置属性的类上添加@ConfigurationProperties注解,并在属性的getter和setter方法上添加@Value注解。这样Spring Boot就能正确地读取和注入配置属性。 以下是一个示例代码,演示了如何解决java.lang.IllegalStateException: No properties异常: ```java import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "myapp") public class MyAppProperties { private String property1; private int property2; public String getProperty1() { return property1; } public void setProperty1(String property1) { this.property1 = property1; } public int getProperty2() { return property2; } public void setProperty2(int property2) { this.property2 = property2; } } ``` 在上面的示例中,我们创建了一个名为MyAppProperties的类,并在类上添加了@ConfigurationProperties注解,并指定了属性的前缀为"myapp"。然后,我们定义了两个属性property1和property2,并为它们分别提供了getter和setter方法。 通过这样的配置,Spring Boot就能正确地读取和注入配置属性,避免了java.lang.IllegalStateException: No properties异常的发生。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值