Which thread would start first and why

Could anybody advise me as to which thread would start first
new thread(new Runnable(){
public void run(){
TestThread t1 = new Thread();
t1.start();
}).start();
I would have guessed that the outer one but it seems to be happeneing otherwise.

new thread(new Runnable(){
    public void run(){
        TestThread t1 = new Thread();
        t1.start();
}).start();The outer one's start() method is called.
At some point after that, the new thread (not Thread, thread) created by calling outer's start will call outer's run(), which calls inner's start(), which gives us another thread (not Thread).
At this point, outer's start() and run() have both been called, an inner's start() has been called. Both outer and inner are threads that exist and are eligible for cycles. Inner's run() may be called immediately or later.
From now on, we can't predict (priority and synchronization aside) what order the threads will execute in. So if inner's run's first statement is System.err.println("inner") and outer's first statement after starting inner is System.err.println("outer") then we could see either
inner
outer
or
outer
inner
¶

Similar Messages

  • Which thread will start first?

    Hi,
    I have a very basic question for you folks, considering the following example code,
    new thread(new Runnable(){
    public void run(){
    TestThread t1 = new Thread();
    t1.start();
    }).start();
    Now the question is which thread will start first. The outer one or t1?
    Any explanation would be greatly appreciated.
    /khurram

    Sorry - I should have been more clear
    Runnable r = new Runnable() {
      public void run() {
    }; //the run() method has not been called yet!
    r.run(); //now it has!is defining a class which is to be instantiated. By "defining" a class, I mean providing an implementation of one of the class's methods. This method will not be invoked until explicitly called on the Object "r". The is exactly what is done when the start() is called on the outer thread. Is this a bit clearer?

  • MIDI CONTROLLERS WHICH ONE WOULD YOU CHOSE AND WHY?

    Between M-Audio 8v2 , M-Audio 02 , M-AUDIO 49E and M-Audio axiom 25. Which one of these would you choose and why?

    The Axiom 25.
    For the rotary encoders, pads and memory.
    I'd take this over the 49 because both of the keyboards will be pitiful and your better of getting a full size board with hammer action if its about the "piano" feel. These things are great to have at hand when fiddling with synths while setting up in logic.

  • Which would you keep, which would you sell, and why?

    This kind of question might not be totally appropriate for this forum, but here goes anyhow. If it's really off-topic, I suppose the mods can delete it, but I am really having a hard time with this decision.
    I am thinking of selling off a couple of laptops for a newer (refurbished) 15-inch AlBook. I am selling an iBook for sure. Also, one of the following will go to my wife, and one will get sold to help raise cash for the newer AlBook:
    1. TiBook, 15", 1GHz, 1GB RAM, 100GB hard drive, Superdrive, Airport
    2. AlBook 12", 867MHz, 1.12GB RAM, 60GB hard drive, Combo drive, Airport Extreme, Bluetooth
    Which one would you sell, which one would you keep, and why? I have my own ideas, but I am really on the fence as to a final decision. I need some other opinions from people who know TiBooks better than I do.
    Thanks. By the way, I'm really not this indecisive in real life. Now for my next question: Given the choice between pancakes and sausage or eggs and bacon for breakfast, which would you choose and why?

    IMHO no Powerbook as been as fine as a Titanium and as you have the 1GHz SD Ti I would defintely keep that. For the following reasons:
    Far more comfortable screen to use. (1280x854 versus XGA)
    DVI connection (instant connection to projectors/lcd monitors no need for adaptors like the Al 12)
    PCMCIA slot
    64Mb versus 32Mb Graphics Memory
    Style - it's slimer(2.5cm Ti versus 3cm Al) and I prefer the look.
    All ports convieniently on the back and under a cover to keep dust etc out.
    Shed load of replacement parts available on eBay (not had to use this yet though)
    and specfically because of what you list:
    100Gb HDD versus 60Gb
    Superdrive versus Combo
    Processor Speed
    You can soon add BT, 802.11g, card reader or USB 2 (or any future technology) to a Ti via the PCMCIA but even though the Al has AE and BT you can't add FW800 or whatever else crops up to the Al 12.
    The negatives of the Ti would be - battery is most likely to critically fail shortly and the slower memory speed on the Ti.
    I love my Ti, even though it's three years old now (still 2.5hrs charge!) new Al books are not at all tempting - tell me what else I could achieve witha new Al over the Ti?
    regards
    mrtotes
    P.S. Pancakes for breakfast - absolutely bonkers! I tried it once on my Honeymoon to Canada - it won't catch on. Eggs and bacon is the way ahead, but a Full English would be preferable...

  • Which one of these two drives would you recommend and why

    Hello,
    I am planning on adding an external HD to be used with Time Machine.
    I was looking at a WD My Book Studio LX 2 TB FireWire 800, then I saw another WD - 2 TB My Book Studio II.
    While the first look very nice and sleek with its aluminum case, and judging by WD website, offers more features, the second one seem to be faster (7200 rpm vs 5400 rpm) and it also offers 5 years of warranty compared with only 3.
    I am not a computer geek, therefore I am throwing the question here: which one should I buy and why? Do I really need that RAID technology?
    Thanks in advance for your answers.
    Regards,
    Loerincz

    IMHO, you want neither. I've heard enough bad things about WD drives on these forums that I wouldn't touch them with a ten-foot pole. Try [Other World Computing|http://www.macsales.com>. They've got quality stuff.
    As for RAID, you probably don't need that. RAID is a way to make multiple separate drives act like one larger drive, but that's major overkill for most home backup needs.

  • How the process starts in XI and which one should start first ?

    How the process starts in XI and which one should start first ?

    XI flow :
    1.File picked by the adapter,at the A.E it converts to XML format.
    2.Generate a msg ID for the file and creates XI header to that file  using CPA cache. CPA cache will be having the    information about all the Control(address) data.
    3.Module processor
    4.The file goes to send queue by the adapter engine, that file will be  picked by the internal XI adapter and the file    will be forwarded to the Integration engine.
    5.Pipeline steps follow the Integration Engine.
      Receiver determination, Interface determination, Msg split, Msg  mapping, Logical routing, Receiver aggrement, call adapter
    6.The file will go to receive queue, which was taken and forwarded to the adapter engine.

  • Which email service would you recommend and why? Google's or BC's?

    Which email service would you recommend and why? Google's or BC's?

    Easy Answer. Google. Hands down Google is better. BC has had issues in the past and while I think the issue is a little bit better I would choose Google. Do remember that Google Apps is $50 (USD) per year per user.
    I have used Google Apps since they were still offering 50 free users and has worked great ever since. If there have been downtimes I have not noticed or has been so slight that is hasn't effected me in anyway. This is not the case with BC.
    I am not trying to knock BC mail but it isn't the best.

  • Photo/Video editing PC build; what would you change and why?

    I'm in the planning phase of my first photo/video editing PC build.  I've done quite a bit of research to this point, and I've finally come to a decision on all of the components (I think).  After seeing how helpful everyone is on this forum, I decided to post my plan and see what everyone thinks.
    Miscellaneous info:  I am an amateur photographer looking to expand my horizons and venture into the video realm.  I will be running Windows 7 64bit with Adobe CS5 Production Premium and Lightroom 3 on a singe solid state drive and everything else will be on a 3 drive RAID 0 config.  Eventually I plan on purchasing a RAID card and a few more drives for a RAID 3 (or 5) config, but that won't be for a while.
    Ok, here's my planned build...
    Component
    Description
    Processor
    Intel   Core i7 - 950 3.06GHz Quad-Core Processor
    Motherboard
    ASUS   P6X58D-E LGA 1366 Intel X58 ATX Intel Motherboard
    Memory
    Corsair   Dominator 12GB (6 x 2GB) DDR3 1600 (PC3 12800) Triple Channel Memory
    System Drive
    Crucial   RealSSD C300 2.5" 128GB SATA III MLC Internal Solid State Drive
    Data Drive(s)
    3 - Western   Digital Caviar Black 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal   Hard Drive (Configured in RAID 0 for now)
    Optical Drive
    Pioneer   BDR-205BKS Blu-ray Burner
    Video Card
    EVGA   GeForce GTX 470 (Fermi) SuperClocked 1280MB 320-bit GDDR5 PCI Express 2.0 x16   HDCP Ready SLI Support Video Card
    Power Supply
    Corsair   HX Series CMPSU-850HX 850W ATX12V 2.3 / EPS12V 2.91 80 PLUS SILVER Certified   Modular Active PFC Power Supply
    Case
    LIAN   LI PC-A71F Black Aluminum ATX Full Tower Computer Case
    Monitor
    NEC   MultiSync PA271W-BK-SV 27" Widescreen LCD Monitor with SpectraViewII   Color Calibration Solution
    So, what would you change and why?
    I'm looking forward to your responses!

    "I'll take your advice and go with Samsung F3s.  With the money I save  (by not getting the WD Caviar Blacks), I'll add a 4th drive and use the  RAID5 on the mobo until I can afford to upgrade to a proper RAID  controller."
    I might be a bit late, but wanted to let you know about motherboard software RAID configs (at least mine):
    I have an older system running an ASUS P5AD2-E Premium MB containing a Silicon Image 3114 RAID chip. I originally configured a RAID 10 array with four 74 G Raptors for speed and redundancy. Figured if I lost a disc, I could just rebuid the array. Come to find out, the Sil 3114 chip does not support rebuilding the RAID 10 array.
    I had lost a disc (disc was okay, just power to the disc was interupted) so was running on three. Fixed my power problem, went to rebuild the array and couldn't. So I figured what is the point of having a RAID 10 that I couldn't rebuild. Went to a RAID 0 with a backup disk.
    Never checked the documentation to see if software RAID 5 through the SIl 3114 was rebuildable.
    Mind you, I am not a computer guru nor all knowledgable about software/harware based RAID configs. But after talking to others who are the guru's, I found that I should stay away from the motherboard software RAID arrays and they mirror what Harm said about hardware RAID boards. But on a budget, the RAID 0 with a backup drive works for me.
    Just my 2 cents to help.
    Tony

  • Which index will it take and why ?

    Hi, 
    I have a table Employee and i have an index on EmpID on this table. Now i have created a view EmpView on this table. I have created an index on this view for the same column EmpID.
    Now my question is If i query select * from Empview where empId = something then which index will it consider and why?? 
    Thanks in advance
    Balaji 
    Balaji - BI Developer

    Good day Balaji
    Prasad 
    1. How long it took you to write the question in the forum?
    You are asking about specific case in your database. I am sure that you could open click on the Execution Plan button and get a faster answer and much more accurate for your specific database. Not always the forum is the best and faster solution, sometimes
    you can get it yourself.
    Regarding the "why", it is a good question :-)
    please post DDL+DML
    2. As other mentioned if you want help regarding a query then we need to be able to reproduce the situation. Instead of stories on your tables, you could post the DDL+DML queries :-) that mean the create table (with indexes) query and the insert sample
    data query. With this information we can click the Execution Plan button in our server :-)
    Moreover, with DDL+DML we might suggest a better solution
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Friends... i have been using an iphone 3(4.1/8B117), i jailbroke my iphone and then mistakenly deleted some of the cydia files after which my iphone started rebooting,and since then its restarting againg and again..please help..i'll be glad !!!!

    Friends... i have been using an iphone 3(4.1/8B117), i jailbroke my iphone and then mistakenly deleted some of the cydia system files after which my iphone started rebooting,and since then its restarting again and again..only the apple logo appears in the black screen and my fone restarts again... guys please help..i'll be glad !!!!

    Under the Terms of Use of this forum it is prohibited to discuss jail breaking. By jail breaking your iPhone you void any warranty you may have, forfeit any support from this forum, leave your iPhone vulnerable to malware and risk bricking your iPhone should you attempt future software updates or restoring your iPhone.

  • SQLSRV Driver vs PDO_SQLSRV. What would you suggest, and why?

    Hi all,
    My team and I are working on a mobile XMPP/Jabber instant messaging application, aimed at iOS, Android and Windows 8 phones. The back-end XMPP Server is
    OpenFire and this OpenFire Server works together with a SQL Server 2014 Database to store users, offline messages, etc. We also want to do some stuff to the database, which OpenFire does not
    do by itself. For this, I have opted to use PHP on the server and call it via jQuery Ajax on the front-end. Anyway, what I am wondering is, which of the two PHP Drivers for SQL Server I should use in this case. There seem to be two drivers provided by Microsoft:
    A) SQLSRV Driver (procedural)
    and
    B) PDO_SQLSRV (Object oriented).
    I am currently reading the documentation at Accessing SQL Server Databases from PHP to get some insight into these two options,
    but I am wondering if anyone has any preference for any driver, and why?
    Ideally, I would like a driver that is fault-tolerant in an environment where many quasi-simultaneous read/write operations are made to the database, as we are hoping for a high adoption rate for this application, meaning lots of users -> Lots of SQL
    Queries.
    Thanks for all help and suggestions,
    best regards,
    Chris
    Edit: Also, I am running PHP 5.5.15, however the download package at http://www.microsoft.com/en-us/download/confirmation.aspx?id=20098 only includes drivers for php 5.3 and 5.4. Will these also work for PHP 5.5.15 (running XAMPP)

    Hi, first I am not criticizing the Microsoft and liguagem.net is very good. depends on the sitau��o of its company. you must lead in consideration you will be that valley the penalty to migrar? you find that this taking care of the necessities of the company continues working with Asp.net! here in Brazil he would be for account of the money lack that great companies want to have its applications how much good, pretty and cheap... it could until saying makes in JSP 2,0 and good IDE and eclipse 3,0, I loved:) it would advise to think a little on the situation of migrar its applications! but it thinks... migration, has much the one that to plan! it studies and it thinks very!
    my opinion this
    success
    karla maria :)

  • Linux on Primary Or Logical? which is better?? and why?

    hello,
    what is the best way to install linux ( redhat,oracle enterprise ,etc)
    on primary partition or logical partition ? and why?
    i have 3 hd's ( hda,hdb,hdc) >> ( 40 GB,80GB,320GB) IDE
    why im asking this becoz i installed linux more than 3 times lately and i always ended up with GRUB errors and problems
    any idea plz shed some light on this
    need your experience regarding the optimal solution to install linux along with Windows OS
    thanks and regards,

    Hi,
    Q: what is the best way to install Linux ( redhat,oracle enterprise ,etc)
    A: Almost no difference between Redhat and Oracle Enterprise Linux. But Oracle has patched some additional patches for Oracle database based on Redhat released Enterprise Linux. If you would have subscribed Oracle Unbreakable Linux Network(ULN), which make it easier to update the system and deploy Oracle database. For more details refer to http://linux.oracle.com
    Q: On primary partition or logical partition ? and why?
    A: Your boot partition ought to be a primary partition, not a logical partition. So if you want to boot your operating system from the drive you are about to partition, it should be installed on primary partition. Otherwise, you can install it on logical partition.
    Q: why im asking this becoz i installed linux more than 3 times lately and i always ended up with GRUB errors and problems
    A: For this issue, what kind of GRUB error had you experienced? What the result after re-installing the grub?
    Happy new year!
    Terry

  • Which CC do you prefer and why?

    Choices are:
    Built-in CC effects of PR
    SpeedGrade
    RedGiants Magic Bullet
    Synthetic Aperture Color Finesse (requires QT)
    Given the 4 options shown above, what are your preferences and why? I know this is a broad question, but I would be interested to hear your opinions.

    Hmm. I am not sure how to answer. Back when I used CS3 I used Magic Bullet and I had no direct experience with the others at that time.
    Magic Bullet is easier to use, in my opinion, but that is not always going to make it the right choice.

  • RFC and Webservice which one i should use and why?

    Hi,
      I have to write a extractor program in BI which would be fetching a huge data from CRM.
      I have two options to achieve this targer.
               1-> Create a RFC which will give me all the data
               2-> Create a Webservice in CRM and use it in BI
    Please advice me , which way i should go and advantage of that way.
    Regards
    PG

    Hi,
    If amount of data is huge then it is recomnded to use RFC because of its speed and reliability. Webservice not yet proven good for extracting and handling very large chunk of data.
    Regards,
    Gourav Khare

  • Which infrastructure are you using and why?

    Dear Portal Experts,
    I would be most interested in learning which tools portal developers are using in their daily work. I have therefore started a survey at the Collaboration Workspace (actually a discussion - 'survey' was not available).
    I would be happy if the readers of this forum could also participate to collect this information.
    Thanks a lot,
    Björn

    Still kinda debating on the two. I have the 8GB 3G right now and don't fill it up a lot.. but I also have another MP3 player that i keep my music on and don't take a ton of pictures. But I know with the better camera and video recording, I will be using it a lot. I am pre ordering tomorrow, but still undecided. Just don't know that I want to spend an extra $100. I can always transfer my pictures to my computer (or website) if I needed to. Just keep the ones I really want. Videos I will probably keep on my computer for sure. Guess I will go with the 16GB. Still leaves me room for songs (I like to keep around 200 at a time for a variety at work), pictures, apps, and some video.

Maybe you are looking for

  • Audio output question...

    Hello, Hoping someone can help guide me on the most efficent way to deal with the following scenario. I have a late 2008 alum macbook that I am using as my primary home computer. I have a toslink optical out to my DTS decoder stereo receiver so that

  • Could not create user in

    Hi all,   I have installed SAP EP6.0 SP11 upon NW04 SR1 with WebAs 6.40 (both abap and java engines).I'm not able to create any new user in portal.Why is this so.Can anyone help me in this regard. Gopi

  • SQL Developer 1.1 close - no error msg (connect after changed TNS info)

    We installed a new QA database and as a result I had to change the connection credentials. After doing this on a connect, SQL Developer closed without any warning. The following repro steps: 1.) I right click on the connection name and click on Prope

  • Af:tree initiallyExpand nodes

    Hi all, I'm using JDeveloper 11g, ADF RC, and ADF BD. I've implemented my menu, using the af:tree component following two posts of Chris Muir. http://one-size-doesnt-fit-all.blogspot.com/2007/05/back-to-programming-programmatic-adf.html and http://on

  • JFrame calling another JFrame

    Hello, I have a simple question: 2 java files with 2 JFrames in them JFrame1(Cars.java) calls JFrame2(AddCar.java) from actionlistener. What I think is wrong is JFrame1 actionListener: if(ae.getSource() == CarEdit_btn){ AddCar objEditAddCar = new Add