📄 emailbodyqueue.java
字号:
/**
* Created at Dec 10, 2008
*/
package com.jdev.app.db.queue;
import java.util.LinkedList;
/**
* <p>Title: EmailBodyQueue</p>
* <p>Description: </p>
* @author Lawrence
* @version 1.0
*/
public class EmailBodyQueue {
private final static String module = EmailBodyQueue.class.getName();
private LinkedList<Object> pool = new LinkedList<Object>();
public int getRecord(){
int count = 0;
synchronized(pool){
count = pool.size();
}
return count;
}
public void push(Object sendMsg) {
synchronized (pool) {
pool.add(sendMsg);
pool.notifyAll();
}
}
public Object get(int index) {
synchronized (pool) {
// 如果没有任务,就锁定在这里
while (pool.isEmpty()) {
try {
pool.wait(); //等待解锁
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
return pool.get(index);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -