List of usage examples for java.lang Thread MAX_PRIORITY
int MAX_PRIORITY
To view the source code for java.lang Thread MAX_PRIORITY.
Click Source Link
From source file:com.nuvolect.deepdive.probe.DecompileApk.java
private JSONObject cfr() { m_srcCfrFolder.mkdirs();//from w ww .j av a 2s . 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:ffx.ui.ModelingPanel.java
private void runScript() { String name = activeCommand;/* w w w. j av a 2s. c om*/ name = name.replace('.', File.separatorChar); ClassLoader loader = getClass().getClassLoader(); URL embeddedScript = loader.getResource("ffx/scripts/" + name + ".ffx"); if (embeddedScript == null) { embeddedScript = loader.getResource("ffx/scripts/" + name + ".groovy"); } File scriptFile = null; if (embeddedScript != null) { try { scriptFile = new File( StringUtils.copyInputStreamToTmpFile(embeddedScript.openStream(), name, ".ffx")); } catch (IOException e) { logger.log(Level.WARNING, "Exception extracting embedded script {0}\n{1}", new Object[] { embeddedScript.toString(), e.toString() }); } } if (scriptFile != null && scriptFile.exists()) { String argLine = statusLabel.getText().replace('\n', ' '); String args[] = argLine.trim().split(" +"); // Remove the command (first token) and system name (last token). args = copyOfRange(args, 1, args.length - 1); List<String> argList = Arrays.asList(args); ffxLauncher = new FFXLauncher(argList, scriptFile); ffxThread = new Thread(ffxLauncher); ffxThread.setName(statusLabel.getText()); ffxThread.setPriority(Thread.MAX_PRIORITY); ffxThread.start(); } else { logger.warning(format("%s was not found.", name)); } }
From source file:beproject.MainGUI.java
/** * This function perform initialization activities * @param evt /*from ww w . ja va 2s . c o m*/ */ private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown formRef = this; Initializer.checkStatus(); List tmp = ScheduledMoviesList.getMovieNames(); for (Object tmp1 : tmp) { movieNamesComboBox.addItem(tmp1); } if (!tmp.isEmpty() && JOptionPane.showConfirmDialog(null, "Resume Twitter Streaming?", "HypeAnalyzer", JOptionPane.YES_NO_OPTION) == 0) { myTwitterObj = new myTwitter(twitterStatusLabel); twitterThread = new Thread(myTwitterObj); twitterThread.setPriority(Thread.MAX_PRIORITY); twitterThread.start(); startStreamingCheckBoxMenuItem.setSelected(true); twitterStatusLabel.setText("STREAMING TWEETS"); } try { URL url = new URL("http://www.google.com"); url.openConnection().connect(); internetConnectionLabel.setText("Internet Status: Available"); } catch (IOException ex) { } try { stmt = inConn.createStatement(); } catch (SQLException e) { ExceptionManager.handleException(e, "Error Connecting to MySql"); } databaseConnectionLabel.setText("Connected to database"); liveTweetAnalysis(); myRegression = new Regression(); updateAllGraphs(); /*new Thread(new Runnable(){ @Override public void run() { try{ int i=0; //PreparedStatement pstmt=Initializer.outConn2.prepareStatement(""); while(true){ ResultSet rs=stmt.executeQuery("select username from tweets where country='' limit "+i+", 30"); if(rs.first()==false) break; else i+=30; while(rs.next()){ String user=rs.getString(1); String country=MyRestAPI.getUserCountry(user); } } }catch(Exception e){ e.printStackTrace(); } } }).start(); */ new Thread(new Runnable() { @Override public void run() { try { createTimeLine(); } catch (SQLException ex) { ex.printStackTrace(); } } }).start(); }
From source file:com.nuvolect.deepdive.probe.DecompileApk.java
/** * Jadx converts a DEX file directly into Java files. It does not input JAR files. *///from ww w . j a v a 2 s .c om 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:com.max2idea.android.limbo.main.LimboActivity.java
private void onStartButton() { if (this.mMachine.getSelectedItemPosition() == 0 || this.currMachine == null) { Toast.makeText(getApplicationContext(), "Select or Create a Virtual Machine first", Toast.LENGTH_LONG) .show();//from w ww .j av a 2 s .co m return; } String filenotexists = validateFiles(); if (filenotexists != null) { Toast.makeText(getApplicationContext(), "Could not find file: " + filenotexists, Toast.LENGTH_LONG) .show(); return; } if (currMachine.snapshot_name != null && !currMachine.snapshot_name.toLowerCase().equals("none") && !currMachine.snapshot_name.toLowerCase().equals("") && currMachine.soundcard != null && !currMachine.soundcard.toLowerCase().equals("none") && mUI.getSelectedItemPosition() != 1) { Toast.makeText(getApplicationContext(), "Snapshot was saved with soundcard enabled please use SDL \"User Interface\"", Toast.LENGTH_LONG).show(); return; } if (currMachine != null && currMachine.cpu != null && currMachine.cpu.endsWith("(arm)") && (currMachine.kernel == null || currMachine.kernel.equals(""))) { sendHandlerMessage(handler, Const.VM_NO_KERNEL); return; } // Initrd is optional // if (currMachine!=null && currMachine.cpu !=null && // currMachine.cpu.startsWith("arm") // && (currMachine.initrd == null || currMachine.initrd.equals(""))) { // sendHandlerMessage(handler, Const.VM_NO_INITRD); // // } if (vmexecutor == null) vmexecutor = new VMExecutor(currMachine); // Global settings vmexecutor.dns_addr = mDNS.getText().toString(); vmexecutor.append = mAppend.getText().toString(); if (this.mMultiAIO.isChecked()) { vmexecutor.aiomaxthreads = Const.MAX_AIO_THREADS; } else { vmexecutor.aiomaxthreads = Const.MIN_AIO_THREADS; } vmexecutor.print(); output = "Starting VM..."; sendHandlerMessage(handler, Const.VM_STARTED); if (mUI.getSelectedItemPosition() == 1) { // SDL Thread tsdl = new Thread(new Runnable() { public void run() { startsdl(); } }); tsdl.start(); } else { // VNC if (!vmStarted) { Thread tvm = new Thread(new Runnable() { public void run() { startvm(Const.UI_VNC); } }); if (mPrio.isChecked()) tvm.setPriority(Thread.MAX_PRIORITY); tvm.start(); } try { Thread.sleep(500); } catch (InterruptedException ex) { Logger.getLogger(LimboActivity.class.getName()).log(Level.SEVERE, null, ex); } Thread tvnc = new Thread(new Runnable() { public void run() { startvnc(); } }); // t.setPriority(Thread.MAX_PRIORITY); tvnc.start(); // MK setting DNS via command line options // Thread tdns = new Thread(new Runnable() { // public void run() { // setDNSaddr(); // } // }); // tdns.start(); } }
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.//from w w w . j a v a 2 s . com */ 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.sentaroh.android.SMBSync2.ActivityMain.java
private void houseKeepLocalFileLastModList() { NotifyEvent ntfy = new NotifyEvent(mContext); ntfy.setListener(new NotifyEventListener() { @Override/* w w w .j a v a 2 s .co m*/ public void positiveResponse(Context c, Object[] o) { mTcHousekeep = new ThreadCtrl(); Thread th2 = new Thread() { @Override public void run() { util.addLogMsg("I", mContext.getString(R.string.msgs_maintenance_last_mod_list_start_msg)); if (!mGp.syncThreadActive) { mGp.syncThreadEnabled = false; mUiHandler.post(new Runnable() { @Override public void run() { housekeepThreadStarted(); } }); ArrayList<FileLastModifiedEntryItem> mCurrLastModifiedList = new ArrayList<FileLastModifiedEntryItem>(); ArrayList<FileLastModifiedEntryItem> mNewLastModifiedList = new ArrayList<FileLastModifiedEntryItem>(); ArrayList<FileLastModifiedEntryItem> del_list = new ArrayList<FileLastModifiedEntryItem>(); LocalFileLastModified.loadLastModifiedList(mCurrLastModifiedList, mNewLastModifiedList); if (mCurrLastModifiedList.size() > 0) { for (FileLastModifiedEntryItem li : mCurrLastModifiedList) { if (!mTcHousekeep.isEnabled()) break; if (li.getFullFilePath().startsWith(mGp.internalRootDirectory)) { File lf = new File(li.getFullFilePath()); if (!lf.exists()) { del_list.add(li); util.addDebugMsg(1, "I", "Entery was deleted, fp=" + li.getFullFilePath()); } } } for (FileLastModifiedEntryItem li : del_list) { if (!mTcHousekeep.isEnabled()) break; mCurrLastModifiedList.remove(li); } } if (mTcHousekeep.isEnabled()) { if (del_list.size() > 0) LocalFileLastModified.saveLastModifiedList(mCurrLastModifiedList, mNewLastModifiedList); } String msg_txt = ""; if (mTcHousekeep.isEnabled()) msg_txt = mContext.getString(R.string.msgs_maintenance_last_mod_list_end_msg); else msg_txt = mContext.getString(R.string.msgs_maintenance_last_mod_list_cancel_msg); util.addLogMsg("I", msg_txt); commonDlg.showCommonDialog(false, "W", msg_txt, "", null); mGp.uiHandler.post(new Runnable() { @Override public void run() { housekeepThreadEnded(); mGp.syncThreadEnabled = true; } }); } else { util.addLogMsg("I", mContext.getString(R.string.msgs_maintenance_last_mod_list_can_not_start_msg)); commonDlg.showCommonDialog(false, "W", mContext.getString(R.string.msgs_maintenance_last_mod_list_can_not_start_msg), "", null); } } }; th2.setPriority(Thread.MAX_PRIORITY); th2.start(); } @Override public void negativeResponse(Context c, Object[] o) { } }); if (!mGp.syncThreadActive) { commonDlg.showCommonDialog(true, "W", mContext.getString(R.string.msgs_maintenance_last_mod_list_confirm_start_msg), "", ntfy); } else { util.addLogMsg("I", mContext.getString(R.string.msgs_maintenance_last_mod_list_can_not_start_msg)); commonDlg.showCommonDialog(false, "W", mContext.getString(R.string.msgs_maintenance_last_mod_list_can_not_start_msg), "", null); } }
From source file:beproject.MainGUI.java
private void startStreamingCheckBoxMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startStreamingCheckBoxMenuItemActionPerformed if (startStreamingCheckBoxMenuItem.isSelected()) { } else {/*w w w . j a v a2 s .co m*/ myTwitterObj = new myTwitter(twitterStatusLabel); twitterThread = new Thread(myTwitterObj); twitterThread.setPriority(Thread.MAX_PRIORITY); twitterThread.start(); startStreamingCheckBoxMenuItem.setSelected(true); twitterStatusLabel.setText("STREAMING TWEETS"); } }
From source file:org.commoncrawl.service.listcrawler.CrawlHistoryManager.java
public Map<Long, CrawlListMetadata> collectListMetadata(Set<Long> predicate) { TreeMap<Long, CrawlListMetadata> metadataOut = new TreeMap<Long, CrawlListMetadata>(); int normalPriority = Thread.currentThread().getPriority(); try {/*from w ww . ja va 2s .c o m*/ LOG.info("### BOOSTING THREAD PRIORITY"); Thread.currentThread().setPriority(Thread.MAX_PRIORITY); LOG.info("### ATTEMPTING LOCK"); synchronized (_crawlLists) { LOG.info("### GOT LOCK"); for (CrawlList list : _crawlLists.values()) { if (predicate.contains(list.getListId())) { metadataOut.put(list.getListId(), list.getMetadata()); } } } LOG.info("### RELEASING LOCK"); } finally { Thread.currentThread().setPriority(normalPriority); } return metadataOut; }