Example usage for java.lang Thread NORM_PRIORITY

List of usage examples for java.lang Thread NORM_PRIORITY

Introduction

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

Prototype

int NORM_PRIORITY

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

Click Source Link

Document

The default priority that is assigned to a thread.

Usage

From source file:org.mwc.cmap.media.views.images.ImageLoader.java

public synchronized static ImageLoader getInstance() {
    if (instance == null) {
        instance = new ImageLoader();
        Thread thread = new Thread(instance);
        thread.setDaemon(true);/*from ww  w.  jav a2  s .c  o  m*/
        thread.setPriority(Thread.NORM_PRIORITY - 2);
        thread.start();
    }
    return instance;
}

From source file:org.gldapdaemon.core.GmailPool.java

public GmailPool(ThreadGroup mainGroup, Configurator configurator) {
    super(mainGroup, "Gmail pool");
    setPriority(Thread.NORM_PRIORITY - 2);

    // Enable contact service
    ldap = configurator.getConfigProperty(Configurator.LDAP_ENABLED, false);

    // Start pooler
    start();//  ww  w  .j  av  a  2  s.  c o  m
}

From source file:com.l2jfree.util.concurrent.L2RejectedExecutionHandler.java

@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
    if (executor.isShutdown())
        return;//w w w  .  j a  v  a 2  s.c  o m

    _log.warn(r + " from " + executor, new RejectedExecutionException());

    if (Thread.currentThread().getPriority() > Thread.NORM_PRIORITY)
        new Thread(r).start();
    else
        r.run();
}

From source file:org.gcaldaemon.core.GmailPool.java

public GmailPool(ThreadGroup mainGroup, Configurator configurator) {
    super(mainGroup, "Gmail pool");
    setPriority(Thread.NORM_PRIORITY - 2);

    // Enable contact service
    ldap = configurator.getConfigProperty(Configurator.LDAP_ENABLED, false);

    // Enable SMTP service
    smtp = configurator.getConfigProperty(Configurator.SENDMAIL_ENABLED, false)
            || configurator.getConfigProperty(Configurator.MAILTERM_ENABLED, false);

    // Enable IMAP service
    imap = configurator.getConfigProperty(Configurator.MAILTERM_ENABLED, false);

    // Init global static variables in entry
    GmailEntry.globalInit();/* ww w .java 2s  .c  o m*/

    // Start pooler
    start();
}

From source file:ja.centre.gui.concurrent.TaskSequence.java

public TaskSequence(IThrowableProcessor processor) {
    this(Thread.NORM_PRIORITY, processor);
}

From source file:com.prkd.fileupload.SimpleImageActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(getApplicationContext());
    config.threadPriority(Thread.NORM_PRIORITY - 2);
    config.denyCacheImageMultipleSizesInMemory();
    config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
    config.tasksProcessingOrder(QueueProcessingType.LIFO);
    config.writeDebugLogs(); // Remove for release app

    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config.build());

    //    String[] urls = getIntent().getExtras().getStringArray("urls");
    Fragment fr;/*from   w w w.j a va 2 s  .  c o m*/
    String tag;
    int titleRes;
    tag = ImagePagerFragment.class.getSimpleName();
    fr = getSupportFragmentManager().findFragmentByTag(tag);
    if (fr == null) {
        fr = new ImagePagerFragment();
        fr.setArguments(getIntent().getExtras());
    }
    titleRes = R.string.ac_name_image_pager;

    setTitle(titleRes);
    getSupportFragmentManager().beginTransaction().replace(android.R.id.content, fr, tag).commit();
}

From source file:gridool.util.xfer.TransferServer.java

public TransferServer(@Nonnull int numWorkers, @CheckForNull TransferRequestListener handler) {
    this(numWorkers, Thread.NORM_PRIORITY, handler);
}

From source file:com.lime.mypol.application.GlobalApplication.java

public static void initImageLoader(Context context) {
    // This configuration tuning is custom. You can tune every option, you may tune some of them,
    // or you can create default configuration by
    //  ImageLoaderConfiguration.createDefault(this);
    // method.//ww  w  . j  a v  a  2  s .c  o m
    DisplayImageOptions options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_empty_photo).showImageForEmptyUri(R.drawable.ic_empty_photo)
            .showImageOnFail(R.drawable.ic_empty_photo).cacheInMemory(true).cacheOnDisc(true)
            .considerExifParams(true).build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO).writeDebugLogs() // Remove for release app
            .defaultDisplayImageOptions(options)
            .imageDownloader(
                    new HttpClientImageDownloader(context, NetworkManager.getInstance().getHttpClient()))
            .build();
    com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);
}

From source file:com.limewoodmedia.nsdroid.Utils.java

public static ImageLoaderConfiguration getImageLoaderConfig(Context context) {
    return new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory().threadPoolSize(2)
            .diskCacheFileNameGenerator(new Md5FileNameGenerator()).diskCacheSize(200 * 1024 * 1024) // 200 Mb
            .memoryCacheSize(20 * 1024 * 1024) // 20 Mb
            .tasksProcessingOrder(QueueProcessingType.LIFO).build();
}

From source file:burstcoin.jminer.core.CoreConfig.java

/**
 * Reader pool./*  w w  w  .  j av a  2s  . c om*/
 *
 * @return the thread pool task executor
 */
@Bean(name = "readerPool")
public ThreadPoolTaskExecutor readerPool() {
    ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
    pool.setThreadPriority(Thread.NORM_PRIORITY);
    // false-> triggers interrupt exception at shutdown
    pool.setWaitForTasksToCompleteOnShutdown(true);
    return pool;
}