List of usage examples for java.lang Thread NORM_PRIORITY
int NORM_PRIORITY
To view the source code for java.lang Thread NORM_PRIORITY.
Click Source Link
From source file:org.apache.storm.utils.Utils.java
/** * Convenience method used when only the function and name suffix are given. * @param afn the code to call on each iteration * @param threadName a suffix to be appended to the thread name * @return the newly created thread//w ww.j a va 2 s . c o m * @see Thread */ public static SmartThread asyncLoop(final Callable afn, String threadName, final Thread.UncaughtExceptionHandler eh) { return asyncLoop(afn, false, eh, Thread.NORM_PRIORITY, false, true, threadName); }
From source file:org.apache.storm.utils.Utils.java
/** * Convenience method used when only the function is given. * @param afn the code to call on each iteration * @return the newly created thread// www . ja v a 2s .co m */ public static SmartThread asyncLoop(final Callable afn) { return asyncLoop(afn, false, null, Thread.NORM_PRIORITY, false, true, null); }
From source file:com.jgkj.bxxc.fragment.IndexFragment.java
private void initImageLoader() { //?,?UIL,???//from www . j a v a 2 s. com DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.mipmap.ic_launcher).cacheInMemory(true).cacheOnDisk(true).build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity()) .defaultDisplayImageOptions(defaultOptions).threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory().diskCacheFileNameGenerator(new Md5FileNameGenerator()) .tasksProcessingOrder(QueueProcessingType.LIFO).build(); ImageLoader.getInstance().init(config); cb_convenientBanner.setPages(new CBViewHolderCreator<NetworkImageHolderView>() { @Override public NetworkImageHolderView createHolder() { return new NetworkImageHolderView(); } }, bannerEntitylist) .setPageIndicator(new int[] { R.drawable.ic_page_indicator, R.drawable.ic_page_indicator_focused }) //??????? .startTurning(2000); }
From source file:org.zilverline.core.AbstractCollection.java
/** * Index the given Collection in a background thread. Stops the indexing if * already running.//from ww w . ja v a2 s .co m * * @param fullIndex * indicated whether a full or incremental index should be * created * @throws IndexException * if the Collections can not be indexed */ public final void indexInThread(final boolean fullIndex) throws IndexException { if (isIndexingInProgress()) { log.warn("Collection " + name + " is already being indexed, now stopping"); stopRequest(); return; } stopRequested = false; Runnable r = new Runnable() { public void run() { try { index(fullIndex); } catch (Exception x) { // in case ANY exception slips through log.error("Can't succesfully finish background indexing process", x); } } }; if (fullIndex) { // update the info now so it is shown in user interface numberOfDocs = 0; lastIndexed = new Date(); } indexingThread = new Thread(r); indexingThread.setName(name + "IndexingThread"); if (manager.getPriority() != null) { indexingThread.setPriority(manager.getPriority().intValue()); } else { indexingThread.setPriority(Thread.NORM_PRIORITY); } indexingThread.start(); }
From source file:org.apache.cocoon.thread.impl.DefaultRunnableManager.java
/** * DOCUMENT ME!//www .ja v a2 s . co m * * @param priority * The priority to set as string value. * * @return The priority as int value. */ private int convertPriority(final String priority) { if ("MIN".equalsIgnoreCase(priority)) { return Thread.MIN_PRIORITY; } else if ("NORM".equalsIgnoreCase(priority)) { return Thread.NORM_PRIORITY; } else if ("MAX".equalsIgnoreCase(priority)) { return Thread.MAX_PRIORITY; } else { getLogger().warn("Unknown thread priority \"" + priority + "\". Set to \"NORM\"."); return Thread.NORM_PRIORITY; } }
From source file:net.dv8tion.jda.audio.AudioWebSocket.java
private void setupUdpKeepAliveThread() { udpKeepAliveThread = new Thread("AudioWebSocket UDP-KeepAlive Guild: " + guild.getId()) { @Override/*from w ww.ja va 2s . co m*/ public void run() { while (socket.isOpen() && !udpSocket.isClosed() && !this.isInterrupted()) { long seq = 0; try { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES + 1); buffer.put((byte) 0xC9); buffer.putLong(seq); DatagramPacket keepAlivePacket = new DatagramPacket(buffer.array(), buffer.array().length, address); udpSocket.send(keepAlivePacket); Thread.sleep(5000); //Wait 5 seconds to send next keepAlivePacket. } catch (NoRouteToHostException e) { LOG.warn("Closing AudioConnection due to inability to ping audio packets."); LOG.warn("Cannot send audio packet because JDA navigate the route to Discord.\n" + "Are you sure you have internet connection? It is likely that you've lost connection."); AudioWebSocket.this.close(true, -1); break; } catch (IOException e) { LOG.log(e); } catch (InterruptedException e) { //We were asked to close. // e.printStackTrace(); } } } }; udpKeepAliveThread.setPriority(Thread.NORM_PRIORITY + 1); udpKeepAliveThread.setDaemon(true); udpKeepAliveThread.start(); }
From source file:com.nmote.smpp.Session.java
public synchronized void open() throws LinkCreationException { if (getState() == CLOSED) { // Create a link if not already created if (link == null) { if (linkFactory == null) { throw new LinkCreationException("LinkFactory not set"); }/*from w w w . jav a2 s .c o m*/ link = linkFactory.createLink(); } setState(OPEN); // Start sender thread ioThreadsExecutor.exec(new Sender(), Thread.NORM_PRIORITY); // Start receiver thread ioThreadsExecutor.exec(new Receiver(), Thread.NORM_PRIORITY); log.debug("SMPP link opened"); // Start auto enquire link if (this.autoEnquireLink > 0) { long freq = autoEnquireLink; autoEnquireLinkTask = new AutoEnquireLinkTask(); smppTimer.schedule(autoEnquireLinkTask, freq, freq); } } else { log.debug("Session already open"); } }
From source file:org.apache.cocoon.thread.impl.DefaultThreadPool.java
/** * DOCUMENT ME!/*w ww . j ava 2 s .c o m*/ * * @param priority * The priority to set as string value. * * @return The priority as int value. */ private int convertPriority(final String priority) { if ("MIN".equalsIgnoreCase(priority)) { return Thread.MIN_PRIORITY; } else if ("NORM".equalsIgnoreCase(priority)) { return Thread.NORM_PRIORITY; } else if ("MAX".equalsIgnoreCase(priority)) { return Thread.MAX_PRIORITY; } else { logger.warn("Unknown thread priority \"" + priority + "\". Set to \"NORM\"."); return Thread.NORM_PRIORITY; } }
From source file:com.adaptris.core.PoolingWorkflow.java
public int threadPriority() { int priority = NumberUtils.toIntDefaultIfNull(getThreadPriority(), Thread.NORM_PRIORITY); if (!PRIORITY_RANGE.contains(priority)) { LoggingHelper.logWarning(priorityWarningLogged, () -> { priorityWarningLogged = true; }, "thread-priority [{}] isn't in range {}, reset to default", priority, PRIORITY_RANGE.toString()); priority = Thread.NORM_PRIORITY; }/* w ww .jav a 2 s . c o m*/ return priority; }