protected void renameThreads() { for(Iterator<WeakReference<Thread>> it=threads.iterator(); it.hasNext();) { WeakReference<Thread> ref=it.next(); Thread thread=ref.get(); if(thread == null || !thread.isAlive()) { it.remove(); continue; } String name=thread.getName(); name=changeName(name); thread.setName(name); } }
public Thread newThread(Runnable r, String name) { return newThread(null, r, name); }
public void setClusterName(String cluster_name) { boolean changed=false; if(!Util.match(this.clusterName, cluster_name)) changed=true; super.setClusterName(cluster_name); if(changed) renameThreads(); }
/** * Stops the timer, cancelling all tasks */ public void stop() { stopRunner(); // we may need to do multiple iterations as the iterator works on a copy and tasks might have been added just // after the iterator() call returned while(!queue.isEmpty()) for(Task entry: queue) { entry.cancel(true); queue.remove(entry); } queue.clear(); List<Runnable> remaining_tasks=pool.shutdownNow(); for(Runnable task: remaining_tasks) { if(task instanceof Future) { Future future=(Future)task; future.cancel(true); } } pool.getQueue().clear(); try { pool.awaitTermination(Global.THREADPOOL_SHUTDOWN_WAIT_TIME, TimeUnit.MILLISECONDS); } catch(InterruptedException e) { } // clears the threads list (https://issues.jboss.org/browse/JGRP-1971) if(timer_thread_factory instanceof LazyThreadFactory) ((LazyThreadFactory)timer_thread_factory).destroy(); }
timer_thread_factory=new LazyThreadFactory("Timer", true, true); if(isSingleton()) timer_thread_factory.setIncludeClusterName(false);
public void setAddress(String address) { boolean changed=false; if(!Util.match(this.address, address)) changed=true; super.setAddress(address); if(changed) renameThreads(); }
/** * Stops the timer, cancelling all tasks */ public void stop() { stopRunner(); // we may need to do multiple iterations as the iterator works on a copy and tasks might have been added just // after the iterator() call returned while(!queue.isEmpty()) for(Task entry: queue) { entry.cancel(true); queue.remove(entry); } queue.clear(); List<Runnable> remaining_tasks=pool.shutdownNow(); for(Runnable task: remaining_tasks) { if(task instanceof Future) { Future future=(Future)task; future.cancel(true); } } pool.getQueue().clear(); try { pool.awaitTermination(Global.THREADPOOL_SHUTDOWN_WAIT_TIME, TimeUnit.MILLISECONDS); } catch(InterruptedException e) { } // clears the threads list (https://issues.jboss.org/browse/JGRP-1971) if(timer_thread_factory instanceof LazyThreadFactory) ((LazyThreadFactory)timer_thread_factory).destroy(); }
timer_thread_factory=new LazyThreadFactory("Timer", true, true); if(isSingleton()) timer_thread_factory.setIncludeClusterName(false);
public void setClusterName(String cluster_name) { boolean changed=false; if(!Util.match(this.clusterName, cluster_name)) changed=true; super.setClusterName(cluster_name); if(changed) renameThreads(); }
public Thread newThread(Runnable r, String name) { return newThread(null, r, name); }
protected void renameThreads() { for(Iterator<WeakReference<Thread>> it=threads.iterator(); it.hasNext();) { WeakReference<Thread> ref=it.next(); Thread thread=ref.get(); if(thread == null || !thread.isAlive()) { it.remove(); continue; } String name=thread.getName(); name=changeName(name); thread.setName(name); } }
/** * Stops the timer, cancelling all tasks */ public void stop() { stopRunner(); // we may need to do multiple iterations as the iterator works on a copy and tasks might have been added just // after the iterator() call returned while(!queue.isEmpty()) for(Task entry: queue) { entry.cancel(true); queue.remove(entry); } queue.clear(); List<Runnable> remaining_tasks=pool.shutdownNow(); for(Runnable task: remaining_tasks) { if(task instanceof Future) { Future future=(Future)task; future.cancel(true); } } pool.getQueue().clear(); try { pool.awaitTermination(Global.THREADPOOL_SHUTDOWN_WAIT_TIME, TimeUnit.MILLISECONDS); } catch(InterruptedException e) { } // clears the threads list (https://issues.jboss.org/browse/JGRP-1971) if(timer_thread_factory instanceof LazyThreadFactory) ((LazyThreadFactory)timer_thread_factory).destroy(); }
timer_thread_factory=new LazyThreadFactory("Timer", true, true); if(isSingleton()) timer_thread_factory.setIncludeClusterName(false);
public void setAddress(String address) { boolean changed=false; if(!Util.match(this.address, address)) changed=true; super.setAddress(address); if(changed) renameThreads(); }
public Thread newThread(Runnable r, String name) { return newThread(null, r, name); }
protected void renameThreads() { for(Iterator<WeakReference<Thread>> it=threads.iterator(); it.hasNext();) { WeakReference<Thread> ref=it.next(); Thread thread=ref.get(); if(thread == null || !thread.isAlive()) { it.remove(); continue; } String name=thread.getName(); name=changeName(name); thread.setName(name); } }
public void setClusterName(String cluster_name) { boolean changed=false; if(!Util.match(this.clusterName, cluster_name)) changed=true; super.setClusterName(cluster_name); if(changed) renameThreads(); }
public Thread newThread(Runnable r) { return newThread(null, r, baseName); }
public void setAddress(String address) { boolean changed=false; if(!Util.match(this.address, address)) changed=true; super.setAddress(address); if(changed) renameThreads(); }
public Thread newThread(Runnable r) { return newThread(null, r, baseName); }