Example usage for java.lang Thread getName

List of usage examples for java.lang Thread getName

Introduction

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

Prototype

public final String getName() 

Source Link

Document

Returns this thread's name.

Usage

From source file:com.inmobi.grill.server.query.QueryExecutionServiceImpl.java

public synchronized void stop() {
    super.stop();
    querySubmitter.interrupt();/* w w  w.  jav a  2s  . c  o  m*/
    statusPoller.interrupt();
    queryPurger.interrupt();
    prepareQueryPurger.interrupt();

    for (Thread th : new Thread[] { querySubmitter, statusPoller, queryPurger, prepareQueryPurger }) {
        try {
            th.join();
        } catch (InterruptedException e) {
            LOG.error("Error waiting for thread: " + th.getName(), e);
        }
    }
    LOG.info("Query execution service stopped");
}

From source file:i2p.bote.I2PBote.java

private void printRunningThreads() {
    List<Thread> runningThreads = new ArrayList<Thread>();
    for (Thread thread : backgroundThreads)
        if (thread.isAlive())
            runningThreads.add(thread);//from ww w . j  ava2  s . c o m
    log.debug(runningThreads.size() + " threads still running 5 seconds after interrupt()"
            + (runningThreads.isEmpty() ? '.' : ':'));
    for (Thread thread : runningThreads)
        log.debug("  " + thread.getName());
    if (imapService != null && imapService.isStarted())
        log.debug("IMAP service still running");
    if (smtpService != null && smtpService.isRunning())
        log.debug("SMTP service still running");
}

From source file:com.nuvolect.deepdive.probe.DecompileApk.java

private JSONObject cfr() {

    m_srcCfrFolder.mkdirs();/*from www.  j  a v a 2 s . c om*/

    Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {

            LogUtil.log(LogUtil.LogType.DECOMPILE, "Uncaught exception: " + e.toString());
            m_progressStream.putStream("Uncaught exception: " + t.getName());
            m_progressStream.putStream("Uncaught exception: " + e.toString());
        }
    };

    m_cfr_time = System.currentTimeMillis(); // Save start time for tracking

    m_cfrThread = new Thread(m_threadGroup, new Runnable() {
        @Override
        public void run() {

            m_progressStream = new ProgressStream(
                    new OmniFile(m_volumeId, m_srcCfrFolderPath + "cfr_decompile_log.txt"));
            m_progressStream.putStream("CFR " + MiscConstants.CFR_VERSION + " starting");
            OmniFile jarFile = null;
            try {
                for (String fileName : m_dexFileNames) {

                    jarFile = new OmniFile(m_volumeId, m_appFolderPath + fileName + ".jar");

                    if (jarFile.exists() && jarFile.isFile()) {

                        String[] args = { jarFile.getStdFile().toString(), "--outputdir",
                                m_srcCfrFolder.getStdFile().toString() };

                        Map<String, String> optionArgs = new HashMap<String, String>();
                        optionArgs.put("outputdir", m_srcCfrFolder.getStdFile().toString());
                        Options options = new OptionsImpl(optionArgs);
                        ClassFileSourceImpl classFileSource = new ClassFileSourceImpl(options);
                        final DCCommonState dcCommonState = new DCCommonState(options, classFileSource);
                        DumperFactoryImpl dumperFactory = new DumperFactoryImpl(options);
                        org.benf.cfr.reader.Main.doJar(dcCommonState, jarFile.getAbsolutePath(), dumperFactory);
                    }
                }

            } catch (Exception | StackOverflowError e) {
                m_progressStream.putStream(e.toString());
            }
            m_progressStream.putStream("CFR complete: " + TimeUtil.deltaTimeHrMinSec(m_cfr_time));
            m_progressStream.close();
            m_cfr_time = 0;

        }
    }, DEEPDIVE_THREAD_GROUP, STACK_SIZE);

    m_cfrThread.setPriority(Thread.MAX_PRIORITY);
    m_cfrThread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    m_cfrThread.start();

    String processKey = "cfr_thread";
    String urlKey = "cfr_url";

    return processWrapper(processKey, urlKey);
}

From source file:com.nuvolect.deepdive.probe.DecompileApk.java

/**
 * Jadx converts a DEX file directly into Java files.  It does not input JAR files.
 *//*  ww w.j  ava2  s. c  o  m*/
private JSONObject jadx() {

    m_srcJadxFolder.mkdirs();
    Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {

            LogUtil.log(LogUtil.LogType.DECOMPILE, "Uncaught exception: " + e.toString());
            m_progressStream.putStream("Uncaught exception: " + t.getName());
            m_progressStream.putStream("Uncaught exception: " + e.toString());
        }
    };

    m_jadx_time = System.currentTimeMillis(); // Save start time for tracking

    m_jadxThread = new Thread(m_threadGroup, new Runnable() {
        @Override
        public void run() {

            m_progressStream.putStream("Jadx starting");
            /*
             * Type File require, versus OmniFile, in order to provide loadFiles
             * a list of <File>.
             */
            List<File> dexList = new ArrayList<>();
            JadxDecompiler jadx = new JadxDecompiler();
            jadx.setOutputDir(m_srcJadxFolder.getStdFile());
            String loadingNames = "";
            String spacer = "";

            for (String fileName : m_dexFileNames) {

                OmniFile dexFile = new OmniFile(m_volumeId, m_appFolderPath + fileName + ".dex");

                if (dexFile.exists() && dexFile.isFile()) {

                    dexList.add(dexFile.getStdFile());
                    loadingNames += spacer + dexFile.getName();
                    spacer = ", ";

                    if (fileName.contentEquals(OPTIMIZED_CLASSES))
                        break;
                }
            }
            try {
                m_progressStream.putStream("Loading: " + loadingNames);
                jadx.loadFiles(dexList);
                m_progressStream.putStream("Load complete");
            } catch (Exception e) {
                LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
                m_progressStream.putStream(e.toString());
            }
            try {
                m_progressStream.putStream("Jadx saveSources start");
                jadx.saveSources();
                m_progressStream.putStream("Jadx saveSources complete");
            } catch (Exception e) {
                LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
                m_progressStream.putStream(e.toString());
            }

            m_progressStream.putStream("Jadx complete: " + TimeUtil.deltaTimeHrMinSec(m_jadx_time));
            m_jadx_time = 0;

        }
    }, JADX_THREAD, STACK_SIZE);

    m_jadxThread.setPriority(Thread.MAX_PRIORITY);
    m_jadxThread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    m_jadxThread.start();

    String processKey = "jadx_thread";
    //                processStatus = getThreadStatus( true, m_jadxThread);
    String urlKey = "jadx_url";
    //                url = OmniHash.getHashedServerUrl( m_ctx, m_volumeId, m_srcJadxFolderPath);

    return processWrapper(processKey, urlKey);
}

From source file:org.diorite.impl.scheduler.DioriteAsyncTask.java

@Override
public void run() {
    final Thread thread = Thread.currentThread();
    synchronized (this.workers) {
        if (this.getPeriod() == STATE_CANCEL) {
            return;
        }/*from w ww  . ja v  a  2  s.  c o m*/
        this.workers.add(new DioriteWorkerImpl(this, thread));
    }
    Throwable thrown = null;
    try {
        super.run();
    } catch (final Throwable t) {
        thrown = t;
        throw new RuntimeException("Plugin " + this.getOwner().getName()
                + " generated an exception while executing task " + this.getTaskId(), thrown);
    } finally {
        synchronized (this.workers) {
            try {
                final Iterator<DioriteWorker> workers = this.workers.iterator();
                boolean removed = false;
                while (workers.hasNext()) {
                    if (workers.next().getThread() == thread) {
                        workers.remove();
                        removed = true;
                        break;
                    }
                }
                if (!removed) {
                    //noinspection ThrowFromFinallyBlock
                    throw new IllegalStateException("Unable to remove worker " + thread.getName() + " on task "
                            + this.getTaskId() + " for " + this.getOwner().getName(), thrown);
                }
            } finally {
                if ((this.getPeriod() < 0) && this.workers.isEmpty()) {
                    this.runners.remove(this.getTaskId());
                }
            }
        }
    }
}

From source file:com.nuvolect.deepdive.probe.DecompileApk.java

private JSONObject dex2jar() {

    // DEX 2 JAR CONFIGS
    final boolean reuseReg = false; // reuse register while generate java .class file
    final boolean topologicalSort1 = false; // same with --topological-sort/-ts
    final boolean topologicalSort = false; // sort block by topological, that will generate more readable code
    final boolean verbose = true; // show progress
    final boolean debugInfo = false; // translate debug info
    final boolean printIR = false; // print ir to System.out
    final boolean optimizeSynchronized = true; // Optimise-synchronised

    final Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
        @Override//from   w w  w . ja  va2 s .c  om
        public void uncaughtException(Thread t, Throwable e) {

            LogUtil.log(LogUtil.LogType.DECOMPILE, "Uncaught exception: " + e.toString());
            m_progressStream.putStream("Uncaught exception: " + t.getName());
            m_progressStream.putStream("Uncaught exception: " + e.toString());
        }
    };

    m_dex2jar_time = System.currentTimeMillis(); // Save start time for tracking

    m_dex2jarThread = new Thread(m_threadGroup, new Runnable() {
        @Override
        public void run() {

            boolean success = false;
            OmniFile dexFile = null;
            OmniFile jarFile = null;
            m_progressStream.putStream("DEX to JAR starting");

            for (String fileName : m_dexFileNames) {

                dexFile = new OmniFile(m_volumeId, m_appFolderPath + fileName + ".dex");

                if (dexFile.exists() && dexFile.isFile()) {

                    String size = NumberFormat.getNumberInstance(Locale.US).format(dexFile.length());
                    m_progressStream.putStream("DEX to JAR processing: " + dexFile.getName() + ", " + size);

                    DexExceptionHandlerMod dexExceptionHandlerMod = new DexExceptionHandlerMod();
                    jarFile = new OmniFile(m_volumeId, m_appFolderPath + fileName + ".jar");

                    if (jarFile.exists())
                        jarFile.delete();

                    try {
                        DexFileReader reader = new DexFileReader(dexFile.getStdFile());
                        Dex2jar dex2jar = Dex2jar.from(reader).reUseReg(reuseReg)
                                .topoLogicalSort(topologicalSort || topologicalSort1).skipDebug(!debugInfo)
                                .optimizeSynchronized(optimizeSynchronized).printIR(printIR);
                        //.verbose(verbose);
                        dex2jar.setExceptionHandler(dexExceptionHandlerMod);
                        dex2jar.to(jarFile.getStdFile());
                        success = true;
                    } catch (Exception e) {
                        String ex = LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
                        m_progressStream.putStream(ex);
                        m_progressStream.putStream("DEX to JAR failed: " + jarFile.getName());
                        success = false;
                        continue;
                    }
                    if (success) {
                        size = NumberFormat.getNumberInstance(Locale.US).format(jarFile.length());
                        m_progressStream.putStream("DEX to JAR succeeded: " + jarFile.getName() + ", " + size);
                    } else {
                        m_progressStream
                                .putStream("Exception thrown, file cannot be decompiled: " + dexFile.getPath());
                    }
                }
            }
            if (jarFile == null)
                m_progressStream.putStream("No DEX file found: " + m_dexFileNames);

            m_progressStream.putStream("DEX to JAR complete: " + TimeUtil.deltaTimeHrMinSec(m_dex2jar_time));
            m_dex2jar_time = 0;

        }

    }, DEX2JAR_THREAD, STACK_SIZE);

    m_dex2jarThread.setPriority(Thread.MAX_PRIORITY);
    m_dex2jarThread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    m_dex2jarThread.start();

    JSONObject wrapper = new JSONObject();
    try {
        wrapper.put("dex2jar_thread", getThreadStatus(true, m_dex2jarThread));

    } catch (JSONException e) {
        LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
    }

    return wrapper;
}

From source file:io.requery.android.database.sqlite.SQLiteConnectionPool.java

private void logConnectionPoolBusyLocked(long waitMillis, int connectionFlags) {
    final Thread thread = Thread.currentThread();
    StringBuilder msg = new StringBuilder();
    msg.append("The connection pool for database '").append(mConfiguration.label);
    msg.append("' has been unable to grant a connection to thread ");
    msg.append(thread.getId()).append(" (").append(thread.getName()).append(") ");
    msg.append("with flags 0x").append(Integer.toHexString(connectionFlags));
    msg.append(" for ").append(waitMillis * 0.001f).append(" seconds.\n");

    ArrayList<String> requests = new ArrayList<>();
    int activeConnections = 0;
    int idleConnections = 0;
    if (!mAcquiredConnections.isEmpty()) {
        for (SQLiteConnection connection : mAcquiredConnections.keySet()) {
            String description = connection.describeCurrentOperationUnsafe();
            if (description != null) {
                requests.add(description);
                activeConnections += 1;/*w  w w .java  2s .co  m*/
            } else {
                idleConnections += 1;
            }
        }
    }
    int availableConnections = mAvailableNonPrimaryConnections.size();
    if (mAvailablePrimaryConnection != null) {
        availableConnections += 1;
    }

    msg.append("Connections: ").append(activeConnections).append(" active, ");
    msg.append(idleConnections).append(" idle, ");
    msg.append(availableConnections).append(" available.\n");

    if (!requests.isEmpty()) {
        msg.append("\nRequests in progress:\n");
        for (String request : requests) {
            msg.append("  ").append(request).append("\n");
        }
    }

    Log.w(TAG, msg.toString());
}

From source file:com.nuvolect.deepdive.probe.DecompileApk.java

/**
 * Fernflower converts JAR files to a zipped decompiled JAR file then
 * it unzips the JAR file./*  w  w w  . ja  v a  2 s  .  c om*/
 */
private JSONObject fern_flower() {// https://github.com/fesh0r/fernflower

    m_srcFernFolder.mkdirs();

    Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {

            LogUtil.log(LogUtil.LogType.DECOMPILE, "Uncaught exception: " + e.toString());
            m_progressStream.putStream("Uncaught exception: " + t.getName());
            m_progressStream.putStream("Uncaught exception: " + e.toString());
        }
    };

    m_fern_time = System.currentTimeMillis(); // Save start time for tracking

    m_fernThread = new Thread(m_threadGroup, new Runnable() {
        @Override
        public void run() {

            File inputJarFile = null;
            String inputJarFileName = "";

            for (int i = 0; i < m_dexFileNames.length; i++) {

                inputJarFileName = m_dexFileNames[i] + ".jar";
                OmniFile inputJarOmniFile = new OmniFile(m_volumeId, m_appFolderPath + inputJarFileName);
                inputJarFile = inputJarOmniFile.getStdFile();

                if (inputJarFile.exists() && inputJarFile.isFile()) {

                    boolean success = true;
                    try {
                        m_progressStream.putStream("Fernflower starting: " + inputJarFileName);
                        PrintStream printStream = new PrintStream(m_progressStream);
                        System.setErr(printStream);
                        System.setOut(printStream);
                        OmniFile fernLog = new OmniFile(m_volumeId,
                                m_srcFernFolderPath + "/" + m_dexFileNames[i] + "_log.txt");
                        PrintStream logStream = new PrintStream(fernLog.getOutputStream());
                        PrintStreamLogger logger = new PrintStreamLogger(logStream);

                        final Map<String, Object> mapOptions = new HashMap<>();
                        ConsoleDecompiler decompiler = new ConsoleDecompiler(m_srcFernFolder.getStdFile(),
                                mapOptions, logger);
                        decompiler.addSpace(inputJarFile, true);

                        m_progressStream
                                .putStream("Fernflower decompiler.addSpace complete: " + inputJarFileName);
                        decompiler.decompileContext();
                        m_progressStream.putStream(
                                "Fernflower decompiler.decompileContext complete: " + inputJarFileName);

                        String decompiledJarFilePath = m_srcFernFolderPath + "/" + inputJarFileName;
                        OmniFile decompiledJarFile = new OmniFile(m_volumeId, decompiledJarFilePath);
                        success = OmniZip.unzipFile(decompiledJarFile, m_srcFernFolder, null, null);
                        decompiledJarFile.delete();

                        if (success) {
                            m_progressStream
                                    .putStream("Fernflower decompiler.unpack complete: " + inputJarFileName);
                        } else {
                            m_progressStream
                                    .putStream("Fernflower decompiler.unpack failed: " + inputJarFileName);
                        }
                    } catch (Exception e) {
                        String str = LogUtil.logException(LogUtil.LogType.FERNFLOWER, e);
                        m_progressStream.putStream("Fernflower exception " + inputJarFileName);
                        m_progressStream.putStream(str);
                        success = false;
                    }
                    /**
                     * Look for the classes.jar file and unzip it
                     */
                    if (!success) {

                        OmniFile of = new OmniFile(m_volumeId, m_srcFernFolderPath + "/classes.jar");
                        if (of.exists()) {

                            ApkZipUtil.unzip(of, m_srcFernFolder, m_progressStream);
                            m_progressStream.putStream(
                                    "Fernflower utility unzip complete with errors: " + inputJarFileName);
                        } else {
                            m_progressStream.putStream("File does not exist: " + of.getAbsolutePath());
                        }
                    }
                }
            }
            m_progressStream.putStream("Fernflower complete: " + TimeUtil.deltaTimeHrMinSec(m_fern_time));
            m_fern_time = 0;

        }
    }, FERN_THREAD, STACK_SIZE);

    m_fernThread.setPriority(Thread.MAX_PRIORITY);
    m_fernThread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    m_fernThread.start();

    //                String processStatus = getThreadStatus( true, m_fernThread);
    //                String url = OmniHash.getHashedServerUrl( m_ctx, m_volumeId, m_srcFernFolderPath);

    String processKey = "fern_thread";
    String urlKey = "fern_url";

    return processWrapper(processKey, urlKey);
}

From source file:com.gargoylesoftware.htmlunit.javascript.JavaScriptEngineTest.java

/**
 * Ensures that the JS executor thread is a daemon thread.
 * @throws Exception if the test fails/*from   ww  w  .ja  v a2  s . c  o  m*/
 */
@Test
public void daemonExecutorThread() throws Exception {
    final String html = "<html><body><script>\n" + "function f() { alert('foo'); }\n" + "setTimeout(f, 5);\n"
            + "</script>\n" + "</body></html>";

    final List<String> collectedAlerts = new ArrayList<String>();
    final HtmlPage page = loadPage(getBrowserVersion(), html, collectedAlerts);

    Thread.sleep(20);
    final List<Thread> jsThreads = getJavaScriptThreads();
    assertEquals(1, jsThreads.size());
    final Thread jsThread = jsThreads.get(0);
    assertEquals("JS executor for " + page.getWebClient(), jsThread.getName());
    assertTrue(jsThread.isDaemon());
}

From source file:com.nuvolect.deepdive.probe.DecompileApk.java

/**
 * Build a new DEX file excluding classes in the OPTIMIZED_CLASS_EXCLUSION file
 * @return/* w  w  w.  j  a v a  2s . c  om*/
 */
private JSONObject optimizeDex() {

    final Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {

            LogUtil.log(LogUtil.LogType.DECOMPILE, "Uncaught exception: " + e.toString());
            m_progressStream.putStream("Uncaught exception: " + t.getName());
            m_progressStream.putStream("Uncaught exception: " + e.toString());
        }
    };

    m_optimize_dex_time = System.currentTimeMillis(); // Save start time for tracking

    m_optimizeDexThread = new Thread(m_threadGroup, new Runnable() {
        @Override
        public void run() {

            m_progressStream = new ProgressStream(
                    new OmniFile(m_volumeId, m_appFolderPath + DEX_OPTIMIZATION_LOG_FILE));

            m_progressStream
                    .putStream("Optimizing classes, reference: " + OPTIMIZED_CLASSES_EXCLUSION_FILENAME);

            Scanner s = null;
            try {
                OmniFile omniFile = new OmniFile(m_volumeId,
                        m_appFolderPath + OPTIMIZED_CLASSES_EXCLUSION_FILENAME);
                s = new Scanner(omniFile.getStdFile());
                while (s.hasNext()) {
                    String excludeClass = s.next();
                    ignoredLibs.add(excludeClass);
                    m_progressStream.putStream("Exclude class: " + excludeClass);
                }
            } catch (Exception e) {
                LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
            }
            if (s != null)
                s.close();

            ArrayList<OmniFile> dexFiles = new ArrayList<>();

            for (String fileName : m_dexFileNames) {

                OmniFile dexFile = new OmniFile(m_volumeId, m_appFolderPath + fileName + ".dex");

                if (dexFile.exists() && dexFile.isFile()) {

                    dexFiles.add(dexFile);// Keep track for summary

                    List<ClassDef> classes = new ArrayList<>();
                    m_progressStream.putStream("Processing: " + fileName + ".dex");
                    org.jf.dexlib2.iface.DexFile memoryDexFile = null;
                    try {
                        memoryDexFile = DexFileFactory.loadDexFile(dexFile.getStdFile(), Opcodes.forApi(19));
                    } catch (Exception e) {
                        m_progressStream.putStream("The app DEX file cannot be decompiled.");
                        LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
                        continue;
                    }

                    int excludedClassCount = 0;
                    Set<? extends ClassDef> origClassSet = memoryDexFile.getClasses();
                    memoryDexFile = null; // Release memory

                    for (org.jf.dexlib2.iface.ClassDef classDef : origClassSet) {

                        final String currentClass = classDef.getType();

                        if (isIgnored(currentClass)) {
                            ++excludedClassCount;
                            m_progressStream.putStream("Excluded class: " + currentClass);
                        } else {
                            m_progressStream.putStream("Included class: " + currentClass);
                            classes.add(classDef);
                        }
                    }
                    origClassSet = null; // Release memory

                    m_progressStream.putStream("Excluded classes #" + excludedClassCount);
                    m_progressStream.putStream("Included classes #" + classes.size());
                    m_progressStream.putStream("Rebuilding immutable dex: " + fileName + ".dex");

                    if (classes.size() > 0) {

                        DexFile optDexFile = new ImmutableDexFile(Opcodes.forApi(19), classes);
                        classes = null; // Release memory

                        try {
                            if (dexFile.delete())
                                m_progressStream.putStream("Fat DEX file delete success: " + dexFile.getName());
                            else
                                m_progressStream.putStream("Fat DEX file delete FAILED: " + dexFile.getName());

                            DexPool.writeTo(dexFile.getStdFile().getAbsolutePath(), optDexFile);
                            String size = NumberFormat.getNumberInstance(Locale.US).format(dexFile.length());

                            m_progressStream.putStream(
                                    "Optimized DEX file created: " + dexFile.getName() + ", size: " + size);
                        } catch (IOException e) {
                            m_progressStream.putStream("DEX IOException, write error: " + dexFile.getName());
                            LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
                        } catch (Exception e) {
                            m_progressStream.putStream("DEX Exception, write error: " + dexFile.getName());
                            LogUtil.logException(LogUtil.LogType.DECOMPILE, e);
                        }
                        optDexFile = null; // release memory
                    } else {

                        m_progressStream
                                .putStream("All classes excluded, DEX file not needed: " + dexFile.getName());
                        m_progressStream.putStream("Deleting: " + dexFile.getName());
                        dexFile.delete();
                    }
                }
            }
            for (OmniFile f : dexFiles) {

                if (f.exists()) {

                    String formatted_count = String.format(Locale.US, "%,d", f.length()) + " bytes";
                    m_progressStream.putStream("DEX optimized: " + f.getName() + ": " + formatted_count);
                } else {
                    m_progressStream.putStream("DEX deleted: " + f.getName() + ", all classes excluded");
                }
            }
            dexFiles = new ArrayList<>();// Release memory

            m_progressStream
                    .putStream("Optimize DEX complete: " + TimeUtil.deltaTimeHrMinSec(m_optimize_dex_time));
            m_progressStream.close();
            m_optimize_dex_time = 0;

        }
    }, UNZIP_APK_THREAD, STACK_SIZE);

    m_optimizeDexThread.setPriority(Thread.MAX_PRIORITY);
    m_optimizeDexThread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
    m_optimizeDexThread.start();

    return new JSONObject();
}