Thread TUTORIAL!!

Hi everyone,
I've been searching the sun tutorial for ages, so that i can find information about thread programms!!! Im pretty sure that i used it before, but i dont know how to find it again.
If anyone happens to know the url or where i can find the java.sun tutorials on threads please let me know.
Thanks

http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html

Similar Messages

  • Best thread/tutorial on sync?

    I'm just getting started on using an iPad and iTunes.  The official support and most threads are confusing in that I can't seem to find out exactly what happens when you "sync."  I think of the term "sync" as synchronizing, as in making two things completely consistent, without removing anything from either, but this does not seem to be what is happening  in an iPod/iPad "sync" - there is always the possibility of wiping something out! 
    I think use of the term "transfer" would help - instead of saying "sync the iPad to iTunes" or "sync iTunes to the iPad", I would like to see "If you check this checkbox and click APPLY, then X will be transferred from the iPad to the computer and all X in iTunes on the computer will be overwritten.  On the other hand, if you want to add X from the iPad to X on the computer, then do this."
    Any suggestions for a simple unambiguous discussion?

    Download this and do a search for "sync."
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

  • Calls to methods in a class that extends Thread

    Hello,
    I have some code that I am initiating from within an ActionListener that is part of my programs GUI. The code is quite long winded, at least in terms of how long it takes to perform. The code runs nicely, however once it is running the GUI freezes completely until operations have completed. This is unacceptable as the code can take up to hours to complete. After posting a message on this forum in regard to the freezing of the GUI it was kindly suggested that I use multi-threading to avoid the unwelcome program behaviour.
    The code to my class is as follows:
    public class FullURLAddress
      private boolean success_flag = true;
      private BufferedReader iN;
      private Document dT;
      private EditorKit kT;
      private Element lmNt;
      private ElementIterator lmIterate;
      private XURL[] compAddress;
      private int countX = 0;           //Tracks Vector vT's size.
      private int countY = 0;           //Tracks Vector vS's size.
      private int xURLcount = 0;        //Tracks XURL objects instantiated by this FullURLAddress object.
      private SimpleAttributeSet simpAtSet;
      private String aURL;              //Contains original (Xtended) URL!
      private String fileType;
      private String indexContent;
      private String[] parseURL;
      private String[] finalStrings;
      private String[] sortStrings;
      private URL indexConnect;
      private URLConnection iconn;
      private Vector vT;            //Stores href information, from targeted URL's HTML souce code.
      private Vector vS;            //Stores sorted HREF info ".jpg" and ".gif" only (no: png, tiff, etc).
      public FullURLAddress(String aURL)
        this.aURL = aURL;
        try{
          indexConnect = new URL(aURL);
          iconn = indexConnect.openConnection();
          iN = new BufferedReader(new InputStreamReader(iconn.getInputStream()));
            /* Document creation, analysis objects instantiated */
          vT = new Vector();
          vS = new Vector();
          kT = new HTMLEditorKit();
          dT = kT.createDefaultDocument();
          dT.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
            /* Iterate through document and store all HREF values */
          kT.read(iN, dT, 0);
          lmIterate = new ElementIterator(dT);
          while((lmNt = lmIterate.next()) != null)
            simpAtSet = (SimpleAttributeSet)lmNt.getAttributes().getAttribute(HTML.Tag.A);
            if(simpAtSet != null)         //As long as there are A tags to be read...
              vT.addElement(simpAtSet.getAttribute(HTML.Attribute.HREF));
              countX++;//Tracks number of HREF occurences occur, giving better control of the Vector.
        }catch(MalformedURLException e){
          success_flag = false;
          System.out.println("FullURLAddress object has encountered a "+
                             "MalformedURLException at: "+aURL);
        }catch(IOException e){
          e.getMessage();
          success_flag = false;
        }catch(BadLocationException e){
          e.getMessage();
          success_flag = false;
        /* Searches through all HREF attributes that are now stored in Vector
           vT for occurences of the character string ".htm" */
        sortStrings = new String[countX];
        for(int i=0;i<countX;i++)
          sortStrings[i] = (String)vT.elementAt(i); //Vector Strings transfered into array.
          if(sortStrings.endsWith("gif")) // Does href value end with ".jpg"?
    vS.addElement(sortStrings[i]); // If so add it to the sorted Vector vS.
    countY++;
    if(sortStrings[i].endsWith("GIF"))
    vS.addElement(sortStrings[i]);
    countY++;
    if(sortStrings[i].endsWith("jpg")) // Does href value end with ".jpg"?
    vS.addElement(sortStrings[i]); // If so add it to the sorted Vector vS.
    countY++;
    if(sortStrings[i].endsWith("JPG"))
    vS.addElement(sortStrings[i]);
    countY++;
    finalStrings = new String[countY];
    for(int j=0;j<countY;j++)
    finalStrings[j] = (String)vS.elementAt(j);
    public int getCount()
    return countY; //Returns number of instances of htm strings
    } //ending with either "jpg" or "gif".
    public String[] xurlAddressDetails()
    return finalStrings;
    I have changed the above code to make use of multithreading by making this class extend Thread and implementing the run() method as follows:
    public class FullURLAddress extends Thread
      private boolean success_flag = true;
      private BufferedReader iN;
      private Document dT;
      private EditorKit kT;
      private Element lmNt;
      private ElementIterator lmIterate;
      private XURL[] compAddress;
      private int countX = 0;           //Tracks Vector vT's size.
      private int countY = 0;           //Tracks Vector vS's size.
      private int xURLcount = 0;        //Tracks XURL objects instantiated by this FullURLAddress object.
      private SimpleAttributeSet simpAtSet;
      private String aURL;              //Contains original (Xtended) URL!
      private String fileType;
      private String indexContent;
      private String[] parseURL;
      private String[] finalStrings;
      private String[] sortStrings;
      private URL indexConnect;
      private URLConnection iconn;
      private Vector vT;            //Stores href information, from targeted URL's HTML souce code.
      private Vector vS;            //Stores sorted HREF info ".jpg" and ".gif" only (no: png, tiff, etc).
      public FullURLAddress(String aURL)
        this.aURL = aURL;
      public void run()
        try{
          indexConnect = new URL(aURL);
          iconn = indexConnect.openConnection();
          iN = new BufferedReader(new InputStreamReader(iconn.getInputStream()));
            /* Document creation, analysis objects instantiated */
          vT = new Vector();
          vS = new Vector();
          kT = new HTMLEditorKit();
          dT = kT.createDefaultDocument();
          dT.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
            /* Iterate through document and store all HREF values */
          kT.read(iN, dT, 0);
          lmIterate = new ElementIterator(dT);
          while((lmNt = lmIterate.next()) != null)
            simpAtSet = (SimpleAttributeSet)lmNt.getAttributes().getAttribute(HTML.Tag.A);
            if(simpAtSet != null)         //As long as there are A tags to be read...
              vT.addElement(simpAtSet.getAttribute(HTML.Attribute.HREF));
              countX++;//Tracks number of HREF occurences occur, giving better control of the Vector.
        }catch(MalformedURLException e){
          success_flag = false;
          System.out.println("FullURLAddress object has encountered a "+
                             "MalformedURLException at: "+aURL);
        }catch(IOException e){
          e.getMessage();
          success_flag = false;
        }catch(BadLocationException e){
          e.getMessage();
          success_flag = false;
        /* Searches through all HREF attributes that are now stored in Vector
           vT for occurences of the character string ".htm" */
        sortStrings = new String[countX];
        for(int i=0;i<countX;i++)
          sortStrings[i] = (String)vT.elementAt(i); //Vector Strings transfered into array.
          if(sortStrings.endsWith("gif")) // Does href value end with ".jpg"?
    vS.addElement(sortStrings[i]); // If so add it to the sorted Vector vS.
    countY++;
    if(sortStrings[i].endsWith("GIF"))
    vS.addElement(sortStrings[i]);
    countY++;
    if(sortStrings[i].endsWith("jpg")) // Does href value end with ".jpg"?
    vS.addElement(sortStrings[i]); // If so add it to the sorted Vector vS.
    countY++;
    if(sortStrings[i].endsWith("JPG"))
    vS.addElement(sortStrings[i]);
    countY++;
    finalStrings = new String[countY];
    for(int j=0;j<countY;j++)
    finalStrings[j] = (String)vS.elementAt(j);
    /* What happens with these methods, will they need to have their
    own treads also? */
    public int getCount()
    return countY; //Returns number of instances of htm strings
    } //ending with either "jpg" or "gif".
    public String[] xurlAddressDetails()
    return finalStrings;
    Are there any special things that I need to do in regard to the variables returned by the getCount() and xurlAddressDetails() methods. These methods are called by the code that started the run method from within my GUI. I don't understand which thread these methods are running in, obviously there is an AWT thread for my GUI and then a seperate thread for my FullURLAddress objects, but does this new thread also encompass the getCount() and xurlAddressDetails() methods?
    Please explain.
    This probably sounds a little wack, but I don't understand what thread is responisble for the methods in my FullURLAddress class aside of course from the run() method which is obvious. Any help will be awesome.
    Thanks
    Davo

    Threads are part of code that allows you to run multiple operations "simultaneously". "Simultaneously", because threads are not run actually simultaneously in any one-CPU machine. Since you most propably have only one CPU in your system, you can only execute one CPU instruction at time. Basically this means that your CPU can handle only one java-operation at time. It does not matter if you put some code in thread and start it, it will still take up all CPU time as long as the thread runs.
    So you would need a way to let other threads run also, for that purpose thread contains a yield feature that allows you to give time for other threads to run.
    http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Thread.html#yield()
    You need to use thread's yield() method in your thread code, in a place you want to give other threads time to run. Also bear in mind that if you yield your first thread run to allow second thread to run, you also need to add yield to the second thread also. If you don't, after yielding the first thread, the second thread will eat up all CPU time until it finishes, thus meaning the rest of your first thread will be run after second thread is done.
    One good place to execute yield() is usually at the end of a loop, for example 'for' or 'while' loop. This way you prevent for example while-deadlocks.
    Here is a java thread tutorial, worthy reading:
    http://java.sun.com/docs/books/tutorial/essential/threads/

  • Can't kill a running thread...

    I'm having some problems killing a thread. Becuase thread.stop() is no longer used, I basically set a flag to tell all the threads to return by checking this flag in the run() method. The problem now is that there is a thread that is getting "stuck" in a class that I have no access to. So basically I assume that its a really long loop, or an infinite loop... either way, that thread doesn't stop even if the "parent" (spawning) thread is "stopped". Any suggestions?
    -L

    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial
    Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated?

  • Question about java threads programming

    Hi
    I have to develop a program where I need to access data from database, but I need to it using multithreading, currently I go sequentially to each database to access data which is slow
    I have a Vector called systemnames, this one has list of all the systems I need to access.
    Here is my current code, some thing like this
    Vector masterVector = new Vector();
    GetData data = new GetData();
    For(int i =0; i < systemnames.size(); i++)
    masterVector.add(data.getData((String)systemnames.get(i));
    public class GetData
    private Vector getData(String ipaddress)
    //process SQL here
    return data;
    how do i convert this to multithread application, so there will be one thread running for each system in vector, this is speed up the process of extracting data and displaying it
    has any one done this kind of program, what are the precautions i need to take care of
    Ashish

    http://www.google.com/search?q=java+threads+tutorial&sourceid=opera&num=0&ie=utf-8&oe=utf-8
    http://java.sun.com/docs/books/tutorial/essential/threads/
    http://www.javaworld.com/javaworld/jw-04-1996/jw-04-threads.html
    http://www.cs.clemson.edu/~cs428/resources/java/tutorial/JTThreads.html
    http://www-106.ibm.com/developerworks/edu/j-dw-javathread-i.html
    When you post code, please use [code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read and prevents accidental markup from array indices like [i].

  • Question while Learning about Thread

    I am learning about thread.
    I ran the sample producer/consumer programe in Java Thread Tutorial in which I added two lines of printing out codes in class CubbyHole to observe the runing sequence better.
    The result made me a bit confused. I imagine that the result "Producer #1 put: 1" should be printed out right after "put 1", why it appeared after "get 1" and "Consumer #1 got: 1"?
    Codes are listed below:
    public class ProducerConsumerTest {
    public static void main(String[] args) {
    CubbyHole c = new CubbyHole();
    Producer p1 = new Producer(c, 1);
    Consumer c1 = new Consumer(c, 1);
    p1.start();
    c1.start();
    public class Producer extends Thread {
    private CubbyHole cubbyhole;
    private int number;
    public Producer(CubbyHole c, int number) {
    cubbyhole = c;
    this.number = number;
    public void run() {
    for (int i = 0; i < 10; i++) {
    cubbyhole.put(i);
    System.out.println("Producer #" + this.number
    + " put: " + i);
    try {
    sleep((int)(Math.random() * 100));
    } catch (InterruptedException e) { }
    public class Consumer extends Thread {
    private CubbyHole cubbyhole;
    private int number;
    public Consumer(CubbyHole c, int number) {
    cubbyhole = c;
    this.number = number;
    public void run() {
    int value = 0;
    for (int i = 0; i < 10; i++) {
    value = cubbyhole.get();
    System.out.println("Consumer #" + this.number
    + " got: " + value);
    public class CubbyHole {
    private int contents;
    private boolean available = false;
    public synchronized int get() {
    while (available == false) {
    try {
    wait();
    } catch (InterruptedException e) { }
    available = false;
    System.out.println("get " + contents);
    notifyAll();
    return contents;
    public synchronized void put(int value) {
    while (available == true) {
    try {
    wait();
    } catch (InterruptedException e) { }
    contents = value;
    System.out.println("put " + contents);
    available = true;
    notifyAll();
    The result is as below:
    put 0
    Producer #1 put: 0
    get 0
    Consumer #1 got: 0
    put 1
    get 1
    Consumer #1 got: 1
    Producer #1 put: 1
    put 2
    get 2
    Consumer #1 got: 2
    Producer #1 put: 2
    put 3
    get 3
    Consumer #1 got: 3
    Producer #1 put: 3
    put 4
    get 4
    Consumer #1 got: 4
    Producer #1 put: 4
    put 5
    get 5
    Consumer #1 got: 5
    Producer #1 put: 5
    put 6
    get 6
    Consumer #1 got: 6
    Producer #1 put: 6
    put 7
    get 7
    Consumer #1 got: 7
    Producer #1 put: 7
    put 8
    get 8
    Consumer #1 got: 8
    Producer #1 put: 8
    put 9
    Producer #1 put: 9
    get 9
    Consumer #1 got: 9

    Hi alaska,
    The reason you got those results are because these are
    threads. The execution of the order of thread is
    always random (unless some explicit logic is applied)
    and CPU can execute any thread at any time within the
    process. So the results you got are perfectly right.
    Even the order of the output may change everytime you
    run the same program.
    -- manishI think you can change the predictability by setting the Producer's thread priority has higher than the Consumer's...

  • I need help about threads

    Hi!, I need to know how can i do that a father thread have acces to the son thread's methods or how a son thread can to notify at father any event?
    thanks

    look at the thread tutorial, it covers nofity, notifyAll, etc. Also check out the Thread class API...

  • Static method and threads?

    I have a question regarding "static". for example, I have the following code
    class Test{
    public int i=0;
    public static calculateInt(){
    ....some operations on i;
    if two processes attempt to call Test.calculateInt() at the same time. What will the effects be? shall these two calls be implemented totally independent? each call holds it own "i" for calculation. OR there will be operation conflicit on i.
    what if I change "public i" to :private i", the same effects?

    You can't operate on i in a static method, since i is an instance variable.
    If you make i static, then you can operate on it in a static method. In that case, all threads will share a single i--there's only one i for the whole class, and threads don't change that. Making it private won't change that.
    If you make the method into an instance (non-static) method, then any threads operating on the same instance will share the same i, regardless of whether it's public or private. Different threads operating on different instances will each have their own i.
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial
    Also check out http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html

  • Accesing methods from threads

    hi.
    Im trying to write a program that requires multithreading , I store each thread as an object in a vector to identify the thread because the threads are all initiated from the same class , heres the code:
    while(condition) {
    myThread thread = new myThread(); // myThread extends Thread
    vector.add(thread);
    how would i access a method from one of these threads?
    or is there a more efficient way without using vectors etc?

    what i mean by accessing methods is that there is
    only one class that extends Thread but i have create
    an instance of that class several times in the run
    method so the only way i can identifiy each class is
    by putting it in a vector but when i call
    vector.get(indexNo).methodname() the compiler spits
    it back out?I really don't know what you're saying here. If you're getting an error message from the compiler, paste it here, along with the relevant code, and an indication of which line it's complaining about.
    When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. It makes it much easier to read.
    And do go through that thread tutorial thoroughly. It may or may not answer your current specific question, but it will give you some fundamentals that are essential when doing multithreaded progamming.

  • Threads in Java

    I'm having problems with threads. I'm trying to create a class that extends/overrides the run method in thread. My program is a "game" where the "pet" has a health, hunger and clean bar stored in the class Cavy. The user can increase the status bars through the user of the JButtons to play/feed/clean out/groom their pet. To decrease the status bars, I want a thread to run alongside the program which will run a method (count()) ever 60 seconds. Count() will call the method random() to generate a random number between 1 and 10 that will then be subtracted from the health bars. Then the thread will sleep again for 60 seconds.
    I'm having problems getting my program to run in the first place.
    My driver method which originally (yet failed to) run the method:
      * Main driver method.
    public class Driver {
         public static void main (String[] args) throws Exception
              //Begins a new instance of GuiInitial called Demo.
              Gui Demo = new Gui();
              Indicators start = new Indicators();
              //(new Indicators()).start();
    }And finally, the Indicators class itself that extends thread.
    * This class will deal with the changing of the Health, Happy and clean values
    * every minute the values will be changed and the child will be required to
    * respond to these changes.
    import java.lang.*;
    import java.util.*;
    public class Indicators extends Thread{
    Thread thread;
    int Count;
    private Cavy cavy;
    //this method will act as the counter method that will trigger everyhting
    //that may happen below.
    private void Run()
         thread = new Thread(this);
         thread.start();
         System.out.println("I got into run");
         while (true)
              count();
              try {
                   thread.sleep(6000);
              catch (Exception e){
                   System.out.println("YIKES - exception! Fail");
    //this will change the three values themselves
    private void count(){
              int temphu = cavy.getHunger();
              int tempha = cavy.getHappy();
              int tempcl = cavy.getClean();
                   System.out.println("hello World");
                   if (temphu > 10){
                        int huvalue = random();
                        cavy.setHunger(temphu - huvalue);
                   else if (tempha >= 10){
                        int havalue = random();
                        cavy.setHappy(tempha - havalue);
                   else if (tempcl >= 10){
                        int clvalue = random();
                        cavy.setClean(tempcl - clvalue);
    public int random()
         Random r = new Random();
         return r.nextInt(10)+1;
    }I can't see what I'm doing wrong, even after consulting the Java API, Java Tutorial and a tutorial in javaworld which I found from Google. Thanks.
    Edited by: teadragon on Mar 29, 2008 10:31 AM

    Encephalopathic wrote:
    I recommend that you don't extend Thread but rather implement Runnable. You also need to go through the Sun Threading tutorial in a bad way as you have some significantly misplaced preconceptions. For instance, the run method must have a lower case "r", must be public, in short it's signature must match that of Thread or Runnable's. This is one place where an "@Override" notation would be very useful.
    A simple example is like so:
    public class MyRunnable implements Runnable
    @Override
    public void run()
    //thread = new Thread(this);
    //thread.start();
    System.out.println("I got into run");
    public static void main (String[] args)
    new Thread(new MyRunnable()).start();
    Why do you think that I should implement Runnable as opposed to extending Thread? I understood that extending Thread allows you to "do more with it" - in my case, extending and modifying run means that I can now change run so that run does what I want it to do. I had thought that implementing Runnable wouldn't be appropriate... I'm curious because I might have misunderstood a lot of what's been explained to me.

  • Using threads seemed to be of no use

    Hi,
    I am trying to change my existing "thread - less" software to a "threaded" model. Here the accesses a class. and executes various functions.
    So I changed that class to a Thread. So now, everytime I "run()" the class, I believe a new thread is being created. Hence I should be able to execute multiple functions. But My software is working the same louzy way. :(
    I am getting something wrong? why am I not able to do something else on the GUI while a thread is being executed. My GUI freezes until the thread is complete.
    Plz help.
    Kind regards,
    Rajesh Rapaka.

    Thread Tutorial
    use start not run().
    Really you should not be extending Thread, what you should do is implement Runnable, then do
    Thread theThread = new Thread( this );
    theThread.start();Message was edited by:
    mlk

  • Thread Realted

    I am running Class ThreadTestB. I am not able to get the region why
    ThreadTestB b1 = new ThreadTestB("b1.......");
    ThreadTestB b2 = new ThreadTestB("b2 ****");
    Is also executing.
    If &#8220;b1&#8221; will execute Infinite time then lock will not released . so &#8220;b2&#8221; execution is not possible. But when u run
    Class ThreadTest B. B2 execution is also done . Why it is passible ?.
    public class ThreadTestB extends Thread {
    ThreadTestB(){}
    ThreadTestB(String str){
    super(str);
    //FileOutputStream fout= new FileOut
    ThreadTestA a = new ThreadTestA();
    public void run()
    a.Am1();
    a.Am2();
    public static void main(String[] args) {
    ThreadTestB b1 = new ThreadTestB("b1.......");
    ThreadTestB b2 = new ThreadTestB("b2 ****");
    b1.start();
    b2.start();
    public class ThreadTestA {
    //FileOutputStream fout= new FileOut
    public synchronized void Am1(){
    System.out.println(" Am1 start to execute .."+Thread.currentThread().getName());
    while(true){
    System.out.println(" Am1 ...........00000 current thread "+Thread.currentThread().getName());
    // try{Thread.sleep(1000);
    // }catch(Exception exp){}
    public synchronized void Am2(){
    while(true){
    System.out.println(" Am2 ***********1111current thread "+Thread.currentThread().getName());
    // try{Thread.sleep(1000);
    // }catch(Exception exp){}
    public static void main(String[] args) {

    Thank ,
    but pls explain by Example. I'm sure the tutorial has examples.
    Here are a couple more examples.
    http://www.javaalmanac.com/cgi-bin/search/find.pl?words=thread
    You might also want to check out Doug Lea's Concurrent Programming in Java
    Here's yawmark's list of goodies. I'm sure you'll find examples there too:
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial
    Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated?
    Go through some of this stuff, and if you have a question more specific than "How do I use threads to handle multiple requests?" then post again.
    Oh, also, if you need an intro to the socket side of it:
    http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
    The Java&trade; Tutorial - Lesson: All About Sockets
    Sockets programming in Java: A tutorial

  • RoadMap tutorial using webdynpro.....

    Hi Profs,
    Can anyone help me with some tutorial regarding roadmap using webdynpto.
    Thanks
    ritu

    Hi Ritu,
    You check the help.sap.com site links for more help.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/79/da8b412bb5b35fe10000000a1550b0/frameset.htm
    also check this thread
    tutorial needed regarding roadmap
    Thanks n Regards
    Santosh
    Reward if helpful !!!

  • Is there any way to interrupt the sleeping thread ?

    Is there any way to interrupt the sleeping thread ?
    regards,
    namanc

    Thread.interrupt, very
    sneakily hidden by being in the javadocs under the
    class you know you're using, as a method named by what
    you want to do.:o)
    Here's more:
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

  • Question about EJB and thread safe coding - asking again!

    sorry everyone, no one seems to be interested in helping me on this, so i post it again.
    i have a question about the EJB and thread safe coding. when we build EJBs, do we need to worry about thread safe issue? i know that EJBs are single threaded, and the container manages the thread for us. maybe i am wrong about this. if i wasnot, how can we program the EJB so that two or more instance of EJB are not going to have deadlock problem when accessing data resources. do we need to put syncronization in ours beans, do we even need to worry about creating a thread safe EJB? thanks in advance. the question really bothers me a lot lately.

    sorry everyone, no one seems to be interested in
    helping me on this, so i post it again.Excellent plan. Why not search a little bit on your own instead of waiting for your personal forum slaves to answer your call. See below.
    i have a question about the EJB and thread safe
    coding. when we build EJBs, do we need to worry about
    thread safe issue? Read this: http://forum.java.sun.com/thread.jsp?forum=13&thread=562598&tstart=75&trange=15
    i know that EJBs are single
    threaded, and the container manages the thread for us.
    maybe i am wrong about this. if i wasnot, how can we
    program the EJB so that two or more instance of EJB
    are not going to have deadlock problem when accessing
    data resources. do we need to put syncronization in
    ours beans, do we even need to worry about creating a
    thread safe EJB? thanks in advance. the question
    really bothers me a lot lately.
    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

Maybe you are looking for

  • Problem with Live Chat

    I choose "Live Chat" from the Contact Us page, then I choose Prepaid Services (my topic), and it tells me there are agents available, but I am lost.  If I click where it tells me there are agents available, I go nowhere.  Any suggestions?

  • Creating a Java content tree from scratch and then marshal it to XML data

    Hi, After binding a schema using JAXB binding, I wrote a class to create a Java content tree from scratch and then marshal it to create an XML document. To see if the resulting xml document is correct, I opened it in XMLSpy and tried to validate it a

  • Mac Pro (late 2013) Graphic Issues

    Hi everyone I own a Mac Pro from late 2013 and occasionally run into graphic problems. I work on a dual monitor setup, mostly drawing CAD. At times my monitors freeze while background processes continue to run (music etc.). At times I still manage to

  • Issue getting hp software to work

    hello, I have a  HP Photosmart Premium Fax All-in-One Printer - C309a, Im having issues getting my software to work properly... Im trying to print onto a printable cd and the photo that I am using will not import. I have called HP customer service an

  • CS4, Bad ghosting exporting to iPod

    All, I need clips from a DVD transferred to a classic iPod. I got the sequence from the DVD in the timeline. I export the media to an mp4 large iPod format. The output shows people moving around like ghosts. How can I prevent it from trying to blend