Example usage for java.lang Thread MIN_PRIORITY

List of usage examples for java.lang Thread MIN_PRIORITY

Introduction

In this page you can find the example usage for java.lang Thread MIN_PRIORITY.

Prototype

int MIN_PRIORITY

To view the source code for java.lang Thread MIN_PRIORITY.

Click Source Link

Document

The minimum priority that a thread can have.

Usage

From source file:com.lightbox.android.bitmap.BitmapFileCleanerTask.java

private static ExecutorService getExecutor() {
    if (sBitmapFileCleanerExecutor == null) {
        sBitmapFileCleanerExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
            @Override/*w  w w.  java 2 s .  co m*/
            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setName(TAG + " | " + thread.getName());
                thread.setPriority(Thread.MIN_PRIORITY);
                return thread;
            }
        });
    }
    return sBitmapFileCleanerExecutor;
}

From source file:org.apache.fop.visual.BatchDiffer.java

/**
 * Main method.//from  w  w w  .  j a v a2s  . c  o  m
 * @param args command-line arguments
 */
public static void main(String[] args) {
    try {
        if (args.length == 0) {
            System.err.println("Configuration file is missing!");
            printUsage();
            System.exit(-1);
        }
        File cfgFile = new File(args[0]);
        if (!cfgFile.exists()) {
            System.err.println("Configuration file cannot be found: " + args[0]);
            printUsage();
            System.exit(-1);
        }

        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
        BatchDiffer differ = new BatchDiffer();
        differ.runBatch(cfgFile);

        System.out.println("Regular exit...");
    } catch (Exception e) {
        System.out.println("Exception caught...");
        e.printStackTrace();
    }
}

From source file:com.searchcode.app.jobs.DeleteRepositoryJob.java

public void execute(JobExecutionContext context) throws JobExecutionException {
    if (!Singleton.getSharedService().getBackgroundJobsEnabled()) {
        return;// w w  w . jav  a 2s . c  o  m
    }

    List<String> persistentDelete = Singleton.getDataService().getPersistentDelete();
    if (persistentDelete.isEmpty()) {
        return;
    }

    RepoResult rr = Singleton.getRepo().getRepoByName(persistentDelete.get(0));
    if (rr == null) {
        Singleton.getDataService().removeFromPersistentDelete(persistentDelete.get(0));
        return;
    }

    try {
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);

        Singleton.getUniqueGitRepoQueue().delete(rr);

        if (Singleton.getRunningIndexRepoJobs().containsKey(rr.getName())) {
            return;
        }

        Singleton.getLogger().info("Deleting repository. " + rr.getName());
        Singleton.getCodeIndexer().deleteByReponame(rr.getName());

        // remove the directory
        String repoLocations = Properties.getProperties().getProperty(Values.REPOSITORYLOCATION,
                Values.DEFAULTREPOSITORYLOCATION);
        FileUtils.deleteDirectory(new File(repoLocations + rr.getName() + "/"));

        // Remove from the database
        Singleton.getRepo().deleteRepoByName(rr.getName());

        // Remove from the persistent queue
        Singleton.getDataService().removeFromPersistentDelete(rr.getName());
    } catch (Exception ignored) {
    }
}

From source file:org.apache.axis2.clustering.tribes.AtMostOnceInterceptor.java

public AtMostOnceInterceptor() {
    Thread cleanupThread = new Thread(new MessageCleanupTask());
    cleanupThread.setPriority(Thread.MIN_PRIORITY);
    cleanupThread.setName("AtMostOnceInterceptor:Message-cleanup-thread"); // for debugging purposes
    cleanupThread.start();//from w  ww.  j a va 2s.  c o m
}

From source file:org.unitime.timetable.solver.SolverPassivationThread.java

public SolverPassivationThread(File folder, Map<String, ? extends SolverProxy> solvers,
        Map<String, ? extends ExamSolverProxy> examSolvers,
        Map<String, ? extends StudentSolverProxy> studentSolvers) {
    iFolder = folder;/*from w  ww.j  av  a 2s .c  o  m*/
    iSolvers = solvers;
    iExamSolvers = examSolvers;
    iStudentSolvers = studentSolvers;
    setName("SolverPasivationThread");
    setDaemon(true);
    setPriority(Thread.MIN_PRIORITY);
}

From source file:org.lnicholls.galleon.togo.ToGoThread.java

public ToGoThread(Server server) throws IOException {
    super("ToGoThread");
    mServer = server;//from  w w  w .  j a  va2s  .  c  om
    setPriority(Thread.MIN_PRIORITY);

    mToGo = new ToGo();
}

From source file:org.nodel.nodelhost.Service.java

@Override
public void start() throws Exception {
    System.out.println("Nodel [Jython] (v" + Launch.VERSION + ")...");

    _nodelLaunch = _processArgs == null ? new Launch() : new Launch(_processArgs);

    // start a non-daemon thread
    _thread = new Thread(new Runnable() {

        @Override//from   www.  j  av a 2s .  c  om
        public void run() {
            threadMain();
        }

    });
    _thread.setPriority(Thread.MIN_PRIORITY);
    _thread.start();
}

From source file:org.paxle.filter.robots.impl.store.FileStoreCleanupThread.java

/**
 * Generates a thread which wipes out robots.txt entries from the cache, which are older than their ExpirationDate
 * @param dir the directory where the robots.txt objects are stored
 *//*from w ww. j  av a 2  s .c  om*/
FileStoreCleanupThread(File dir) {
    this.dir = dir;
    this.setName("RobotsTxtCleanupThread");
    this.setPriority(Thread.MIN_PRIORITY);
}

From source file:net.sf.jacclog.service.importer.internal.queue.LogFileQueueImporterObserver.java

public LogFileQueueImporterObserver(final LogEntryImportService<ReadonlyLogEntry> service) {
    if (service == null) {
        throw new IllegalArgumentException("Argument 'service' must be not null.");
    }//from  w ww  .j  a v  a2 s.  c  o  m

    this.service = service;

    final BasicThreadFactory factory = new BasicThreadFactory.Builder()
            // attributes
            .namingPattern("file-importer-%d").daemon(true).priority(Thread.MIN_PRIORITY)
            .uncaughtExceptionHandler(new UncaughtExceptionHandler()).build();
    executor = Executors.newSingleThreadExecutor(factory);
}

From source file:org.alex73.skarynka.scan.process.ProcessDaemon.java

@Override
public void run() {
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    LOG.info("ProcessDaemon started");
    while (!finish) {
        try {/*www. jav a2  s  .c  om*/
            boolean processed = process();
            if (!finish) {
                synchronized (this) {
                    wait(processed ? 50 : 10000);
                }
            }
        } catch (Throwable ex) {
            LOG.error("Error process", ex);
        }
    }
}