<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
    <channel>
        <title>JavaRanch Threads and Synchronization</title>
        <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=forum&amp;f=27</link>
        <description>A Friendly Place for Java Greenhorns</description>
        <image>
            <url>http://saloon.javaranch.com/ubb/moosefly.gif</url>
            <title>JavaRanch Big Moose Saloon</title>
            <link>http://saloon.javaranch.com/</link>
        </image>
        <language>en-us</language>
        <generator>JavaRanch RSS</generator>
        <copyright>Copyright 2007 Paul Wheaton. All Rights Reserved.</copyright>
        <item uniqueID="27-002926">
            <title>Threads/Looping: How Can This Be?</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002926</link>
            <description>I'm working my way through Head First Java (2nd ed.), and got a strange result when executing the following (Ch. 15 "Code Magnets" exercise):&lt;br /&gt; &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt;public class TestThreads {&lt;br /&gt; &lt;br /&gt; public static void main(String[] args) {&lt;br /&gt; &lt;br /&gt; ThreadOne t1 = new ThreadOne();&lt;br /&gt; Thread one = new Thread(t1);&lt;br /&gt; ThreadTwo t2 = new ThreadTwo();&lt;br /&gt; Thread two = new Thread(t2);&lt;br /&gt; &lt;br /&gt; one.start();&lt;br /&gt; &lt;br /&gt; two.start();&lt;br /&gt; &lt;br /&gt; } // close main&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;} // close class TestThreads&lt;br /&gt; &lt;br /&gt; class Accum {&lt;br /&gt; private int counter = 0; &lt;br /&gt; &lt;br /&gt; private Accum() { }&lt;br /&gt; &lt;br /&gt; private static Accum a = new Accum();&lt;br /&gt;...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002926</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002926Jim Shaw</comments>
            <author/>
            <pubDate>Tue, 13 May 2008 09:07:11 MDT</pubDate>
        </item>
        <item uniqueID="27-002925">
            <title>'thread-safe' and 'synchronized' </title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002925</link>
            <description>what is threadSafe and what is synchonised ?&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; </description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002925</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002925kenji kunoichi</comments>
            <author/>
            <pubDate>Tue, 13 May 2008 08:59:11 MDT</pubDate>
        </item>
        <item uniqueID="27-002924">
            <title>thread invoke later</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002924</link>
            <description>I have create one new thread in invoke later mode but it is not calling&lt;br /&gt; &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt; &lt;br /&gt; &lt;br /&gt;public void showManageApp(final String path,final String temp){&lt;br /&gt; &lt;br /&gt; NativeInterfaceHandler.init();&lt;br /&gt; Toolkit.getDefaultToolkit().setDynamicLayout(true);&lt;br /&gt; Runnable xxx = new Runnable() {&lt;br /&gt; &lt;br /&gt; public void run() {&lt;br /&gt; ManageDocuments md = new ManageDocuments(path);&lt;br /&gt; md.webBrowser.setVisible(false);&lt;br /&gt; md.page.setVisible(true);&lt;br /&gt; md.sendPostRequest();&lt;br /&gt;// cookie = UserStateManager.getInstance().getAuthKey();&lt;br /&gt; HTMLPath ...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002924</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002924ramesh kancherla</comments>
            <author/>
            <pubDate>Mon, 12 May 2008 23:43:10 MDT</pubDate>
        </item>
        <item uniqueID="27-002923">
            <title>Should a thread always sleep?</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002923</link>
            <description>I'm just wondering, is it necessary for a thread to sleep, lets say after every iteration of an operation or calculation it is doing?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002923</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002923indigo0086</comments>
            <author/>
            <pubDate>Mon, 12 May 2008 06:23:07 MDT</pubDate>
        </item>
        <item uniqueID="27-002922">
            <title>Thread concepts</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002922</link>
            <description>hi all,&lt;br /&gt; what is the diffenerce between Runnable interface and Thread class?&lt;br /&gt;where do we use them?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002922</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002922GopiNath R</comments>
            <author/>
            <pubDate>Sat, 10 May 2008 04:43:01 MDT</pubDate>
        </item>
        <item uniqueID="27-002921">
            <title>Question about Design</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002921</link>
            <description>Hello,&lt;br /&gt; &lt;br /&gt;I am wondering which design would be better than the second for a business appliation managing user sessions (active/inactive etc):&lt;br /&gt; &lt;br /&gt;1- Leave incoming threads to interact with sessions/database&lt;br /&gt;2- Have internal threads managing incoming threads and serve their requests? How would I do that?&lt;br /&gt;3- Any other idea is welcome.&lt;br /&gt; &lt;br /&gt;Thanks!</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002921</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002921Amer Seifeddine</comments>
            <author/>
            <pubDate>Fri, 9 May 2008 16:02:59 MDT</pubDate>
        </item>
        <item uniqueID="27-002920">
            <title>Threads...</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002920</link>
            <description>hi can any one answer to this...&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;How can two threads access a synchronized block simultaneuously i.e. one thread should give the chance for other thread to execute synchronized block even before this thread finishes the execution of the same synchronized block?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002920</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002920sumi mathew</comments>
            <author/>
            <pubDate>Fri, 9 May 2008 07:08:58 MDT</pubDate>
        </item>
        <item uniqueID="27-002919">
            <title>Doubt in synchronized....</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002919</link>
            <description>Hi,&lt;br /&gt; What is synchronized block? How it will work?Give me simple ex.&lt;br /&gt;Why synchronized is not working in this below pgm.&lt;br /&gt; &lt;br /&gt;public class test18 extends Thread&lt;br /&gt; {&lt;br /&gt; &lt;br /&gt;String setString="";&lt;br /&gt;test18(String set)&lt;br /&gt;{&lt;br /&gt;setString=set;&lt;br /&gt;start();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;public void run()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;try{&lt;br /&gt; callLogic();&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;}catch(InterruptedException op)&lt;br /&gt;{&lt;br /&gt;System.out.println("Exception : "+op);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;private synchronized void callLogic() throws InterruptedException&lt;br /&gt;{&lt;br /&gt;for(int i=0;i&amp;lt;100;i++)&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt; System.out.print(setString);&lt;br /&gt;Thread.sleep(100);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;public static v...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002919</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002919sridhar Ranganathan</comments>
            <author/>
            <pubDate>Fri, 9 May 2008 03:12:58 MDT</pubDate>
        </item>
        <item uniqueID="27-002918">
            <title>query on sleep() method</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002918</link>
            <description>When we call sleep(), it causes the running thread to transit to a ready to run state. Does the sleep() call will also relinquish the lock on the object if it is invoked from a synchronized method?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002918</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002918Sandeep Mukherji</comments>
            <author/>
            <pubDate>Fri, 9 May 2008 02:48:58 MDT</pubDate>
        </item>
        <item uniqueID="27-002917">
            <title>Wait , notify() ...explain this output </title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002917</link>
            <description>Hello everybody,&lt;br /&gt;I understood the concept of notify() and wait(), but confused with the output ... why the statement "Entry of gettttttttttt:1" get printed...&lt;br /&gt; &lt;br /&gt;&lt;b&gt;I have bolded the line in the output statement where there is a confusion&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;b&gt;code&lt;/b&gt;&lt;br /&gt;class Q&lt;br /&gt;{&lt;br /&gt; int n;&lt;br /&gt; boolean valueSet=false;&lt;br /&gt; &lt;br /&gt;synchronized void put(int i)&lt;br /&gt;{&lt;br /&gt; if(valueSet)&lt;br /&gt; {&lt;br /&gt; &lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt; System.out.println(" Entry of Put :"+i); &lt;br /&gt; wait();&lt;br /&gt; System.out.println("\n Exit of put ");&lt;br /&gt; }&lt;br /&gt; catch(InterruptedException ieo)&lt;br /&gt; {&lt;br /&gt; System.out.println("\n Interrupt Caught ");&lt;br /&gt; }&lt;br /&gt; }&lt;br /&gt; &lt;...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002917</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002917Shivit Agarwal</comments>
            <author/>
            <pubDate>Wed, 7 May 2008 09:34:52 MDT</pubDate>
        </item>
        <item uniqueID="27-002916">
            <title>Objects and Threads</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002916</link>
            <description>Acquiring the lock associated with an object does not of itself prevent other threads from accessing fields of the object or invoking unsynchronized methods on the object. Other threads can also use synchronized methods or the synchronized statement in a conventional manner to achieve mutual exclusion.&lt;br /&gt;&amp;lt;a href=http:"//java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#5984"&amp;gt;&lt;br /&gt;My views:&lt;br /&gt;if ThreadA acquire a lock on Object A during invoking a synchronized method then another ThreadB can access or reference to Object A can invoke simultaneously Unsynchronized method on ObjectA.&lt;br /&gt;Can any body elaborate more....</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002916</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002916Surender Singh</comments>
            <author/>
            <pubDate>Mon, 5 May 2008 22:44:48 MDT</pubDate>
        </item>
        <item uniqueID="27-002915">
            <title>Class is Thread-Safe or not?</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002915</link>
            <description>Hi All&lt;br /&gt;Please let me know below my class code is thread-safe or not? if not,then let me know how to make it thread-safe?.&lt;br /&gt; &lt;br /&gt;class Thread_safe {&lt;br /&gt;private String name;&lt;br /&gt;public synchronized void test(){&lt;br /&gt;name="Test";&lt;br /&gt;}&lt;br /&gt;public void impl(){&lt;br /&gt;name="Impl";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Thanks &lt;br /&gt;Regards&lt;br /&gt;Surender Singh</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002915</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002915Surender Singh</comments>
            <author/>
            <pubDate>Mon, 5 May 2008 22:02:48 MDT</pubDate>
        </item>
        <item uniqueID="27-002914">
            <title>What is wrong with this code?</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002914</link>
            <description>Hello,&lt;br /&gt; &lt;br /&gt;I am thinking of writing a code which synchronize put and leaves get non synchronized except when put executes:&lt;br /&gt; &lt;br /&gt;boolean put=false;&lt;br /&gt;hashmap nonSynchronizedMap=new HashMap();&lt;br /&gt; &lt;br /&gt;public void put(Ojbect Key,Object value)&lt;br /&gt;{&lt;br /&gt; synchronized(Lock)&lt;br /&gt; {&lt;br /&gt; put=true;&lt;br /&gt; nonSynchronizedMap.put(Key,Value)&lt;br /&gt; }&lt;br /&gt; put=false;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;public Object get(Object key)&lt;br /&gt;{&lt;br /&gt; if(put)&lt;br /&gt; {&lt;br /&gt; synchronized(Lock)&lt;br /&gt; {&lt;br /&gt; return nonSynchronizedMap.get(Lock);&lt;br /&gt; }&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; return nonSynchronizedMap.get(Lock);&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;Thanks!</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002914</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002914amer seif el dine</comments>
            <author/>
            <pubDate>Sat, 3 May 2008 23:36:33 MDT</pubDate>
        </item>
        <item uniqueID="27-002913">
            <title>Marking a variable static final is thread safe</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002913</link>
            <description>Folks,&lt;br /&gt; &lt;br /&gt;I have a bit confusion that if i mark a variable "static final ", is it threadsafe?&lt;br /&gt; &lt;br /&gt;like: public satic final MyObject myObj;&lt;br /&gt; &lt;br /&gt;_____________________________&lt;br /&gt;Mintoo&lt;br /&gt;SCJP 1.4&lt;br /&gt;_____________________________</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002913</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002913mintoo kumar</comments>
            <author/>
            <pubDate>Sat, 3 May 2008 14:08:32 MDT</pubDate>
        </item>
        <item uniqueID="27-002912">
            <title>stopping a runnable in ThreadPoolExecutor</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002912</link>
            <description>hello,&lt;br /&gt; &lt;br /&gt;let us say i have a runnable to execute and i want the ability to stop in the middle.&lt;br /&gt; &lt;br /&gt;i execute the runnable using&lt;br /&gt; &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt;&lt;br /&gt;this.threadPool = new ThreadPoolExecutor(1, 1, 10, TimeUnit.SECONDS, new ArrayBlockingQueue&amp;lt;Runnable&amp;gt;(1) );&lt;br /&gt;this.threadPool.execute(searchRunnable);&lt;br /&gt;[code]&lt;br /&gt; &lt;br /&gt;inside the search runnable, there is code to wait() and look for any interrupts implementing like below..&lt;br /&gt;private void doSearch() throws InterruptedException{&lt;br /&gt; ...&lt;br /&gt; ...&lt;br /&gt; &lt;br /&gt; // sleep &lt;br /&gt; Thread.sleep(100);&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;I am not sure how to stop this Runnable. remove() on the thread pool using a Runnable only removes it from the q...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002912</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002912Raghavan Chockalingam</comments>
            <author/>
            <pubDate>Fri, 2 May 2008 06:32:28 MDT</pubDate>
        </item>
        <item uniqueID="27-002911">
            <title>Shared cache</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002911</link>
            <description>Hi Folks,&lt;br /&gt; &lt;br /&gt;I am wondering what would be the best practice for below scenario in java:&lt;br /&gt;we have a shared object for accessing cache but rarely updated based on users action.. I know that usually, we have to synchronize both, get and set, methods.. However, this way we oblige other threads to wait to get the cache at the same time .. In other words, I m looking for a way to share get method with all threads and block it when we modify it.. then, notify all threads to continue once set method is completed.&lt;br /&gt; &lt;br /&gt;Thanks!</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002911</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002911amer seif el dine</comments>
            <author/>
            <pubDate>Thu, 1 May 2008 09:44:25 MDT</pubDate>
        </item>
        <item uniqueID="27-002910">
            <title>Confused in Thread join() code</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002910</link>
            <description>Hi all,&lt;br /&gt; &lt;br /&gt;I have copied a code from Khalid A. Mughal on join(), and a bit confused about how the output came. the code is as followed&lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt; &lt;br /&gt;/**&lt;br /&gt; * &lt;br /&gt; */&lt;br /&gt;package threads;&lt;br /&gt; &lt;br /&gt;/**&lt;br /&gt; * @author Sandeep Mukherji&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;public class Joining {&lt;br /&gt;static Thread createThread(final int i, final Thread t1){ // function&lt;br /&gt;Thread t2 = new Thread(){ // thread created in the function as a nested class&lt;br /&gt;public void run(){&lt;br /&gt;System.out.println(i+1);&lt;br /&gt;try{&lt;br /&gt;System.out.println(Thread.currentThread().getName()+" will join after the completion of other threads");&lt;br /&gt;t1.join();&lt;br /&gt;}catch(InterruptedException e){&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;System.out.println(i+2);...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002910</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002910Sandeep Mukherji</comments>
            <author/>
            <pubDate>Thu, 1 May 2008 08:32:25 MDT</pubDate>
        </item>
        <item uniqueID="27-002909">
            <title>Thread Pool in Java</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002909</link>
            <description>Hello,&lt;br /&gt; &lt;br /&gt;I want to write Thread Poolusing Java for some repititve task which is controlled through Job Scheduler.Job Scheduler will run after interval of 2 minutes.Can you please provide me few guidelines regarding how to write thread pool in Java.&lt;br /&gt; &lt;br /&gt;My application will be deployed on Application Server and I am using JDK 1.4. I know there is a java.util.concurrent.Executors class which can be used for this. However, It's available in JDK 1.5 &amp; not in 1.4&lt;br /&gt; &lt;br /&gt;Thanks,&lt;br /&gt;Shriniwas</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002909</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002909Shrinivas Mujumdar</comments>
            <author/>
            <pubDate>Thu, 1 May 2008 04:52:24 MDT</pubDate>
        </item>
        <item uniqueID="27-002908">
            <title>Diffrence between calling the run() method.</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002908</link>
            <description>Hi &lt;br /&gt; &lt;br /&gt;If you extend any thread class , we should override the run method.&lt;br /&gt; &lt;br /&gt;We can call that run method by using obj.start() or obj.run().&lt;br /&gt; &lt;br /&gt;Just i want to know difference between them .&lt;br /&gt; &lt;br /&gt;Is that start() method will create new Thread () ?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002908</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002908pdommara Kumar</comments>
            <author/>
            <pubDate>Wed, 30 Apr 2008 09:00:22 MDT</pubDate>
        </item>
        <item uniqueID="27-002907">
            <title>apache commons jci package</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002907</link>
            <description>I am trying to test run an example given here:&lt;br /&gt;on apache site (http://commons.apache.org/jci/usage.html)&lt;br /&gt; &lt;br /&gt;In particular, I am trying to run the example link at the bottom on the above link..&lt;br /&gt;test example (http://commons.apache.org/jci/usage.html)&lt;br /&gt; &lt;br /&gt;I downloaded the commons package etc etc, compile goes fine, runs fine too, however, nothing happens when I change the test file (added new properties, deleted properties etc).. I don't even see the 'configuration changed' message. However the thread polling seems to work fine, but looks like control never goes to the hasChanged() conditional check.&lt;br /&gt; &lt;br /&gt;Can someone please help me in understanding this behaviour? It is driving me nuts.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002907</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002907Brian Percival</comments>
            <author/>
            <pubDate>Tue, 29 Apr 2008 10:30:19 MDT</pubDate>
        </item>
        <item uniqueID="27-002906">
            <title>Threads' dependency on another thread</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002906</link>
            <description>Hi There,&lt;br /&gt; &lt;br /&gt;Can we make a thread dependent on other thread? &lt;br /&gt;I mean to say, a thread can only perform a particular task, once another thread completes its task. &lt;br /&gt;Is this kind of activity possible with thread management?&lt;br /&gt; &lt;br /&gt;Thanks in advance,&lt;br /&gt;Abra D.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002906</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002906Abrahim Daver</comments>
            <author/>
            <pubDate>Tue, 29 Apr 2008 10:10:19 MDT</pubDate>
        </item>
        <item uniqueID="27-002905">
            <title>Multi-Threading</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002905</link>
            <description>Hi All,&lt;br /&gt;I have change the single thread oriented code into Multi-threaded code, but i m stucked due to some issues.I m describing briefly the flow of the code. &lt;br /&gt;Execution Start from - Main method i m reading msg and passed it to method ReceiveMsg() method and that method spawns 5 the threads of piece of code that process the msg.If the thread count is equal to 5 then the another&lt;br /&gt;will not generated.&lt;br /&gt;Problems:-&lt;br /&gt;1)since i m generating five thread if any thread hang then how would i kill it.&lt;br /&gt;2)My older code contain org.apache.common.collections.LRUMap that isnt synchronized.To get its synchronized version -the way is Collection.synchronizedMap(themaptosynchronize), but when use it i.e.(Collection.synchronizedMap(ne...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002905</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002905JavaHunter_AjayPT</comments>
            <author/>
            <pubDate>Tue, 29 Apr 2008 06:48:18 MDT</pubDate>
        </item>
        <item uniqueID="27-002904">
            <title>doubt on multithreading</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002904</link>
            <description>what is the meaning of thread sharing the same address space?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002904</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002904manas ranjan mandal</comments>
            <author/>
            <pubDate>Sat, 26 Apr 2008 07:50:08 MDT</pubDate>
        </item>
        <item uniqueID="27-002903">
            <title>How to Stop a thread </title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002903</link>
            <description>Hello,&lt;br /&gt; &lt;br /&gt;I am using Executors.newFixedThreadPool(5) to create Thread pool. and then use ExecutorService.submit(Callable&amp;lt;&amp;gt to start a thread out of that. &lt;br /&gt;Now my question is - once one thread has completed its task, how can we kill that thread in this scenario.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Abra D.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002903</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002903Abrahim Daver</comments>
            <author/>
            <pubDate>Fri, 25 Apr 2008 10:12:06 MDT</pubDate>
        </item>
        <item uniqueID="27-002902">
            <title>Performance not improving after using Multithreading</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002902</link>
            <description>Hi,&lt;br /&gt;I have an application where i transfer documents from an ECM to another ECM(sort-of!). &lt;br /&gt;For transferring 500 files, without multithreading the time taken is about 20 minutes.&lt;br /&gt;After implementing multithreading (and limiting the max number of concurrent threads to 5 --a system requirement), theoretically the time taken should be around 4 minutes ( 20 divided by 5). But the time taken is still hanging at around 18 minutes. &lt;br /&gt;I am not using any synchronised method or object.&lt;br /&gt; &lt;br /&gt;Any suggestions?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002902</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002902Meenal Srivastva</comments>
            <author/>
            <pubDate>Fri, 25 Apr 2008 01:00:05 MDT</pubDate>
        </item>
        <item uniqueID="27-002901">
            <title>Volatile Modifiers</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002901</link>
            <description>I read a document which say Volatile Modifiers, are not cached by the JVM. When ever a volatile variable value is required by a thread it will access directly from the variable itself (without using the JVM cache)..&lt;br /&gt; &lt;br /&gt; &lt;blockquote&gt;quote:&lt;hr&gt; Volatile: Volatile modifier tells the compiler that the variable modified by&lt;br /&gt;volatile can be changed unexpectedly by other parts of the program. For&lt;br /&gt;example a Variable might be read from Cache and not update the content if it&lt;br /&gt;has been changed by another thread. Specifying a variable as volatile tells&lt;br /&gt;the JVM that any threads using that variable are not allowed to cache that&lt;br /&gt;value at all. Making the Variable Volatile will ensure that the compiler&lt;br /&gt;will get the cont...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002901</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002901Mohammed Yousuff</comments>
            <author/>
            <pubDate>Thu, 24 Apr 2008 04:42:03 MDT</pubDate>
        </item>
        <item uniqueID="27-002900">
            <title>ThreadCount for best Throughput??</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002900</link>
            <description>Hi,&lt;br /&gt; &lt;br /&gt; Suppose i have a Solaris box with 2 CPU's and i use Threads (Java threads or Websphere AsyncBeans) to do some work in parallel. Is there any means to arrive at the ThreadCount that would give me the best throughput.&lt;br /&gt;Other than the Number of CPU's and the OS versions, is there any other variable which would contribute to deciding this. I know that there is no one single magic number to decide the ThreadCount to use, but if there is some guideline then it would be helpful</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002900</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002900Joe Joseph</comments>
            <author/>
            <pubDate>Wed, 23 Apr 2008 08:31:59 MDT</pubDate>
        </item>
        <item uniqueID="27-002899">
            <title>Thread Behaviour</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002899</link>
            <description>Hi ,&lt;br /&gt; &lt;br /&gt;I have checked the below code I got answer as "vandeleur".&lt;br /&gt;but here in the mock test it is given as choice 4.&lt;br /&gt;Can anyboby tell me which is correct answer..as i hav checked other papers they gav different answer..&lt;br /&gt; &lt;br /&gt;What will happen when you attempt to compile and run the following code?&lt;br /&gt; &lt;br /&gt;public class Tux extends Thread{ &lt;br /&gt;static String sName = "vandeleur"; &lt;br /&gt; public static void main(String argv[]){ &lt;br /&gt; Tux t = new Tux(); &lt;br /&gt; t.piggy(sName); &lt;br /&gt; System.out.println(sName); &lt;br /&gt; } &lt;br /&gt; public void piggy(String sName){ &lt;br /&gt; sName = sName + " wiggy"; &lt;br /&gt; start(); &lt;br /&gt; } &lt;br /&gt; &lt;br /&gt; publi...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002899</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002899Chandu Sree</comments>
            <author/>
            <pubDate>Tue, 22 Apr 2008 04:36:23 MDT</pubDate>
        </item>
        <item uniqueID="27-002898">
            <title>Class.forName Thread Safe ?</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002898</link>
            <description>I have the following code, it does a Class.forName based on the content-type of a particular attachment. So far so good.... I have few questions, Please answer at your convenience .&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt;&lt;br /&gt; String nameOfClass = MIMETYPEMAP.get(mimetype);&lt;br /&gt; if (nameOfClass == null) {&lt;br /&gt; if(mimetype.equals("APPLICATION/OCTET-STREAM")&lt;br /&gt; &amp;&amp; (fileName != null)) {&lt;br /&gt; String filextension = getFileExtension(fileName);&lt;br /&gt; if (filextension != null) {&lt;br /&gt; nameOfClass = FILEEXTENSIONMAP.get(filextension);&lt;br /&gt; } else {&lt;br /&gt; nameOfClass&lt;br /&gt; = MIME...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002898</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002898Steven Rodeo</comments>
            <author/>
            <pubDate>Mon, 21 Apr 2008 22:52:22 MDT</pubDate>
        </item>
        <item uniqueID="27-002897">
            <title>gremlin thread</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002897</link>
            <description>basically i got a maze with a player and a gremlin. the gremlin moves very fast through the cells hence i put it to sleep for a second at each cell. but i get the problem that when my player walks past it when it is asleep, then the player does not die. but when he goes pat it when its awake it dies. i want it to go slowly through the maze hence stay asleep but yet still kill my player. i tried doing this by returning where the gremlin is and matchin it with the player but this also works only when the gremlin is not sleep. please help . its my first year in java. thanks&lt;br /&gt; &lt;br /&gt; public void run() &lt;br /&gt; {&lt;br /&gt; while (true) {&lt;br /&gt; getMaze().moveGremlins();&lt;br /&gt; GremlinsEffect();&lt;br /&gt; // game.v...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002897</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002897guv dave</comments>
            <author/>
            <pubDate>Sat, 19 Apr 2008 19:10:25 MDT</pubDate>
        </item>
        <item uniqueID="27-002896">
            <title>Explain me this output (notify)</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002896</link>
            <description>Hello, &lt;br /&gt;I didn't get the output ...Can anybody explain me ??&lt;br /&gt;I have &lt;b&gt;bolden&lt;/b&gt; the problem in output.&lt;br /&gt; &lt;br /&gt;The code is from THE COMPLETE REFERENCE - HERBERT SCHILDT&lt;br /&gt; &lt;br /&gt;&lt;b&gt;&lt;br /&gt;My second question is what happens when a notify() is encountered before a wait() statement as in the program below ??&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt;class Q&lt;br /&gt;{&lt;br /&gt; int n;&lt;br /&gt; boolean valueSet=false;&lt;br /&gt; &lt;br /&gt;synchronized void put(int i)&lt;br /&gt;{&lt;br /&gt; if(valueSet)&lt;br /&gt; {&lt;br /&gt; &lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt; System.out.println(" Entry of Put :"+i); &lt;br /&gt; &lt;br /&gt; wait();&lt;br /&gt; }&lt;br /&gt; catch(InterruptedException ieo)&lt;br /&gt; {&lt;br /&gt; System.out.println("\n Interrupt Caught ");&lt;br /&gt;...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002896</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002896Shivit Agarwal</comments>
            <author/>
            <pubDate>Sat, 19 Apr 2008 14:42:25 MDT</pubDate>
        </item>
        <item uniqueID="27-002894">
            <title>Doubt in synchronization of block </title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894</link>
            <description>Hi&lt;br /&gt;Lets take a code:&lt;br /&gt; &lt;br /&gt;public abc()&lt;br /&gt;{&lt;br /&gt;List str=new List();&lt;br /&gt;syncronized(str)&lt;br /&gt;{&lt;br /&gt;stmt 1..............&lt;br /&gt;stmt 2..........&lt;br /&gt;more code here....&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;My question is that..what is synchronized in above code&lt;br /&gt;1)The List &lt;br /&gt;2)Block of code in syncronized(str)()&lt;br /&gt; &lt;br /&gt;Please give me more detail</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894mohsin sheikh</comments>
            <author/>
            <pubDate>Thu, 17 Apr 2008 02:41:27 MDT</pubDate>
        </item>
        <item uniqueID="27-002894">
            <title>Doubt in synchronization of block </title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894</link>
            <description>Hi&lt;br /&gt;Lets take a code:&lt;br /&gt; &lt;br /&gt;public abc()&lt;br /&gt;{&lt;br /&gt;List str=new List();&lt;br /&gt;syncronized(str)&lt;br /&gt;{&lt;br /&gt;stmt 1..............&lt;br /&gt;stmt 2..........&lt;br /&gt;more code here....&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;My question is that..what is synchronized in above code&lt;br /&gt;1)The List &lt;br /&gt;2)Block of code in syncronized(str)()&lt;br /&gt; &lt;br /&gt;Please give me more detail</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894mohsin sheikh</comments>
            <author/>
            <pubDate>Thu, 17 Apr 2008 02:39:30 MDT</pubDate>
        </item>
        <item uniqueID="27-002894">
            <title>Doubt in synchronization of block </title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894</link>
            <description>Hi&lt;br /&gt;Lets take a code:&lt;br /&gt; &lt;br /&gt;public abc()&lt;br /&gt;{&lt;br /&gt;List str=new List();&lt;br /&gt;syncronized(str)&lt;br /&gt;{&lt;br /&gt;stmt 1..............&lt;br /&gt;stmt 2..........&lt;br /&gt;more code here....&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;My question is that..what is synchronized in above code&lt;br /&gt;1)The List &lt;br /&gt;2)Block of code in syncronized(str)()&lt;br /&gt; &lt;br /&gt;Please give me more detail</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002894mohsin sheikh</comments>
            <author/>
            <pubDate>Thu, 17 Apr 2008 01:07:03 MDT</pubDate>
        </item>
        <item uniqueID="27-002887">
            <title>Java threads</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</link>
            <description>I have a main program which talks to a network device. I want to initiate a thread from the main program which checks if the main program has completed execution. If yes, i want to kill this thread else i want to throw an exception and stop termination of the main program. How can it be done?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887Shubha P.P</comments>
            <author/>
            <pubDate>Thu, 17 Apr 2008 00:51:03 MDT</pubDate>
        </item>
        <item uniqueID="27-002887">
            <title>Java threads</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</link>
            <description>I have a main program which talks to a network device. I want to initiate a thread from the main program which checks if the main program has completed execution. If yes, i want to kill this thread else i want to throw an exception and stop termination of the main program. How can it be done?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887Shubha P.P</comments>
            <author/>
            <pubDate>Wed, 16 Apr 2008 20:07:02 MDT</pubDate>
        </item>
        <item uniqueID="27-002888">
            <title>Live thread and GC root set</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002888</link>
            <description>I came across a &lt;a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002713" target="_blank"&gt;&lt;br /&gt;thread&lt;/a&gt; asking:&lt;br /&gt; &lt;br /&gt; &lt;blockquote&gt;quote:&lt;hr&gt;Thread t = new Thread(); t.start(); t = null; now what will happen to the created thread?&lt;hr&gt;&lt;/blockquote&gt; &lt;br /&gt; &lt;br /&gt;One of the replies was that:&lt;br /&gt; &lt;blockquote&gt;quote:&lt;hr&gt;As long as it's not dead, it belongs to a ThreadGroup, which keeps it from being collected.&lt;hr&gt;&lt;/blockquote&gt;&lt;br /&gt; &lt;br /&gt;Is it true that a live thread doesn't get collected by GC just because&lt;br /&gt;there is a reference from ThreadGroup to it?&lt;br /&gt; &lt;br /&gt;I tried to prove it by using this program&lt;br /&gt; &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt;public static void main(String[] args) throws Exceptio...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002888</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002888chatchai chailuecha</comments>
            <author/>
            <pubDate>Wed, 16 Apr 2008 10:23:01 MDT</pubDate>
        </item>
        <item uniqueID="27-002893">
            <title>wait() vs sleep()</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</link>
            <description>Hi,&lt;br /&gt; what is the difference between wait() and sleep() in threads.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893kiran peruka</comments>
            <author/>
            <pubDate>Wed, 16 Apr 2008 02:25:00 MDT</pubDate>
        </item>
        <item uniqueID="27-002893">
            <title>wait() vs sleep()</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</link>
            <description>Hi,&lt;br /&gt; what is the difference between wait() and sleep() in threads.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893kiran peruka</comments>
            <author/>
            <pubDate>Wed, 16 Apr 2008 02:15:00 MDT</pubDate>
        </item>
        <item uniqueID="27-002893">
            <title>wait() vs sleep()</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</link>
            <description>Hi,&lt;br /&gt; what is the difference between wait() and sleep() in threads.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893kiran peruka</comments>
            <author/>
            <pubDate>Wed, 16 Apr 2008 01:49:00 MDT</pubDate>
        </item>
        <item uniqueID="27-002892">
            <title>Executing a Java Code by multiple threads</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002892</link>
            <description>Hi ,&lt;br /&gt; &lt;br /&gt;I have the following Java Program.&lt;br /&gt; &lt;br /&gt;package com.citigroup.cai.core.util;&lt;br /&gt; &lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.net.InetAddress;&lt;br /&gt;import java.util.Enumeration;&lt;br /&gt; &lt;br /&gt;import netegrity.siteminder.javaagent.AgentAPI;&lt;br /&gt;import netegrity.siteminder.javaagent.Attribute;&lt;br /&gt;import netegrity.siteminder.javaagent.AttributeList;&lt;br /&gt;import netegrity.siteminder.javaagent.InitDef;&lt;br /&gt;import netegrity.siteminder.javaagent.RealmDef;&lt;br /&gt;import netegrity.siteminder.javaagent.ResourceContextDef;&lt;br /&gt;import netegrity.siteminder.javaagent.SessionDef;&lt;br /&gt;import netegrity.siteminder.javaagent.UserCredentials;&lt;br /&gt; &lt;br /&gt;import com.citigroup.cai.core.auth.ChangePasswordException;&lt;br /&gt;import c...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002892</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002892Nilesh Raje</comments>
            <author/>
            <pubDate>Wed, 16 Apr 2008 00:07:00 MDT</pubDate>
        </item>
        <item uniqueID="27-002893">
            <title>wait() vs sleep()</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</link>
            <description>Hi,&lt;br /&gt; what is the difference between wait() and sleep() in threads.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002893kiran peruka</comments>
            <author/>
            <pubDate>Tue, 15 Apr 2008 22:59:00 MDT</pubDate>
        </item>
        <item uniqueID="27-002892">
            <title>Executing a Java Code by multiple threads</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002892</link>
            <description>Hi ,&lt;br /&gt; &lt;br /&gt;I have the following Java Program.&lt;br /&gt; &lt;br /&gt;package com.citigroup.cai.core.util;&lt;br /&gt; &lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.net.InetAddress;&lt;br /&gt;import java.util.Enumeration;&lt;br /&gt; &lt;br /&gt;import netegrity.siteminder.javaagent.AgentAPI;&lt;br /&gt;import netegrity.siteminder.javaagent.Attribute;&lt;br /&gt;import netegrity.siteminder.javaagent.AttributeList;&lt;br /&gt;import netegrity.siteminder.javaagent.InitDef;&lt;br /&gt;import netegrity.siteminder.javaagent.RealmDef;&lt;br /&gt;import netegrity.siteminder.javaagent.ResourceContextDef;&lt;br /&gt;import netegrity.siteminder.javaagent.SessionDef;&lt;br /&gt;import netegrity.siteminder.javaagent.UserCredentials;&lt;br /&gt; &lt;br /&gt;import com.citigroup.cai.core.auth.ChangePasswordException;&lt;br /&gt;import c...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002892</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002892Nilesh Raje</comments>
            <author/>
            <pubDate>Tue, 15 Apr 2008 09:16:58 MDT</pubDate>
        </item>
        <item uniqueID="27-002891">
            <title>Question thread</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002891</link>
            <description>How can i stop the Thread?&lt;br /&gt;I have heard that Thread.stop() is unsafe.&lt;br /&gt;What is the other way to stop the thread?&lt;br /&gt;Which thread can we stop ?&lt;br /&gt;If we write Thread.currentthread.stop(), which thread will stop?&lt;br /&gt; &lt;br /&gt;Please expalin with example... </description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002891</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002891</comments>
            <pubDate>Tue, 15 Apr 2008 06:23:20 MDT</pubDate>
        </item>
        <item uniqueID="27-002890">
            <title>doubt in synchronization</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002890</link>
            <description>what is the difference between syncronize a block and synchronize an entire method?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002890</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002890</comments>
            <pubDate>Mon, 14 Apr 2008 23:47:19 MDT</pubDate>
        </item>
        <item uniqueID="27-002889">
            <title>Newbie to ThreadLocal</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002889</link>
            <description>Hi Gurus,&lt;br /&gt;I start learning ThreadLocal. I have basic knowledge that is a separate thread to hold a separate value but I don't know if there its practical usage. Could you explain it? Is ThreadLocal useful?&lt;br /&gt; &lt;br /&gt;I have the following code &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt; &lt;br /&gt;package general.thread;&lt;br /&gt; &lt;br /&gt;public class ThreadLocalDemo extends Thread &lt;br /&gt;{&lt;br /&gt;/** A serial number for clients */&lt;br /&gt;private static int clientNum = 0;&lt;br /&gt; &lt;br /&gt; /** This ThreadLocal holds the Client reference for each Thread */&lt;br /&gt;private ThreadLocal myClient = new ThreadLocal() &lt;br /&gt;{&lt;br /&gt; // The initialValue() method is called magically when you call get().&lt;br /&gt; protected synchronized Object initialValue()&lt;br /&gt; {&lt;br /&gt;...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002889</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002889</comments>
            <pubDate>Mon, 14 Apr 2008 11:43:17 MDT</pubDate>
        </item>
        <item uniqueID="27-002888">
            <title>Live thread and GC root set</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002888</link>
            <description>I came across a &lt;a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002713" target="_blank"&gt;&lt;br /&gt;thread&lt;/a&gt; asking:&lt;br /&gt; &lt;br /&gt; &lt;blockquote&gt;quote:&lt;hr&gt;Thread t = new Thread(); t.start(); t = null; now what will happen to the created thread?&lt;hr&gt;&lt;/blockquote&gt; &lt;br /&gt; &lt;br /&gt;One of the replies was that:&lt;br /&gt; &lt;blockquote&gt;quote:&lt;hr&gt;As long as it's not dead, it belongs to a ThreadGroup, which keeps it from being collected.&lt;hr&gt;&lt;/blockquote&gt;&lt;br /&gt; &lt;br /&gt;Is it true that a live thread doesn't get collected by GC just because&lt;br /&gt;there is a reference from ThreadGroup to it?&lt;br /&gt; &lt;br /&gt;I tried to prove it by using this program&lt;br /&gt; &lt;br /&gt;&lt;blockquote&gt;code:&lt;hr&gt;&lt;pre&gt;public static void main(String[] args) throws Exceptio...</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002888</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002888</comments>
            <pubDate>Mon, 14 Apr 2008 05:33:17 MDT</pubDate>
        </item>
        <item uniqueID="27-002887">
            <title>Java threads</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</link>
            <description>I have a main program which talks to a network device. I want to initiate a thread from the main program which checks if the main program has completed execution. If yes, i want to kill this thread else i want to throw an exception and stop termination of the main program. How can it be done?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002887</comments>
            <pubDate>Mon, 14 Apr 2008 03:51:16 MDT</pubDate>
        </item>
        <item uniqueID="27-002886">
            <title>What is CAS not supported by Processor</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002886</link>
            <description>Java 5 uses atomic object (Lock) to provide alternative to synchronization. Lock is nothing but the hardware level constructs of CAS. What is some processors do not support CAS and I have code with Lock object being used in it?&lt;br /&gt; &lt;br /&gt;I think it will break. Any idea?</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002886</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002886</comments>
            <pubDate>Sun, 13 Apr 2008 22:45:16 MDT</pubDate>
        </item>
        <item uniqueID="27-002885">
            <title>thread model in sun jvm for java6</title>
            <link>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002885</link>
            <description>what is the thread model used by sun jvm for java6?&lt;br /&gt;does each user thread get mapped to a kernel thread?(1:1 model)&lt;br /&gt;or are they multiplexed?(M:N model)&lt;br /&gt; &lt;br /&gt;is there a documentation somewhere?&lt;br /&gt; &lt;br /&gt;tia.</description>
            <guid isPermaLink="true">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002885</guid>
            <comments>http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=27&amp;t=002885</comments>
            <pubDate>Sun, 13 Apr 2008 12:29:15 MDT</pubDate>
        </item>
    </channel>
</rss>
