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:usbong.android.utils.UsbongUtils.java

public static void initDisplayAndConfigOfUIL(Context context) {
    @SuppressWarnings("deprecation")
    DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).resetViewBeforeLoading(true)
            .showImageForEmptyUri(R.drawable.loading).showImageOnFail(R.drawable.loading)
            .showImageOnLoading(R.drawable.loading).bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(300)).build();
    ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
    config.memoryCache(new WeakMemoryCache());
    config.defaultDisplayImageOptions(options);
    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
    ImageLoader.getInstance().init(config.build());
}

From source file:fs.MainWindow.java

private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
    jProgressBarSE.setValue(0);/*  ww w.j a v  a 2  s . c  o m*/
    double alpha = (Double) jS_AlphaSE.getValue();
    double q_entropy = (Double) jS_QEntropySE.getValue();

    if (q_entropy < 0 || alpha < 0) {
        //entrada de dados invalida.
        JOptionPane.showMessageDialog(null,
                "Error on parameter value:" + " The values of q-entropy and Alpha must be positives.",
                "Application Error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    class Thread1 extends Thread {

        @Override
        public void run() {
            try {
                if (jRB_SFSSE.isSelected()) {
                    ExecuteFeatureSelection(1);// SFS

                } else if (jRB_ESSE.isSelected()) {
                    ExecuteFeatureSelection(2);// ExhaustiveSearch

                } else if (jRB_SFFSSE.isSelected()) {
                    ExecuteFeatureSelection(3);// SFFS

                } else {
                    JOptionPane.showMessageDialog(null, "Select Feature " + "Selector must be marked.", "Error",
                            JOptionPane.ERROR_MESSAGE);
                }
            } catch (IOException error) {
                throw new FSException("Error on Execution of the Search" + " Method." + error, false);
            }
        }
    }
    Thread thread = new Thread1();
    thread.setPriority(Thread.NORM_PRIORITY);
    thread.setName("SE");
    thread.start();
}

From source file:fs.MainWindow.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    double alpha = (Double) jS_AlphaCV.getValue();
    double q_entropy = (Double) jS_QEntropyCV.getValue();

    if (q_entropy < 0 || alpha < 0) {
        //entrada de dados invalida.
        JOptionPane.showMessageDialog(null,
                "Error on parameter value:" + " The values of q-entropy and Alpha must be positives.",
                "Application Error", JOptionPane.ERROR_MESSAGE);
        return;//ww w  .  j a  v  a 2  s  .  com
    }

    class ThreadCV extends Thread {

        @Override
        public void run() {
            try {
                if (jRB_SFSCV.isSelected()) {
                    CrossValidation((Integer) jS_NrExecutionsCV.getValue(),
                            ((float) jSliderCV.getValue()) / 100, 1);// SFS

                } else if (jRB_ESCV.isSelected()) {
                    CrossValidation((Integer) jS_NrExecutionsCV.getValue(),
                            ((float) jSliderCV.getValue()) / 100, 2);//ExhaustiveSearch

                } else if (jRB_SFFSCV.isSelected()) {
                    CrossValidation((Integer) jS_NrExecutionsCV.getValue(),
                            ((float) jSliderCV.getValue()) / 100, 3);// SFFS

                } else {
                    JOptionPane.showMessageDialog(null, "Select Feature " + "Selector must be marked.", "Error",
                            JOptionPane.ERROR_MESSAGE);
                }
            } catch (IOException error) {
                throw new FSException("Error on Cross-validation." + error, false);
            }
        }
    }
    Thread thread = new ThreadCV();
    thread.setPriority(Thread.NORM_PRIORITY);
    thread.setName("CV");
    thread.start();
}

From source file:Distortions.java

private static void startAndJoin(Thread[] threads) {
    for (int ithread = 0; ithread < threads.length; ++ithread) {
        threads[ithread].setPriority(Thread.NORM_PRIORITY);
        threads[ithread].start();//from  www .  j a v a  2 s  . c om
    }

    try {
        for (int ithread = 0; ithread < threads.length; ++ithread)
            threads[ithread].join();
    } catch (InterruptedException ie) {
        throw new RuntimeException(ie);
    }
}