List of usage examples for java.lang Thread MIN_PRIORITY
int MIN_PRIORITY
To view the source code for java.lang Thread MIN_PRIORITY.
Click Source Link
From source file:org.dawnsci.commandserver.ui.view.ConsumerView.java
@Override public void createPartControl(Composite content) { content.setLayout(new GridLayout(1, false)); GridUtils.removeMargins(content);/* w ww. j a v a2 s . co m*/ this.viewer = new TableViewer(content, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); viewer.setUseHashlookup(true); viewer.getTable().setHeaderVisible(true); viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createColumns(); viewer.setContentProvider(createContentProvider()); consumers = new TreeMap<String, ConsumerBean>(Collections.reverseOrder()); viewer.setInput(consumers); createActions(); try { createTopicListener(getUri()); } catch (Exception e) { logger.error("Cannot listen to topic of command server!", e); } final Thread job = new Thread(new Runnable() { @Override public void run() { while (!viewer.getTable().isDisposed()) { try { Thread.sleep(Constants.NOTIFICATION_FREQUENCY); if (viewer.getControl().isDisposed()) return; viewer.getControl().getDisplay().syncExec(new Runnable() { public void run() { viewer.refresh(); } }); } catch (InterruptedException e) { return; } } } }); job.setPriority(Thread.MIN_PRIORITY); job.setDaemon(true); job.setName("Refresh consumer table"); job.start(); }
From source file:com.xabber.android.data.connection.ConnectionThread.java
public ConnectionThread(final ConnectionItem connectionItem) { LogManager.i(this, "NEW connection thread " + connectionItem.getRealJid()); this.connectionItem = connectionItem; executorService = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override/*from w w w .j av a 2 s . com*/ public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable, "Connection thread for " + (connectionItem instanceof AccountItem ? ((AccountItem) connectionItem).getAccount() : connectionItem)); thread.setPriority(Thread.MIN_PRIORITY); thread.setDaemon(true); return thread; } }); ConnectionManager.getInstance().onConnection(this); ConnectionSettings connectionSettings = connectionItem.getConnectionSettings(); protocol = connectionSettings.getProtocol(); serverName = connectionSettings.getServerName(); token = connectionSettings.getPassword(); resource = connectionSettings.getResource(); saslEnabled = connectionSettings.isSaslEnabled(); tlsMode = connectionSettings.getTlsMode(); compression = connectionSettings.useCompression(); if (saslEnabled && protocol == AccountProtocol.gtalk) login = connectionSettings.getUserName() + "@" + connectionSettings.getServerName(); else login = connectionSettings.getUserName(); proxyType = connectionSettings.getProxyType(); proxyHost = connectionSettings.getProxyHost(); proxyPort = connectionSettings.getProxyPort(); proxyUser = connectionSettings.getProxyUser(); proxyPassword = connectionSettings.getProxyPassword(); started = false; }
From source file:org.metis.cassandra.ComponentProfile.java
protected void doStart() throws Exception { runner = new Thread(this, "Cassandra Component Profile: " + toString()); runner.setDaemon(true);/*from www . ja va2s. com*/ runner.setPriority(Thread.MIN_PRIORITY); runner.start(); }
From source file:org.geowebcache.storage.blobstore.file.FileBlobStore.java
private void createDeleteExecutorService() { CustomizableThreadFactory tf;/*from w w w . j a v a 2 s.co m*/ tf = new CustomizableThreadFactory("GWC FileStore delete directory thread-"); tf.setDaemon(true); tf.setThreadPriority(Thread.MIN_PRIORITY); deleteExecutorService = Executors.newFixedThreadPool(1); }
From source file:com.opendoorlogistics.core.gis.map.background.MapsforgeTileFactory.java
MapsforgeTileFactory(TileFactoryInfo info, String xmlRenderThemeFilename, MapDataStore mapDatabase, FadeConfig fadeColour) {//from w ww . j a v a 2 s.com super(info); this.fadeColour = fadeColour; this.mapDatabase = mapDatabase; zoomLevelConverter = new ZoomLevelConverter(info); databaseRenderer = new DatabaseRenderer(mapDatabase, AwtGraphicFactory.INSTANCE, createDummyTileCacheForMapsforgeLabelPlacementAlgorithm()); renderTheme = getRenderTheme(xmlRenderThemeFilename); model = new DisplayModel(); model.setFixedTileSize(TILE_SIZE); model.setBackgroundColor(backgroundMapColour().getRGB()); // use single thread at the moment as DatabaseRenderer is probably single threaded service = Executors.newFixedThreadPool(1, new ThreadFactory() { private int count = 0; @Override public Thread newThread(Runnable r) { Thread t = new Thread(r, "mapsforge-tile-pool-" + count++); t.setPriority(Thread.MIN_PRIORITY); t.setDaemon(true); return t; } }); }
From source file:org.mythdroid.cache.ImageCache.java
private void newDiskCacheThread() { diskCacheThread = new Thread(new Runnable() { @Override//from w w w . j a va2 s . c o m public void run() { Runnable r = null; while (runDiskCacheThread) { synchronized (queue) { while (queue.isEmpty() && runDiskCacheThread) try { queue.wait(); } catch (InterruptedException e) { } try { r = queue.removeFirst(); } catch (NoSuchElementException e) { continue; } } try { r.run(); } catch (RuntimeException e) { LogUtil.debug("Exception in diskCacheThread: " + e.getMessage() //$NON-NLS-1$ ); } r = null; } } }); diskCacheThread.setName("diskCache"); //$NON-NLS-1$ diskCacheThread.setDaemon(true); diskCacheThread.setPriority(Thread.MIN_PRIORITY); diskCacheThread.start(); }
From source file:net.sf.keystore_explorer.gui.dialogs.DCheckUpdate.java
/** * Start key pair generation in a separate thread. *//* w w w .j a va2 s . co m*/ public void startCheck() { checker = new Thread(new CheckForUpdate()); checker.setPriority(Thread.MIN_PRIORITY); checker.start(); }
From source file:org.jboss.dashboard.factory.BasicFactoryElement.java
protected void addPeriodicTask(final Method m, final long sleepInterval) { if (getComponentScope().equals(Component.SCOPE_GLOBAL)) { Runnable periodicRunnable = new Runnable() { public void run() { while (true) { try { // Run here periodic task m.invoke(BasicFactoryElement.this); // Detect if we have to end the thread if (componentKillFlag) return; } catch (Throwable e) { log.error("Error invoking periodic task: ", e); }/* w w w . j a v a2 s . c om*/ try { long totalSlept = 0; while (totalSlept < sleepInterval) { Thread.sleep(1000); totalSlept += 1000; if (componentKillFlag) return; } } catch (InterruptedException e) { log.error("Error: ", e); } } } }; Thread thr = new Thread(periodicRunnable, getComponentName() + " thread"); thr.setPriority(Thread.MIN_PRIORITY); thr.setDaemon(true); thr.start(); } else { log.error("Cannot add periodic task for component " + getComponentName() + ". Scope is " + getComponentScope()); } }
From source file:com.bah.lucene.blockcache_v2.BaseCache.java
public BaseCache(long totalNumberOfBytes, Size fileBufferSize, Size cacheBlockSize, FileNameFilter readFilter, FileNameFilter writeFilter, Quiet quiet, STORE store) { _cacheMap = new ConcurrentLinkedHashMap.Builder<CacheKey, CacheValue>().weigher(new BaseCacheWeigher()) .maximumWeightedCapacity(totalNumberOfBytes).listener(new BaseCacheEvictionListener()).build(); _fileBufferSize = fileBufferSize;/*from w w w. jav a 2 s. c o m*/ _readFilter = readFilter; _writeFilter = writeFilter; _store = store; _cacheBlockSize = cacheBlockSize; _quiet = quiet; _releaseQueue = new LinkedBlockingQueue<ReleaseEntry>(); _oldFileDaemonThread = new Thread(new Runnable() { @Override public void run() { while (_running.get()) { cleanupOldFiles(); try { Thread.sleep(_1_MINUTE); } catch (InterruptedException e) { return; } } } }); _oldFileDaemonThread.setDaemon(true); _oldFileDaemonThread.setName("BaseCacheOldFileCleanup"); _oldFileDaemonThread.setPriority(Thread.MIN_PRIORITY); _oldFileDaemonThread.start(); _oldCacheValueDaemonThread = new Thread(new Runnable() { @Override public void run() { while (_running.get()) { cleanupOldCacheValues(); try { Thread.sleep(_10_SECOND); } catch (InterruptedException e) { return; } } } }); _oldCacheValueDaemonThread.setDaemon(true); _oldCacheValueDaemonThread.setName("BaseCacheCleanupCacheValues"); _oldCacheValueDaemonThread.start(); }
From source file:org.peercast.core.PeerCastService.java
@Override public void onCreate() { super.onCreate(); HandlerThread thread = new HandlerThread("PeerCastService", Thread.MIN_PRIORITY); thread.start();//from w ww . j av a 2 s. c o m serviceLooper = thread.getLooper(); serviceHandler = new ServiceHandler(serviceLooper); serviceMessenger = new Messenger(serviceHandler); }