About the execution order

I have a question about the execution order of the program, which bothers me for a long time.
If anybody knows how to resolve it, please help me and thanks a lot.
The code is very simple and as follows in class ExecutionOrder.
I would like the output is:
Thread is going to start!
Thread is running!
Thread is ended!
But actually the output is always:
Thread is going to start!
Thread is ended!
Thread is running!
public class ExecutionOrder extends Thread 
    private static ExecutionOrder mainThread;
    public static void main (String[] args)
        mainThread = new ExecutionOrder ();
        mainThread.test();   
    public void test (){
        testStart();      
        mainThread.start();      
        testEnd ();
    public void testStart (){
      System.out.println ("Thread is going to start!");
    public void testEnd (){
      System.out.println ("Thread is ended!");
    public void run ()
        System.out.println ("Thread is running!"); 
  

Resources for learning about threads:
Java's Thread Tutorial
JavaWorld: Introduction to Java threads
IBM: Introduction to Java threads
Google: java+threads+tutorial

Similar Messages

  • A question about the execution order of java code

    I have a question about the order of the execution of java code.
    class myclass
    String str1 = new String("str1");
    static String str2 = new String("str2");
    static
    String str3 = new String("str3");
    myclass( )
    String str4 = new String("str4");
    static myfuntion()
    String str5 = new String("str5");
    When I new a myclass object, what is the order of execution about str1,str2.str3 ,str4?
    When I run myclass::myfunction( ) instead of new a myclass object what is the execution order about str1, str2, str3, str4, str5?
    Thanks

    hello,
    I think there may be one thing can't use println to make sure.
    class myclass
    static {  System.out.println("str1");   };
    myclass() { System.out.println("str2"); }
    then str1 appear before str2
    class myclass
    static {  String str1 = new String("str1"); };
    myclass() { String str2 = new String("str2"); }
    then
    str1 initilized before str2,
    str1 get the value str1----->after<----- str2.
    Am I right or wrong?

  • How to change the execution order of data control and backingbeans

    Hi,
    I have a form for a BPM human workflow. It has an inputText and a selectOneChoice component in the form.
    The list of value for the selectOneChoice is initiated based on the value in the inputText.
    I have a data control - JavaBean, which returns a list of values based on a parameter for the selectOneChoice and the parameter is binded with the value of inputText defined in a backingBean. I also set the default value of the inputBox in the backing bean with setValue().
    The problem I have is that the data control for selectOneChoice is loaded before the inputText or backingBean is loaded. Therefore, the parameter is null.
    I tested the same combination in an ADF web app and it works fine. In the app, the inputText and the backingBean are loaded first and then the value of inputText is sent to the data control.
    How can I change the order of the execution? I need to make the inputText and backingBean loading first before the data control for the list of values loading.
    Edited by: user626218 on Oct 10, 2012 9:25 PM

    Hi,
    The inputText is pre-populated based on the user profile in the BPM instance. I tried to render the selectOneChoice if the value of the inputText exists but the data control for selectOneChoice is loaded before the backingBean so it keeps getting a null as parameter.

  • Yet ANOTHER question about the Pre-Order

    When the IPAD came out, I selected the pre-order pick up at store option. With the IPAD, the policy was to get there before 3:00 or your reserved IPAD would be released to the anyone who wasn't pre-ordered. Does anyone know if this time is the same for the new IPhone?

    the confirmation email for the iphone said you had until the store closed on the 24th to pick it up or your reservation would be canceled and you would need to setup a new reservation.

  • How to determine the execution order of event structure

    Hi everyone,
    I have an event structure were it contains four events. All the four events has separate buttons to execute. Here, three events will generate numeric output, remaining one event (Finder) should find the order of those three events. For example, Three events namely A, B and C. I execute the events in the order of B, C and A. The finder event should find the order of previously executed events(B, C and A). 
    Thanks in advance.
    Solved!
    Go to Solution.

    Hello Vij@y,
    I could not look in to your VI because I dont have LabVIEW 2013 (I have 2010) but i tried to understand the situation you are explaining.
    Please find attached image of front panel I made for your reference.
    Here I generated two events sequently, no 3 first followed by no 1 and the same is displayed in sequence array. now you can use the build array function to actually add each event to this array as explained by many people in this forum.
    regarding the timeout event, either you can display the sequencer array in that event or you can display it in finder event and then you can reset the sequencer in finder event (I used reset button click event to reset sequencer back to zero value)
    regarding getting zero when you press finder/reset button before triggring any other event:- Is it not correct to have empty array when you have not trigger any event?
    I hope I put it well and may help you to find solution. 
    With Regards
    Miraz
    Kudos is better option to thank somebody on this forum
    Attachments:
    Sequence.png ‏70 KB

  • Filter & init(), execution order....

    I just started my Java servlet adventure, here are my questions
    1) If I have a filter set up in my web.xml and also have code written in my servlet init() method (which is assoicated with the filter), would the filter program be called to do whatever it's supposed to do first? or the init() would still have to finish what it has to do first and then follow by the filter program?
    2) If the filter is being called first, would servlet require the filter program to finish the whole operation before it returns to the init()?
    3) Is there any documentation about the execution order of a servlet program (especially when it's related to the web.xml file)?
    Many thx.
    I understand I could write some programs to find out but I would need some java experts to prove that (even if I write the programs). So I thought I would just ask here anyway.

    I just started my Java servlet adventure, here are my
    questions
    1) If I have a filter set up in my web.xml and also
    have code written in my servlet init() method (which
    is assoicated with the filter), would the filter
    program be called to do whatever it's supposed to do
    first? or the init() would still have to finish what
    it has to do first and then follow by the filter
    program?Specifications: "The init method must complete successfully before the servlet can receive any requests. "
    2) If the filter is being called first, would servlet
    require the filter program to finish the whole
    operation before it returns to the init()?Specifications: "The servlet container calls the init method exactly once after instantiating the servlet. " So I do not understand what you mean by "before it returns to the init()". If it is not the answer you expect, please redefine the question.
    3) Is there any documentation about the execution
    order of a servlet program (especially when it's
    related to the web.xml file)? google for servlet lifecycle.
    The order of the filters' execution is the one specified in web.xml.

  • Execution order of Multiple Numeric Limit Test?

    What is the execution order of "Multiple Numeric Limit Test" in TestStand 2010?
    I am using a custom steptype of Multiple Numeric Limit Test. I want to manipulate the input parameter. How can I do that. I am not interested in making a new steptype. I am writing in Post-Expressions and the data is manipulated as they should but it is not evaluated. I is evaluated before the Post-Expressions executes.
    For example I am writing: Step.NumericArray[0]= Step.NumericArray[0]*1000/(2.5-Step.NumericArray[0])
    The execution order when looking at the TS manual at page 3-13 is Evaluate Post-Expression before Evaluate Status expression. But it is not what I see. I have also tryed using the more simple Numeric Limit Test and it works as I expect it to according the manual.
    Anyone knows about any workaround for that?

    Hi Ray
    Thanks for your reply
    I have tried writing what you are suggesting: Step.Result.Measurement[0].Data= Step.Result.Measurement[0].Data*1000/(2.5-Step.Result.Measurement[0].Data)
    Still it evaluates the step before the post-Expression. When I am looking at the variables at runtime the Step.Result.Measurement[0].Data is having the correct value but it seems to evaluate the step before the Post-Expressions.
    Any other suggestions?

  • What is the evaluation order of Page Items

    I just wonder what the execution order of page item assignments are in the page rendering process.
    Sequence (+ Region), Type of items, more clever by checking dependencies ??
    I couldn't find anything here, or looked with the wrong keywords.
    I just need to know, what reliable assumption to make about dependencies amongst page items?
    Is that visible in the APEX code? A pointer to that would be OK.
    Many thanks
    Thomas

    fac586 wrote:
    What do you mean by "assignments"?The "Source" ("Source value or expression" in combination with the "Source Type") on the Page Item [Application Express 4.1.0.00.32]
    fac586 wrote:
    Items are rendered in order of region position/region sequence/item sequence. Item values will be evaluated in this order, but may also be set by computations or processes which run in order of processing point/computation sequence/process sequence.
    You can view page components in event order in the App Builder by selecting the Utilities > Page Events view in the page definition, and the actual sequence of runtime events in the debug trace.That was exactly what I was thinking, but that is not the case as far as I can tell. The order which is shown "*Utilities > Page Events*" seems to be the display order, but not necessarily the evaluation order in order to obtain the values.
    I have a database field that is shown much further down in this sequence, but I have a dependent field that is calculated based on this value and is shown before in that sequence.
    So I was wondering whether there is an implied order - possibly based on the Source Type of the page item.
    And to answer the question. There are no other computations or processes ... other than the associated "Automated Row Fetch" related to the database column used in the page items on the page.

  • Question about the sequence structure

    Hi,
    If we want to get best performance when programming a sequence of functions or calculations, we should choose 'Stacked sequence structure' or 'Flat sequence structure'? or they have the same performance?
    Thanks.

    To the best of my knowlege there is no performance hit, the "Flat sequence structure" was a fairly recent addition to try and overcome one (of many) complaints about sequence structures in general, that stacked sequences obscure what is happening in the code. If the various sections of your calculation or functions have data dependency, i.e. the output of a calculation is fed into the subsequent calculation or function, then a sequence structure is probably not needed as, with data flow, the calculation that is "dependent" won't executed until all its inputs requirements are satified. If the "functions" are in the form of sub-vi's the method that is more "proper" is to inforce a dependency between subsequent vi's. This can be as simple as adding error in and out controls to the sub-vi's, even if they are only passed through the vi without actually performing an error function. This allows you to wire them together in the execution order that is required. Doing this on some of the early "built-in" functions that have remained in LabVIEW (the original timer functions) sometime requires putting a wrapper around them to make them sub-vi's with error passing, but in the latest versions of LabVIEW the compiler seems to do a good job of minimizing any performance hits this might appear to cause.
    Putnam Monroe
    LabVIEW Evangelist since 1992
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Dashboard Prompt Execution Order

    Hi everyone,
    I wanted to create a few test cases to see which order the Dashboard prompts were executing. What I did was I created two identical dashboard prompts, DBP1 and DBP2, on column "Account Number". I set DBP1 to Default to Specific value of 1. I set DBP2 to Default to Specific value of 2. My assumption is that the last prompt that executes is the value that will be shown in a dashboard.
    I put the two prompts into a Dashboard and ran a few tests and here is what I found out:
    1. The order in which the prompts appear are the dashboard is irrelevant to the execution order.
    2. The value to which the prompts are set to is irrelevant to the execution order
    3. The name of the dashboard prompts is irrelevant to the execution order
    4. The alias of the dashboard prmopt is irrelevant to the execution order
    In my trials, the second dashboard prompt's value was always the one being shown. So I created a third dashboard prompt DBP3 set to value 3. Then all the prompts had 3 as their value. My conclusion is that DB prompts are executed in the order in which they are created. Some where in their metadata, there must be a sequence number or internal ID that grows each time a DB prompt is created. Then OBIEE uses this identifier to determine execution order.
    Can anyone confirm or deny that?
    Thanks!
    -Joe
    Edited by: Joe Bertram on Dec 5, 2009 10:44 AM

    Hi Sunil,
    Thanks for the reply. You are correct. Its seems that the dashboard prompts do execute asynchronously.
    It turns out the reason why I was seeing newer dashboard prompts taking precendent over older dashboard prompts has to do with the cache. Apparently the last dashboard prompt in the cache, is the value all the prompts will have.
    thanks!
    -Joe

  • What's the best order for mac os x?

    Hello, i was wandering about the best order for the RAM clips (when they're different in size, of course).
    Should i place my little one clip in the lower slot and my big one clip in the upper slot, or the opposite, ...or did mac os x worth about it for the performances to be better?
    Thanks for your comments.

    The slots are very specific about the kind of RAM they can accept. If you simply bought RAM based on the generic spec, you may have bought the wrong RAM. Be sure to buy from a vendor that is specific about your Mac model when asking for RAM. http://www.crucial.com/ has a much better handle than most in giving you the right RAM. The height of the module may affect clearance or heat or bus slewing issues with the logicboard, so be sure to put only the height that was already in the computer. If uncertain, find better instructions that show you. See my FAQ*:
    http://www.macmaps.com/badram.html
    Mac OS X performance is best when you install exactly according to manufacturer spec, and not from some generic spec.
    - * Links to my pages may give me compensation.

  • [SOLVED] Netctl script execution order?

    The man pages are bit ambiguous, but this is what I'd like to know:
    Given I'm connecting to wireless network "MyESSID" on interface "wlan0", what is the execution order of these scripts:
    /etc/netctl/hooks/*
    /etc/netctl/interfaces/wlan0
    /etc/netctl/wlan0-MyESSID (ExecUpPost)
    Given I'm disconnecting from the same interface/essid, what is the execution order again:
    /etc/netctl/hooks/*
    /etc/netctl/interfaces/wlan0
    /etc/netctl/wlan0-MyESSID (ExecDownPre)
    Some of my wireless networks need proxies, and others don't.
    I'd like to start/stop Dropbox on connect/disconnect of any network (but only after the proxies are set)
    Thanks in advance!
    Last edited by sxtynnmach1 (2013-07-27 05:38:39)

    Added the feature request to the netctl github page.
    Since the hooks/interface scripts are sourced instead of passed to a subshell, they have access to previously-defined variables. At the time of this writing, when netctl sources it's hooks and interface scripts the following are already available in the environment:
    $interface (ex: wlan0)
    $profile (ex: wlan0-essid)
    $action (ex: CONNECT, see wpa_actiond --help)
    $ssid
    Following the convention of prepending two-digit numbers to my scripts to enforce execution order, I have gotten pretty fine-grained control over my scripts and netctl actions
    /etc/netctl/hooks/10-proxy.sh
    #!/bin/sh
    if [ "$profile" = "wlan0-companyESSID" ]
    then
    case "$action" in
    "CONNECT"|"REESTABLISHED")
    export http_proxy="http://proxy.company.com:8080"
    unset http_proxy
    esac
    fi

  • Query: Module Execution Order

    Hi Experts,
           I've a query on the execution order of module execution. Say my requirement is File (with FCC) to File (with FCC) and I need to write a module at both sender and receiver end due to some business requirement. My questions are
    1. On the sender side, does sender adapter User defined module gets executed before the sender Standard adapter module? If so, what would be the format of data available to the user  defined module (XML data after file content conversion) ??
    2. Similar query, but for the receiver channel (receiver adapter modules execution order).
    Please explain the nature and order of execution of the adapter modules and the format of data available to the User Defined Modules.
    Thanks,
    Hussain.

    Hi Hussain,
    So, does that mean the input data to sender custom module is of Text format ie. the whole text file in text format (not in XML format) ? - Yes
    Also, can the order of the modules be changed i.e Can custom module be specified and executed later Standard module?? I suppose No but still wanted a confirmation. - Only in synch communication, when you have sender comm channel, there if you have a reciver custom module, then in sender comm channel in module tab, it will be specified after standard module..............But for asnych communication, where you will have a reicever comm channel, there you will specify your custom module before standard module.
    Hi Prateek,
    I think that the input to the custom module would be xml created after content conversion. - No, the file will be input as plain text file and in your custom module you will create a XML document for your sender msg.........Similar is the case when you have a excelsheet file as input, in it you have your excel file data as input and you create a XML document in your custom module.
    Regards,
    Rajeev Gupta

  • About the pricing procedure of purchasing order

    Hello friends,
    can anyone tell me about the pricing procedure,conditions & texation of Purchase order?
    and hoew to maintain all those term in Customisation?

    The Basic thing is Condition Technique. In which there are 
    1. Access Sequence 2. Condition Record 3. Condition Type 4. Condition Table. 
    A Access Sequence access a Condition Record of a Condition Type in a Condition Table is a  Condition Technique.This is a simple logic 
    Here the Condition Type is very important like PB00, PBXX,RA01 etc. 
    In the background every Condition Type has its own defition means the purpose of the Condition Type  like, is it for Pricing or Percentage, Quntity base, Accrual Feilds etc is to be defined to work this functions.  Normally we use the existing ones without any risk. But some cases, we have to Create a New Condition Types as per the organisation requirement. 
    The Pricing Schema is useful to minimise condition types while mention prices for Vendor on the basis of Pricing Schema which we defined according to organisation requirement. 
    The Pricing Schema means the calculations procedure of Condition Type. 
    Ex.  RA01 - Discoount % is caclulated on PB00 - Gross Price  means 
    RA01 is based on PB00  like that we have to define in the Pricing Schema 
    which makes easy to use in real time. 
    Here PB00 has the Access Sequence - 0002. 
    But RA01 does not have the Access Sequence.Why because it is a dependent on PB00. But both are Condition Types. 
    In the system, by default some standard  Scheme will be there at Vendor Schema Group in the Vendor Master Screen means the standard one is assigned which is very lengthy which may fullfil our requirement. But some cases which may not fullfil our requirement, in such we have to define. 
    For the configuration, I may not able to explain properly through here but will give some idea. 
    Configuration: SPRO - IMG - Material Management - Purchasing - Conditions - Define Price Deternmination Process:
    1. Define Access Sequence 
    2. Define Condition Type 
    3. Defince Calculation Schema:- Here you have to define the Schema - Define Schema group 
    1. Define Schema Group vendor 
    2. Define Pricing Schema group 
    3.  Schema group for Purchase Organisation 
    4. Assign Schema group to Purchase Organisation - Define Schema determination 
    1.define calculation schema for Standard purchase organisation 
    After completion of the Schema Group, we have to assign it to Vendors. 
    Then whenever we use any transaction with this Vendor, the concerned  Schema will work as configured by us. 
    The Pricing in MM is vast because each Condition have its own importance and each Access Sequence have its own importance. So you need not bother about this. First you learn how to define the Calculation Schema through the above.

  • I am using the Order Analysis Toolkit and want to get more information about the compensation for "Reference Signal Processing", which is scarce in the manuals, the website and the examples installed with the toolkit.

    I am using the Order Analysis Toolkit and want to get more information about the compensation for "Reference Signal Processing", which is scarce in the manuals, the website and the examples installed with the toolkit.
    In particular, I am analyzing the example "Even Angle Reference Signal Processing (Digital Tacho, DAQmx).vi", whose documentation I am reproducing in the following:
    <B>DESCRIPTIONS</B>:
    This VI demonstrates how to extract even angle reference signals and remove the slow-roll errors. It uses DAQmx VIs to acquire sound or vibration signals and a digital tachometer signal. This VI includes a two-step process: acquire data at low rotational speed to extract even angle reference; use the even angle reference to remove the errors in the vibration signal acquired at normal operation.
    <B>INSTRUCTIONS</B>:
    1. Run the VI.
    2. On the <B>DAQ Configurations</B> tab, specify the <B>sample rate</B>, <B>samples per channel</B>, device and channel configurations, and tachometer channel information.
    <B>NOTE</B>: You need to use DSA PXI-447x/PXI-446x and PXI TIO device in a PXI chassis to run this example. The DSA device must be in slot 2 of the PXI chassis.
    3. Switch to <B>Extract Even Angle Reference</B> tab. Specify the <B>number of samples to acquire</B> and the <B># of revs in reference</B> which determines the number of samples in even angle reference. Click <B>Start</B> to take a one-shot data acquisition of the vibration and tachometer signals. After the acquisition, you can see the extracted even angle references in <B>Even Angle Reference</B>.
    4. Switch to the <B>Remove Slow-roll Errors</B> tab. Click <B>Start</B> to acquire data continuously and view the compensate results. Click <B>Stop</B> in this tab to stop the acquisition.
    <B>ORDER ANALYSIS VIs USED IN THIS EXAMPLE</B>:
    1. SVL Scale Voltage to EU.vi
    2. OAT Digital Tacho Process.vi
    3. OAT Get Even Angle Reference.vi
    4. OAT Convert to Even Angle Signal.vi
    5. OAT Compensate Even Angle Signal.vi
    My question is: How is the synchronization produced at the time of the compensation ? How is it possible to eliminate the errors in a synchronized fashion with respect to the surface of the shaft bearing in mind that I am acquired data at a low rotation speed in order to get the "even angle reference" and then I use it to remove the errors in the vibration signal acquired at normal operation. In this application both operations are made in different acquisitions, therefore the reference of the correction signal is lost. Is it simply compensated without synchronizing ?
    Our application is based on FPGA and we need to clarity those aspects before implementing the procedure.
    Solved!
    Go to Solution.

    Hi CracKatoA.
    Take a look at the link bellow:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=255126&requireLogin=False
    Regards,
    Filipe Silva

Maybe you are looking for

  • ITunes 6.0.1.3 Sharing Problem

    I am having some trouble viewing shared music through iTunes. I have the "look for shared music" box checked. If I choose to share my library, others can see it; however I cannot see theirs. I can however view shared Limewire Tunes though. Any idea a

  • Using YTD in BEx

    Hi, Fairly new to BEx. I'm trying to create a query that has the columns of Total and YTD and rows that show the past 3 years. My Total is being pulled directly from my multiprovider--so no issues. My YTD column is a restriction of this Total field,

  • Copying goals/objectives from appraisal documnt : FM not working...

    I have a requirement in which all the "Goals/Objectives" from the previous years appraisal documents are to be copied to the newly created appraisal documents for the current year. I take the details of the previous years appraisal document using "HR

  • For mobile

    isn't there any app that increases the firefox running device ram using memory card ? free and paid app will work . but go fro free

  • Unable to connect laptop using wireless Linksys router SES 36576

    I have a Linksys wireless router (SES 36576) and a new HP laptop (Vista OS). Using my old laptop running XP, I was able to connect wirelessly. Linksys indicates that my signal is EXCELLENT; however, when I input the security key and it searches for t