当前位置: 首页>>代码示例>>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;未经允许,请勿转载。