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?

Similar Messages

  • 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
    ¶

  • 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.

  • In plsql which block will execute first inner block or outer block...

    In plsql which block will execute first inner block or outer block...
    pls help...

    Outer block starts execution first.
    Inner block completes the execution first.
    Suresh.

  • Which event will trigger first?

    hi, any one can explain me the execution of at selection screen events in order.
    which event will trigger first at selection-screen output or at selection-screen?

    Hi,
          The Selection screen sequence is-
    1) AT SELECTION-SCREEN OUTPUT
    2)  AT SELECTION-SCREEN ON VALUE REQUEST FOR <FIELD>
    3)  AT SELECTION-SCREEN ON HELP REQUEST FOR <FIELD>
    4)  AT SELECTION-SCREEN ON <SEL_OPT>
    5)  AT SELECTION-SCREEN ON <PARAMETER>
    6)  AT SELECTION-SCREEN ON BLOCK <B1>
    7)  AT SELECTION-SCREEN ON RADIOBUTTON GROUP1<RAD1>
    8)  AT SELECTION-SCREEN
    9)  AT SELECTION-SCREEN ON VALUE REQUEST FOR <SEL_OPT_LOW>
    10) AT SELECTION-SCREEN ON HELP REQUEST FOR <SEL_OPT_LOW>
    11) AT SELECTION-SCREEN ON END OF SEL_OPT
    ***DO REWARD IF USEFULL
    REGARDS,
    VIJAY

  • How long will it take? --OR-- Which order will arrive first?

    *So, let me fill you in on my order timeline (debacle)...*
    • July 5 ... I placed order with AT&T *on the phone* for 2 16GB iPhone 4's with 2 new lines of service. (first time iPhone buyer, new -- actually, coming back -- to ATT after 11 yrs w/ Sprint.)
    • July 7 ... I received and accept the Terms & Conditions agreement... but because of _order entry error_ my order could not be processed.
    • After I make some twitter-gripes I get pinged by AT&T's social media team offering to help.
    • With a couple of exchanges and phone calls, I was assured that my order would be fine -- my order can proceed even with the error/wrong information not needing to be fixed -- and should expect it in 7-14 days.
    • July 12 ... I checked my order status online only to find that there is no record of my order.
    • I called to find out what was up... I explained my story to the AT&T CSR and he took it upon himself to FIX the error/wrong info. _Little did I know that *this action would cancel my previous order and place a new one*, in spite of being assured that my previous order would remain in tact_.
    • July 13 ... my credit card was charged for my order.
    • July 15 ... my order status is available online... it says "processing" and is "backordered."
    • July 19 ... an AT&T social media rep voluntarily calls me to connect me to an order rep... she tells me that I should have been told 7-14 BUSINESS days (which I have no recollection being told that, nor reading that in any documentation), and *given that my order was placed on July 12 (and NOT July 5)*, I "should expect delivery by July 29"! (CSR's words)
    • July 19 ... went to physical ATT Store to place an order for 32GB iPhone4 -- intending to return 1 of the 16GB and pay the difference. _At this point I am running an "experiment" to see which order will arrive first_.
    • July 20 / 9am ... the online order status check shows NO RECORD of my previously existing order -- where'd it go?!!?!?
    • July 20 / 3:30p ... ahhhh... must have been a server glitch b/c I can see my order again.
    • UPDATE: July 22 ... no change for my 2x16GB order... no change on my 32GB order.

    my 32GB order arrived at AT&T Store… went to pick it up but could not walk out of the store with it lest the 2x16GB order get cancelled!!!!
    The super-nice and cool CSR informed me that because I have a pending order tied to the number I am porting over, if I were to activate my new 32GB, then he’d have to cancel the 2x16GB order (as of today, that order is STILL backordered). What’s more, I cannot walk out of the store w/ the device because I paid for the “subsidized” $299 price point for a 2-year contract… and I can’t initiate a 2-year contract with out canceling the 2x16GB order!
    CSR said he’ll hold my device until I receive the 2x16GBs.
    I’m stuck… and so, I wait… again…

  • While executing the application which method will trigger first

    Hi all,
    while executing a webdynpro application which hooker  method will trigger first?

    Hi Naveen,
    The first method called is the WDDOINIT of the component controller.
    For more details on hook method please see the below link.
    http://wiki.sdn.sap.com/wiki/display/WDABAP/HooksMethodsinWebdynprofor+ABAP
    http://help.sap.com/saphelp_tm70/helpdata/en/45/c87f413e70010de10000000a1550b0/frameset.htm
    Thanks
    Pradeep

  • TCP Communication - How can I remove the priority of which VI will run first?

    Hi. I would appreciate for any advise.
    I want to communicate (send data) to another PC using wireless radio. I am presently testing the shipped examples;
    TCP Communicator Active.vi and  TCP Communicator Passive.vi. I will run first the Passive.vi in the other pc (as
    indicated in the instruction) and then Active.vi on this pc.
    I want to remove or neglect the priority of which VI will run at first (either of the VI can run first).
    If in the case either one of the PC is not transmitting data, it will just trigger a LED or any kind of indicator.
    Can anyone helped me to do this? or is there any other example vi that will do it?
    Thanks a lot.

    Hi Mr Christian,
    i decided to use TCP/IP for peer to peer communication. I made an example VI of what i am doing but i cant make it right especially on the "Time out error". I would appreciate for any advise.
    Kindly see the attached VI's. The Crane 1 will be the Master or Server and Crane 2 and 3 are Slaves or Clients. Slaves VI will pass their data to Master while Master will distribute the data to each VI.
    As a rule, i have to run the Master or Server first and Slaves will follow.
    But as soon as i do this i am getting this Time Out error hence data are not being passed. I tried changing the values of time out constant but not lucky so far. I know that if i can fix this time out error, all the VI can communicate properly. I should see three moving cranes on each VI.
    Additional question; If all of the VI are running, and I intentionally Stop for instance Crane 3 (Slave), then it will show an error (LED) that Crane 3 data is not available. So far i can do this.
    But for instance I will run again Crane 3 (Slave), is there a way to RESET the connection programatically so that Master VI will once again accept the Crane 3 VI?
    Any advise I would greatly appreciate.
    Thanks a lot.
    Attachments:
    Crane 1 (Master).vi ‏40 KB
    Crane 2(Slave).vi ‏35 KB
    Crane 3 (Slave).vi ‏35 KB

  • HKCU registry and the start up application which one will ready first

    Hello guys, here is my question. When create a new user in windows8.1, and I write a service to launch my appA to do something.
    and my appA will read the registry at HKCU, but failed! Then I restart appA, read the registry again, it success!  I guess when the new user was created the appA was launched before the HKCU ready. Is it true? 

    Hi Henry,
    It might be a permission issue. Windows services execute under different account which compare with desktop app. They are the following.
    LocalSystem,
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms684190(v=vs.85).aspx
    NetworkService,
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms684272(v=vs.85).aspx
    LocalSerivce,
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms684188(v=vs.85).aspx
    Please add log handler in appA to see the failure in details.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Warranty against period and/or Hrs (which ever will be First)

    Dear All
    Looking for your suggestion...
    I have configured warranty against period (1 yr). which is working smoothly, Now company has a requirement to check the warranty against Hours as well (Eg.1000 hrs). which ever completes first. 1 yr or 1000 hrs of machin usage. how can i do it.
    I had created a Charecterstic CT04 for both of them
    Warranty _Period ( 12 months)
    Warranty _Hours) (1000 Hrs.)
    and maintainted it at Warranty master (BGM1), but when i am assiging this Master warranty to Equipment (IE01), status is negative with an error   " unit of measurement doesnot supported"
    can it be possible through Measuring Point?
    If yes then how can i check it during Service Notification (IW51). Here i want to add a field in ehich i can enter the  machin working hours Lets say 885 hrs, so it can be verify either Period or Hours.
    Usually this is being practises in Automobile companies while giving Free services.
    1st Free service will be valid before 1000 kms, 2nd free service will be free till 5000 kms etc.
    Please help me on this.
    Thanks is advance.
    Sudip Sinha
    Edited by: sudipsinha on Oct 18, 2011 10:59 AM

    In theory, CS1 should be treated as higher than AF11.  AF11 would be closer to CS1.  That being said, your QoS policies can be configured to do whatever you want so your switch may be configured to drop CS1 way before it drops AF11.

  • The Pricing thread will start again... CS3 - CS4

    I just looked in the Adobe Store... In holland: upgrade CS4 Standard: 712,- (= 1048 dollar) In US upgrade 499 dollar (= 338) There is a difference... And is the CS4 upgrade really worth it? It has some nice features, but I will never use flash in Indesign, so why do I have to pay for those functions.

    I run a small business and would really like to see what business ethics Adobe are using apart from those detailed in that well known business guide "How To Screw Your Loyal Customers for Dummies"?
    As a loyal Adobe user since 1990 and someonce who has worked in the print and graphics industry and been responsible for moving many clients and users over to Adobe products from rival products I now need some help in return.
    Adobe, please tell me that I can't do basic maths. Do the simple sum below and tell me if you think the answer is correct, if so I'm sure all the users on this forum will chip in and buy the pricing team at Adobe a calculator as I think they could do with a new one...
    Creative Suite 3 Design Suite Premium purchased 4 months ago £1350.08
    Upgrade charge to CS4 Design Suite Premium now released £605.12
    Total Cost to get to CS4 Design Suite by loyal user £1955.20
    or
    First time buyer of full CS3 Design Suite Premium £1467.58
    so it costs us £487.62 MORE to upgrade our copy of CS3 than it does to buy a brand new copy of CS4
    Also why does it cost me £1511.29 to download the full version using my broadband connection at my cost and with no materials requierd from Adobe but only cost me £1467.68 if I want to buy a full boxed version and have it shipped to me here in the UK.
    I can only hope that the companies that supply the materials to Adobe will show them the error of their ways and start charging more per unit if they order higher volumes instead of giving them better prices for higher volumes, maybe Adobe would consider that an offer not to be missed!
    Oh and if anyone knows the team from Adobe that handles the "Localization" for the UK could I remind them that we don't use US SWOP Coated as a standard for four-colour printing in Europe, we don't want to spell check with American dictionaries by default and we sure as hell don't spell COLOUR without the U or GREY with an A. If you're going to tell us that you're charging to produce the local versions then please supply the goods as promised!
    You can be sure that a very similar email to this post is currently winging it's merry way to the Customer Relations team at Adobe - I'll let you all know if I ever get a reply...
    Regards
    Jason Hicking
    Director
    Replica Imaging Limited
    Derbyshire UK

  • Node manager or the Admin server - which one to start first?

    Hi Experts,
    Somewhere i see its this way.
    OBIEE 11.1.1.6 | OBIEE
    To start the Oracle Business Intelligence system, you start:
    the Node Manager(It is by default windows service in Enterprise Installation of OBIEE 11G)
    the Administration Server (It is weblogic Admin Server)
    the Managed Servers(Comes with Enterprise Installation of OBIEE 11G)
    and then you start the system components.(All OBIEE Components : BI Server,Presentation Server,Schedular,Java Host,Cluster Services.
    and at other places i see this...
    OBIEE 11G - Starting Oracle Business Intelligence | GerardNico.com (BI, OBIEE, OWB, DataWarehouse)
    To start the Oracle Business Intelligence system, you start:
    the Administration Server
    the Node Manager
    the Managed Servers,
    and then you start the system components.
    I have Linux environment and it has just single BI Server and i go like this.
    1) startWeblogic.sh script
    2) startNodeManager.sh
    3) startManagedWeblogic.sh
    4) then system components.
    Thanks
    Ashish

    so the way i am starting OBIEE Services currently is basically wrong ie..
    1) startWeblogic.sh script
    2) startNodeManager.sh
    3) startManagedWeblogic.sh
    4) then system components.
    ( by the way everything  comes up perfect even if i start the nodemanager after the startWeblogic.sh script)
    and i should do it this way..
    1)startNodeManager.sh
    2)startWeblogic.sh script
    3)startManagedWeblogic.sh
    4) then system components.
    Kindly confirm...

  • Applet UpCall from JS Event - Which Thread? Options

    Hi,
    With many direct references to the second lovely colour diagram on this
    page: -
    http://java.sun.com/javase/6/docs/technotes/guides/jweb/applet/applet...
    I completely understand the hour-glass pause on the single-JS-thread
    preservation architecture when the red arrow for the additional
    "applet-spawned" thread tries to call down when the applet worker thread is
    already calling down. Very clever; love it! Well done all involved.
    What I'd like to know : -
    1) When the additional applet-spawned thread calls down into Javascript and
    that JS calls setTimeout(myFunc,1000) and myFunc eventually [up]Calls back
    into the Applet, which thread will host the call to the applet method?
    Default-Worker or Applet-Spawned? Is the tenuous link/association to a
    round(ish)-trip preserved?
    2) What happens when a single JAVA thread is the target of affection from
    multiple Javascript UpCalls? (The scenario being a) an event upCalls to JAVA
    b) The Applet takes some time before returning c) The single Javascript
    thread is now free to accept further events or down-calls d) a subsequent
    event has triggered another UpCall request e) but the thread is
    busy/occupied with the first)
    I am desperately trying to pin down architected behaviour here that is the
    reciprocal of the down-call throttling. Please help if you can.
    Cheers Richard Maher

    Hi Baftos,
    Thanks for your reply and help. Yes, anecdotally, UpCalls back to the Applet are handled by the thread that called down to Javascript. (As advertised and documented in the Round-Trip scenario). And the good news is that events that call back into the Applet (regardless of provenance) are handled by the appropriate "Applet N LiveConnect Worker Thread". So if you want to callback to the Applet Worker Thread then just setTimeout(yourFunc,0) rather than just yourFunc().
    This is expected/wished-for behavior and it would be nice to see it documented somewhere? (The event-processing-thread" bit)
    Now, if someone can answer part 2 of my question then that would be magnificent!
    "> 1 Javascript UpCall" and "only one target Thread"
    Cheers Richard Maher

  • Hi Dude,     I ve seen all the threads from first to last even am gonna geta iphone 4s from Thailand. Would like to know which sim will be working fine in chennai as you all are using d phone for past many days???  Is it advisable to buy a phone

    Hi Dude,
    I ve seen all the threads from first to last even am gonna get a iphone 4s from Thailand. Would like to know which sim will be working fine in chennai as you all are using d phone for past many days???  Is it advisable to buy a phone from abroad.

    Thanks for that. Much more constructive than the last comment. It's only the restriction code I can't recall, not the access passcode. So I can currently access the device, just not age restricted content. Does that's make a difference? I also wondered if anyone knew how many attempts you get to try to get it right. Now tried 21 times and so far nothing bad has happened but I am concerned I'll eventually be completely locked out of the device. That doesn't seem in the spirit of things though. Surely it's foreseeable that a child could repeatedly try to guess the code so I can't see that it would be right to lock the device down completely in that circumstance, particularly if the access code is being typed in correctly every time.
    Thanks

  • Which will execute first in File Adapter (parameter,Identifier,module)

    Hi,
    I have written a module for my sender file adapter, and choose FCC to parase my complex structure...here my doubt is whether adapter module will call first or FCC which is there in Identifier tab in file adapter?
    Regards,
    Irshad.

    Chandras sekhar,
    i have already seen that blog...
    could you plz read my message once again?
    Regards,
    Mansoor
    ya i got it..Call sap adapter module will store the message in send queue.
    just want to know which module is building the xi header whether it is same call sap adapter module or is there any specific module which will convert native message to xi message.
    Is call sap adapter module is the responsible for building the xi message header with the help of cpa lookup? if its so again confuse for me.....
    In File adapter we have 3 tabs one is parameter identifier and module...As u said first parameter tab will run as per FCC/ File message protocol then this parsed/content of text file will be input to the module tab .in this module tab we have custom modules and standard module these modules are executed in the same sequence as mentioned.
    what is the module name which converts native message to xi message?
    Regards,
    Mansoor

Maybe you are looking for

  • Program RFFOAVIS_FPAYM: No records selected (F0073)

    hi everyone im having a nasty issue when trying to output payment advices no matter what usual way i try, i get the following message: F0073 Program RFFOAVIS_FPAYM: No records selected im using RFFOAVIS_FPAYM as print program, which is standard - not

  • Window iphoto to big: no access to upload button and bug

    Hi, I have a problem with my iphoto window upload: she is to big since 2 weeks...I suppose that i'have touched something...I cannot have access to the lower right corner. For example:if i'm on facebook and want to upload some photos, the iphoto windo

  • BBM v. 7.1.0.1.23 pls help me

    im hernando crisostomo after upgrade my BBM to the latest version 7.1.0.1.23. my BBM is not working the sreec is all blue. my BBMis not working two day OMG.my BlackBerry is 9220. plss help me i ned my BBM back plss.... send me in my email [email prot

  • Quicktime files offline - When re-linked, they are out of sync.

    Opened a project and some Quicktime files were offline. When I re-linked media, shots were out of sync. Is this because Quicktimes dont use time code? Is there a way to avoid this. Any help much appreciated.

  • Weird Memory behavior on a Quad G5 8 GB, --- memory limited to 6 GB

    Hello I am using Kontakt 2 standalone that I load 3 times with 3 different banks (Strings, Winds, Brass) I cannot use more than 6 GB of Memory ( see figures after) Figures ar given by "Activity monitor" When I load String, brass and winds in that ord