本文整理汇总了Java中java.util.AbstractQueue类的典型用法代码示例。如果您正苦于以下问题:Java AbstractQueue类的具体用法?Java AbstractQueue怎么用?Java AbstractQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractQueue类属于java.util包,在下文中一共展示了AbstractQueue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClientQueue
import java.util.AbstractQueue; //导入依赖的package包/类
/**
* 获取指定名称的队列存储实例 如果不存存在,根据create参数决定是否创建
*
* @param name
* @return
* @throws Exception
*/
private AbstractQueue<byte[]> getClientQueue(String name, boolean create) throws Exception {
AbstractQueue<byte[]> queue = queuemMap.get(name);
if (queue == null) {
if (create == true) {
lock.lock();
try {
queue = queuemMap.get(name);
if (queue == null) {
queue = new FQueue(dbpath + "/" + name, logSize);
queuemMap.put(name, queue);
}
} finally {
lock.unlock();
}
}
}
return queue;
}
示例2: doBackup
import java.util.AbstractQueue; //导入依赖的package包/类
@Override
public void doBackup(ArrayList<String> target, Activity act) {
//Hash map that links each File to its related root folder
AbstractQueue<BackupItem> queue = new ConcurrentLinkedQueue<BackupItem>();
//Create list of objects to
for (int i = 0; i < target.size(); i++) {
String rootFolder = target.get(i);
getLocalFileList(queue, rootFolder);
}
String backupName = getBackupId();
try {
client.makedir("/backups/" + backupName);
} catch (IOException ex) {
Logger.getLogger(ControlBackup.class.getName()).log(Level.SEVERE, null, ex);
act.cancel();
return;
}
String backupDir = "/backups/" + backupName;
Command comm = new ResumeBackupCommand(queue, backupDir, act);
act.setResumeCommand(comm);
resumeBackup(queue, backupDir, act);
}
示例3: getLocalFileList
import java.util.AbstractQueue; //导入依赖的package包/类
private void getLocalFileList(AbstractQueue<BackupItem> list, String rootFolder) {
File dir = new java.io.File(rootFolder);
list.add(new BackupItem(dir, rootFolder));
if (dir.isDirectory()) {
getLocalFileListAux(dir, list, rootFolder);
}
}
示例4: getRemoteFileList
import java.util.AbstractQueue; //导入依赖的package包/类
private AbstractQueue<RemoteFile> getRemoteFileList(String folder) {
AbstractQueue<RemoteFile> list = new ConcurrentLinkedQueue<>();
try {
getRemoteFileListAux(folder, list);
} catch (IOException ex) {
ex.printStackTrace();
}
return list;
}
示例5: getLocalFileListAux
import java.util.AbstractQueue; //导入依赖的package包/类
private void getLocalFileListAux(java.io.File dir, AbstractQueue<BackupItem> list, String rootFolder) {
for (java.io.File child : dir.listFiles()) {
list.add(new BackupItem(child, rootFolder));
if (child.isDirectory()) {
getLocalFileListAux(child, list, rootFolder);
}
}
}
示例6: getRemoteFileListAux
import java.util.AbstractQueue; //导入依赖的package包/类
private void getRemoteFileListAux(String folder, AbstractQueue<RemoteFile> list) throws IOException {
for (RemoteFile child : client.getChildren(folder)) {
list.add(child);
if (child.isDirectory()) {
getRemoteFileListAux(child.getPath(), list);
}
}
}
示例7: run
import java.util.AbstractQueue; //导入依赖的package包/类
public void run() {
AbstractQueue<String> q = new ArrayBlockingQueue<>(GCTest.countDownSize);
char[] srcArray;
String emptyStr;
long finishedUnit = 0;
long prevTime = timeZero;
for (int i = 0; ; i = i + 1) {
// Simulate object use to force promotion into OldGen and then GC
if (q.size() >= GCTest.countDownSize) {
for (int j = 0; j < GCTest.eachRemoveSize; j++) {
q.remove();
}
finishedUnit++;
// every 1000 removal is counted as 1 unit.
long curTime = System.currentTimeMillis();
long totalTime = curTime - timeZero;
if (totalTime > GCTest.duration * 1000) {
System.exit(0);
}
Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
System.out.println(ft.format(dNow) + " finished Units (1K) = " + finishedUnit);
}
srcArray = new char[GCTest.referenceSize];
emptyStr = new String(srcArray);
String str = emptyStr.replace('\0', 'a');
q.add(str);
}
}
示例8: newCollection
import java.util.AbstractQueue; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected AbstractQueue<T> newCollection() {
return new PriorityQueue<T>();
}
示例9: Collector
import java.util.AbstractQueue; //导入依赖的package包/类
Collector(AbstractQueue<FIFOEntry<Revision>> outgoingQueue,
RevisionProcessor nextProcessor, int runningWorkerThreads) {
this.outgoingQueue = outgoingQueue;
this.nextProcessor = nextProcessor;
this.runningWorkerThreads = runningWorkerThreads;
}
示例10: QueueTest
import java.util.AbstractQueue; //导入依赖的package包/类
public QueueTest(AbstractQueue<Integer> queue) {
this.queue = queue;
}
示例11: doRestore
import java.util.AbstractQueue; //导入依赖的package包/类
@Override
public void doRestore(String folder, String targetPath, Activity act) {
String rootFolder = folder.startsWith("/backups/") ? folder : ("/backups/" + folder);
act.storeObject("rootFolder", rootFolder);
//TODO - Potentially long operation, todo: if the user abort it, then start all over again due to the recursive method
AbstractQueue<RemoteFile> queue = getRemoteFileList(rootFolder);
Command comm = new ResumeRestoreCommand(queue, targetPath, act);
act.setResumeCommand(comm);
act.saveActivity();
resumeRestore(queue, targetPath, act);
}
示例12: ResumeBackupCommand
import java.util.AbstractQueue; //导入依赖的package包/类
public ResumeBackupCommand(AbstractQueue<BackupItem> queue,
String backupDir, Activity act) {
this.queue = queue;
this.act = act;
this.backupDir = backupDir;
}
示例13: ResumeRestoreCommand
import java.util.AbstractQueue; //导入依赖的package包/类
public ResumeRestoreCommand(AbstractQueue<RemoteFile> queue, String targetPath, Activity act) {
this.queue = queue;
this.targetPath = targetPath;
this.act = act;
}
示例14: EventQueueWorker
import java.util.AbstractQueue; //导入依赖的package包/类
public EventQueueWorker(AbstractQueue<Event> queue) {
this.queue = queue;
}
示例15: newCollection
import java.util.AbstractQueue; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected AbstractQueue<T> newCollection() {
return new PriorityQueue<T>();
}