Java 类java.util.AbstractQueue 实例源码

项目:fqueue    文件:FSStorage.java   
/**
 * 获取指定名称的队列存储实例 如果不存存在,根据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;
}
项目:caboclo    文件:ControlBackup.java   
@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);
}
项目:caboclo    文件:ControlBackup.java   
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);
    }        
}
项目:caboclo    文件:ControlBackup.java   
private AbstractQueue<RemoteFile> getRemoteFileList(String folder) {
    AbstractQueue<RemoteFile> list = new ConcurrentLinkedQueue<>();

    try {
        getRemoteFileListAux(folder, list);
    } catch (IOException ex) {
        ex.printStackTrace();
    }

    return list;
}
项目:caboclo    文件:ControlBackup.java   
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);
            }
        }
    }
项目:caboclo    文件:ControlBackup.java   
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);
            }
        }
    }
项目:yuzhouwan    文件:GCTest.java   
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);
    }
}
项目:gwt-jackson-apt    文件:AbstractQueueJsonDeserializer.java   
/**
 * {@inheritDoc}
 */
@Override
protected AbstractQueue<T> newCollection() {
    return new PriorityQueue<T>();
}
项目:cikm16-wdvd-feature-extraction    文件:ParallelProcessor.java   
Collector(AbstractQueue<FIFOEntry<Revision>> outgoingQueue,
        RevisionProcessor nextProcessor, int runningWorkerThreads) {
    this.outgoingQueue = outgoingQueue;
    this.nextProcessor = nextProcessor;
    this.runningWorkerThreads = runningWorkerThreads;
}
项目:NonDex    文件:QueueTest.java   
public QueueTest(AbstractQueue<Integer> queue) {
    this.queue = queue;
}
项目:NonDex    文件:QueueTest.java   
public QueueTest(AbstractQueue<Integer> queue) {
    this.queue = queue;
}
项目:caboclo    文件:ControlBackup.java   
@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);
}
项目:caboclo    文件:ControlBackup.java   
public ResumeBackupCommand(AbstractQueue<BackupItem> queue,
        String backupDir, Activity act) {
    this.queue = queue;
    this.act = act;
    this.backupDir = backupDir;
}
项目:caboclo    文件:ControlBackup.java   
public ResumeRestoreCommand(AbstractQueue<RemoteFile> queue, String targetPath, Activity act) {
    this.queue = queue;
    this.targetPath = targetPath;
    this.act = act;
}
项目:jes    文件:EventQueueWorker.java   
public EventQueueWorker(AbstractQueue<Event> queue) {
    this.queue = queue;
}
项目:gwt-jackson    文件:AbstractQueueJsonDeserializer.java   
/** {@inheritDoc} */
@Override
protected AbstractQueue<T> newCollection() {
    return new PriorityQueue<T>();
}
项目:fqueue    文件:FSStorage.java   
/**
 * 获取或者创建指定名称的队列存储实例
 * 
 * @param name
 * @return
 * @throws Exception
 */
private AbstractQueue<byte[]> getClientQueue(String name) throws Exception {
    return getClientQueue(name, true);
}