當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractQueue類代碼示例

本文整理匯總了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;
}
 
開發者ID:sunli1223,項目名稱:fqueue,代碼行數:26,代碼來源:FSStorage.java

示例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);
}
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:30,代碼來源:ControlBackup.java

示例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);
    }        
}
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:9,代碼來源:ControlBackup.java

示例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;
}
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:12,代碼來源:ControlBackup.java

示例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);
            }
        }
    }
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:12,代碼來源:ControlBackup.java

示例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);
            }
        }
    }
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:11,代碼來源:ControlBackup.java

示例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);
    }
}
 
開發者ID:asdf2014,項目名稱:yuzhouwan,代碼行數:32,代碼來源:GCTest.java

示例8: newCollection

import java.util.AbstractQueue; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected AbstractQueue<T> newCollection() {
    return new PriorityQueue<T>();
}
 
開發者ID:vegegoku,項目名稱:gwt-jackson-apt,代碼行數:8,代碼來源:AbstractQueueJsonDeserializer.java

示例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;
}
 
開發者ID:heindorf,項目名稱:cikm16-wdvd-feature-extraction,代碼行數:7,代碼來源:ParallelProcessor.java

示例10: QueueTest

import java.util.AbstractQueue; //導入依賴的package包/類
public QueueTest(AbstractQueue<Integer> queue) {
    this.queue = queue;
}
 
開發者ID:TestingResearchIllinois,項目名稱:NonDex,代碼行數:4,代碼來源:QueueTest.java

示例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);
}
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:18,代碼來源:ControlBackup.java

示例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;
}
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:7,代碼來源:ControlBackup.java

示例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;
}
 
開發者ID:modcs,項目名稱:caboclo,代碼行數:6,代碼來源:ControlBackup.java

示例14: EventQueueWorker

import java.util.AbstractQueue; //導入依賴的package包/類
public EventQueueWorker(AbstractQueue<Event> queue) {
    this.queue = queue;
}
 
開發者ID:dskw,項目名稱:jes,代碼行數:4,代碼來源:EventQueueWorker.java

示例15: newCollection

import java.util.AbstractQueue; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
protected AbstractQueue<T> newCollection() {
    return new PriorityQueue<T>();
}
 
開發者ID:nmorel,項目名稱:gwt-jackson,代碼行數:6,代碼來源:AbstractQueueJsonDeserializer.java


注:本文中的java.util.AbstractQueue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。