Wait for commit to finish

Hello,
I am calling a standard function that update some tables and at the end execute a commit work without the wait clause, but right after the execution of the standard function I need to perform some operations that needs all the tables to be updated, so unfortunatelly I needed commit work and wait inside the standard function.
As I cannot change the standard function I tried to use table VBHDR to check when the update process finish but I noticed in my system this table is not trustfull as there are lots of garbage there with field VBRC = 1.
So my question is how can I wait for the commit work to finish in this situation?
Regards,
Mauricio

well this a random approach but u can try this.
use WAIT UP TO n seconds give the vales as some 120 or 180 seconds.
but u cant be sure if its stable all the time.
Or u can try and call the function with the addition IN UPDATE TASK
кu03B1ятu03B9к
Edited by: kartik tarla on Jan 5, 2009 6:41 PM

Similar Messages

  • 10g: Cube  build performance:Waiting for tasks to finish

    I had a question related to cube build performance. We see the following in the OLAPSYS.XML_LOAD_LOG prior to completion of parallel processing. So basically the loading of records etc. happens in 2-3 mins but then the part for "running jobs and started 6 finished 5 out of 6 tasks takes almost 30-40 minutes to complete". At this point in background it invokes the xmlloader and xml_parallel_loader. Any insights as to what specifically this steps do (solving of measures etc.) ? Also what we need to modify in terms of xml tag or anything else to improve these timings?
    14:10:56 Started 6 Finished 5 out of 6 Tasks.
    14:10:56 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:01:04 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:01:04 Finished Load of Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition. Processed 189616 Records. Rejected 0 Records.
    Thanks,
    Sudip

    When we checked the scheduler jobs we saw xmlparallel_loader. in terms of v$session_wait we saw a db file sequential read. Following is a snapshot from the stage of finished updating partitions to starting of parallel load. Please advise.
    XML_MESSAGE
    14:49:12 Completed Build(Refresh) of AWM_CR2.CRICUBE Analytic Workspace.
    14:49:12 Finished Parallel Processing.
    14:49:10 Finished Auto Solve for Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:40:59 Started 6 Finished 5 out of 6 Tasks.
    14:40:59 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:30:58 Started 6 Finished 5 out of 6 Tasks.
    14:30:58 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:20:57 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:20:57 Started 6 Finished 5 out of 6 Tasks.
    14:10:56 Running Jobs: AWXML$_4361_77872. Waiting for Tasks to Finish...
    14:10:56 Started 6 Finished 5 out of 6 Tasks.
    14:01:04 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:01:04 Finished Load of Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition. Processed 189616 Records. Rejected 0 Records.
    14:01:02 Finished Auto Solve for Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition.
    14:01:00 Finished Load of Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition. Processed 1494 Records. Rejected 0 Records.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition.
    14:01:00 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition.
    14:01:00 Finished Auto Solve for Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition. Processed 1494 Records. Rejected 0 Records.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition. Processed 1577 Records. Rejected 0 Records.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition. Processed 4521 Records. Rejected 0 Records.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_OSUC.CUBE. 200901 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_CURR1_FIN.CUBE. 200901 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition.
    14:00:58 Finished Load of Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition. Processed 1577 Records. Rejected 0 Records.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_CURR1_ENR.CUBE. 200901 Partition.
    14:00:58 Started Auto Solve for Measures: TOT_AMT from Cube CR_BASE_ENR.CUBE. 2008 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_BASE_FIN.CUBE. 2008 Partition.
    14:00:58 Started Load of Measures: TOT_AMT from Cube CR_BASE_OSUC.CUBE. 2008 Partition.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:57 Attached AW AWM_CR2.CRICUBE in MULTI Mode.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873.
    14:00:55 Started 4 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873, AWXML$_4361_77874.
    14:00:55 Started 6 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873, AWXML$_4361_77874, AWXML$_4361_77875.
    14:00:55 Started 6 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872, AWXML$_4361_77873, AWXML$_4361_77874, AWXML$_4361_77875. Waiting for Tasks to Finish...
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871, AWXML$_4361_77872.
    14:00:55 Started 3 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870, AWXML$_4361_77871.
    14:00:55 Started 2 Finished 0 out of 6 Tasks.
    14:00:55 Running Jobs: AWXML$_4361_77870.
    14:00:55 Started 1 Finished 0 out of 6 Tasks.
    14:00:55 Starting Parallel Processing.
    14:00:55 Detached AW AWM_CR2.CRICUBE.
    14:00:55 Started 5 Finished 0 out of 6 Tasks.
    14:00:22 Finished Updating Partitions.

  • NI Scope Wait for Acquisition to Finish Obselete in 2014

    Quick Question,
    In LabVIEW 2014, the NI scope Wait for Acquisition to Finish subVI is no longer used and is obsolete apparently, can some one tell me why this is and what I can use instead with the new 2014 NI scope blocks? 
    Thanks for your help!

    Query Acquisition Status until Status is "Complete"  To avoid infiate loops (missing trigger event) you should set a Timeout for the loop
    Alternately use hardwae and rout the End of Acquisition event to something
    Jeff

  • Update of jlabel does not happen when i wait for thread to finish (join())

    gurus please help.
    I have a main application which in actionevent calls a thread, that thread calls parent method to update ths status in jlabel, but when i use thread.join() to wait for process to complete, the jlabel does not get updated, please tell me how can i update the jlabel, i have to wait for thread to finish and during run i need to update the jlabel.
    thanks

    hi camickr and gurus:
    here is the code:
    notice after pressing the Process button, the label is being updated but its not working. I called the processnow() method directly and also by thread, but in thread I have to wait until it finishes using join() but still does not work, please help. Thanks
    package label;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.text.*;
    import javax.swing.border.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    public class thePanel extends JDialog {
      private DefaultTableModel tableModel = null;
      private JTable theTable = new JTable();
      private JScrollPane scrollPane = new JScrollPane();
    JPanel tPanel = new JPanel();
      private Border mainBorder;
      private BorderLayout borderLayout1 = new BorderLayout();
      private BorderLayout borderLayout2 = new BorderLayout();
      private BorderLayout borderLayout3 = new BorderLayout();
      private BorderLayout borderLayout4 = new BorderLayout();
      private JPanel statusPanel = new JPanel();
      private JPanel buttonPanel = new JPanel();
      private JPanel lowerPanel = new JPanel();
      private JLabel statusBar = new JLabel();
      private JButton processButton = new JButton("Process");
      public JButton closeButton = new JButton("Close");
      boolean image = true;
      theProcess processThread;
      Vector tableData = new Vector();
      ImageIcon Image = new ImageIcon("image.gif");
      ImageIcon oImage= new ImageIcon("oimage.gif");
      boolean errorOcurred=false;
      String statusMessage;
      public thePanel() {
        try {
         jbInit();
        } catch(Exception e) {
          e.printStackTrace();
      private void jbInit() throws Exception {
        tPanel.setPreferredSize(new Dimension(800,424));
        mainBorder = new TitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)," ");
        statusPanel.setBorder(BorderFactory.createEtchedBorder());
        tPanel.setBorder(mainBorder);
        tPanel.setLayout(borderLayout1);
        scrollPane.getViewport().add(theTable, null);
        tPanel.add(scrollPane,  BorderLayout.CENTER);
        // status
        statusPanel.setLayout(borderLayout2);
        statusPanel.setBorder(BorderFactory.createEmptyBorder());
        statusBar.setAlignmentX((float) 0.5);
        statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
        statusBar.setMaximumSize(new Dimension(600, 21));
        statusBar.setMinimumSize(new Dimension(600, 21));
        statusBar.setPreferredSize(new Dimension(600, 21));
        statusPanel.add(statusBar, BorderLayout.SOUTH);
        // buttons
        processButton.setPreferredSize(new Dimension(70,25));
        processButton.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            process_actionPerformed(e);
        closeButton.setPreferredSize(new Dimension(70,25));
        buttonPanel.setLayout(borderLayout3);
        buttonPanel.setBorder(BorderFactory.createRaisedBevelBorder());
        buttonPanel.add(processButton,BorderLayout.WEST);
        buttonPanel.add(new JPanel());
        buttonPanel.add(closeButton,BorderLayout.EAST);
        // lower panel
        lowerPanel.setLayout(borderLayout4);
        lowerPanel.setBorder(BorderFactory.createEmptyBorder());
        lowerPanel.add(statusPanel, BorderLayout.WEST);
        lowerPanel.add(buttonPanel, BorderLayout.EAST);
        tPanel.add(lowerPanel, BorderLayout.SOUTH);
        theTable.setAutoCreateColumnsFromModel(true);
        theTable.setColumnSelectionAllowed(false);
        theTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        theTable.getTableHeader().setReorderingAllowed(false);
    getContentPane().add(tPanel);pack();
        getinfo();
    show();
      private void prepairTable(){
        tableModel = new DefaultTableModel(){
                          public boolean isCellEditable(int row, int col)
                            { return false; }};
        tableModel.addColumn("text 1");
        tableModel.addColumn("text 2");
        tableModel.addColumn("text 3");
        tableModel.addColumn("text 4");
        tableModel.addColumn("text 5");
        theTable.setModel(tableModel);
      } // end method (prepairTable)
      public void refreshTable() {
        prepairTable();
      public void getinfo() {
        try {
            refreshTable();
            tableModel.addRow(new Object[]{"3465465555","0123456789",new Date(1135022905196L),"0100000","errror message","sssssss"});
            tableModel.addRow(new Object[]{"8949344562","0324354549",new Date(1134511763683L),"0166600","errror mes666e","ddddddd"});
    setStatusMessage("ready to process, select record and click Process button to process record");
          errorOcurred = false;
        } catch (Exception ex) {
          errorOcurred = true;
          ex.printStackTrace();
        } // End try
      private void process_actionPerformed(ActionEvent e) {
        try {
          if(theTable.getSelectedRows().length > 0) {
    //        processThread = null;
    //        processThread = new theProcess(this);
    //        processThread.start();
    processnow();
            System.out.println("........finished now.........");
          } else {
        } catch (Exception ex) {
          ex.printStackTrace();
      public void processnow() {
        try {
          int[] selectedRows = null;
          int totalSelected = 0;
          setStatusMessage("processing " + totalSelected + " selected records...");Thread.sleep(1500);
          selectedRows = theTable.getSelectedRows();
          totalSelected = selectedRows.length;
          for(int i = 0; i < totalSelected ; i++){
            setStatusMessage("processing " + (i+1) + " of " + totalSelected + " selected records...");
            System.out.println(".......................row: "+selectedRows);
    Thread.sleep(2500);
    System.out.println("........fins...........");
    errorOcurred = false;
    } catch (Exception ex) {
    errorOcurred = true;
    ex.printStackTrace();
    } // End try
    public void setStatusMessage(String message) {
    statusMessage=message;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    if(image)
    statusBar.setIcon(Image);
    else
    statusBar.setIcon(oImage);
    statusBar.setText(statusMessage);
    statusBar.update(statusBar.getGraphics());
    public static void main(String[] args){
    new thePanel();
    } // class
    package label;
    import java.lang.Runnable;
    public class theProcess implements Runnable {
    private thePanel parent;
    public theProcess(thePanel xparent){
    parent = xparent;
    } // end constructor
    public void start() {
    try {
    Thread thisThread = new Thread(this);
    thisThread.start();
    thisThread.join();
    } catch(Exception ex) {
    ex.printStackTrace();
    } // end method (start)
    public void run(){
    try {
    parent.processnow();
    } catch (Exception ex){
    ex.printStackTrace();
    } // end try
    } // end method (run)
    } // end class

  • Calling nested function to perform DML and wait for commit

    Hi everybody,
    I would like to do some DML -- an insert statement, to be specific -- in a function and have the function then return the numeric key of the newly added row. I call this function from another context and woud then be able to use the newly added data to do some stuff.
    More specifically, what I am going to do is this: I have a graph consisting of source, destination and distance triplets in a table. A user should now be able to
    1.) add a node 'A' to the graph,
    2.) add a node 'B' to the graph
    3.) get the shortest path from A to B through the graph.
    I have an inner function function INSERT_NEW_NODE(node_in in sdo_geometry, graph_in in integer) return integer
    is 
    pragma autonomous_transaction;
    cursor node_cur is 
      select
          source,
          source_geom
      from graph 
    cursor edge_cur is
        select
            source,
            destination,
            distance,
            edge_geom
        from
          graph
        where
          sdo_geom.relate(edge_geom, 'anyinteract', node_in, .005) = 'TRUE';
    begin
      -- check if identical with any existing node
      for node_rec in node_cur loop 
        if sdo_geom.relate(node_rec.source_geom, 'EQUAL', node_in, .005) = 'EQUAL' then
          return node_rec.source;
        end if;
      end loop;   
      -- get edges
      for edge_rec in edge_cur loop
         -- new_node-->edge.destination and vice versa
        insert into
          graph
            ID,
            GRAPH,
            SOURCE,
            DESTINATION,
            DISTANCE,
            SOURCE_GEOM,
            DESTINATION_GEOM,
            EDGE_GEOM
        values
          graph_id_seq.nextval, --id
          graph_in, --graph
          morton(node_in.sdo_point.x, node_in.sdo_point.y),  -- source morton key
          edge_rec.source, -- destination morton key
          sdo_geom.sdo_distance(edge_rec.source_geom_marl2000, node_in, .005, 'unit=M'), -- distance
          node_in, -- source geom
          edge_rec.source_geom,  -- dest geom
          split_line(edge_rec.edge_geom_marl2000, node_in).segment1 -- edge geom
        commit;
        --new_node-->edge.source and vice versa
        insert into
          gl_graph
            ID,
            GRAPH,
            SOURCE,
            DESTINATION,
            DISTANCE,
            SOURCE_GEOM,
            DESTINATION_GEOM,
            EDGE_GEOM
        values
          graph_id_seq.nextval, --id
          graph_in, --graph
          edge_rec.source, -- source morton key
          morton(node_in.sdo_point.x, node_in.sdo_point.y), -- destination morton key
          sdo_geom.sdo_distance(edge_rec.source_geom, node_in, .005, 'unit=M'), -- distance
          edge_rec.source_geom,  -- source geom
          node_in, -- dest geom
          split_line(edge_rec.edge_geom, node_in).segment2 -- edge geom
        commit;
      end loop
      return(morton(node_in.sdo_point.x, node_in.sdo_point.y));
    end insert_new_node;, which adds the new nodes to the graph, connects, calculates distances etc. and returns a handle to the newly added node. I call this function twice from another, outer function function get_path (line_in in sdo_geometry, graph_in in integer) return sdo_geometry
    is 
    source number;
    destination number;
    source_geom mdsys.sdo_geometry;
    destination_geom mdsys.sdo_geometry;
    begin
      source := insert_new_node(get_firstvertex(line_in), graph_in);
      destination := insert_new_node(get_lastvertex(line_in), graph_in);
      -- source := insert_new_node(get_firstvertex(line_in), graph_in);
      -- destination := insert_new_node(get_lastvertex(line_in), graph_in);
      return(get_path_geom(source, destination)); --returns a geometry which is the shortest path between source and destination
    end get_path;; and I think, I have to use automous transaction in the inner function, so that the outer function can see any change performed by the inner one. However, this only works, when I call the inner function twice (i.e. remove the comment signs in front of the last two lines of code right before the return statement in the outer function.
    So here's my questions: 1.) Why do I have to call the function twice to see the transaction complete? and 2.) How can I avoid that? Is there a way to wait with the execution of the return statement in the inner function until the insert is committed and can be seen by the outer function?
    Cheers!

    Tanks, everybody, for your replies! Let me go through them one by one
    smon asked: if you remove the pragma statement, does it work then?No, it does not, at least not, if I call the function from the outer function. In this case the insert statements in the inner function are not committed.
    If I call the inner function like thisDECLARE
      NODE_IN SDO_GEOMETRY;
      GRAPH_IN NUMBER;
      v_Return NUMBER;
    BEGIN
      NODE_IN := MDSYS.SDO_GEOMETRY(2001,<srid>,MDSYS.SDO_POINT_TYPE(<x>,<y>,<z>),NULL,NULL);
      GRAPH_IN := 3;
      v_Return := INSERT_NEW_NODE(
        NODE_IN => NODE_IN,
        GRAPH_IN => GRAPH_IN
    DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
      :v_Return := v_Return;
    END;, it works without autonomous transaction, but then again like this I do not use the handle to access the newly inserted data immediately to perform some other task with it.
    sb92075 said:COMMIT inside LOOP is sub-optimal implementation (increases elapsed time) & can result in ORA-01555 error.Thanks, that was very helpful; I changed my code to commit outside of the loop, just before the return statement and it performs a lot faster now.
    user1983440, regarding my statement I think, I have to use automous transaction in the inner function, so that the outer function can see any change performed by the inner one. asked: Are you certain that this is true? No, anything but certain. I should have said "It +seems+, I have to use autonomous transaction". I wish it would work without autonomous transaction, I think it actually should and I wonder why it does not. However, if I do not use autonomous transaction, the outer function seems to try to access the data that I have inserted in the inner function before it is committed, throws a no-data-found-exception, hence a rollback is performed.
    davidp 2 said:The outer function will see whatever the inner function has done, without commit or autonomous transaction [...] In PL/SQL, the default commit is COMMIT WRITE NOWAIT, which I think does mean the transaction might not be instantly visible to the outside transaction, because the call returns before the commit really finishes. Yes, that is my notion, too. However, without autonomous transaction the inner function completes without error, then the outer uses the handles returned by the inner function to call the function <font face="courier">get_path_geom()</font> which cannot find the handles in the graph-table which raises an exception and causes a rollback.
    Let me summarize: The inner function completes fine, without and with autonomous transaction and returns the handle. The inner function commits, if called directly, without and (of course) with autonomous transaction. The outer function does not see the data inserted by the inner function immediately, whether without or with autonomous transaction. If I let the outer function call the inner function twice (4 times, to be specific, but twice for each newly inserted row) from the outer function and do not use autonomous transaction, I get a no-data-found exception. If I let the outer function call the inner function twice and do use autonomous transaction, it works.
    I agree with everything that was said about not using autonomous transaction in this case and I still want to solve this the right way. Any ideas are welcome!

  • Second tween does not wait for first to finish

    Having a little problem here and as far as I can tell it is
    just that the second tween starts before waiting for the first to
    finish. Basically on a click event it should slide out a scroll
    pane to the bottom of the screen, change the contentpath of the
    scroll pane, then slide it back up.
    with the code below it just slides up the new movie clip but
    does not slide out the old one, if i remove the code for the new
    clip to slide up the old one does do the slide out how I want it to
    look.
    how can I make a pause in between the two to wait.
    on (press) {
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    _root.mask._x = 54;
    _root.mask._y = 109.3;
    _root.scroll_pane.setMask(_root.mask);
    switch (_root.loaded_clip)
    case 2: var Slide_out:Tween = new Tween(_root.scroll_pane,
    "_y", Bounce.easeOut, _root.scroll_pane._y, 900, 3, true); break;
    _root.scroll_pane.contentPath = "Search_mc";
    var Slide_up:Tween = new Tween(_root.scroll_pane, "_y",
    Bounce.easeOut, 900, 109, 3, true);
    _root.loaded_clip = 1;
    }

    Its still not working with that code but I think I can muck
    around with it and figure it out, the slide out works on the old
    clip now but then the new one never shows up.
    The onMotionFinished was basically what I was looking for,
    think I can eventually figure it out from here, thanks for the
    info.

  • Make jFrame wait for jDialog to finish

    I am making a project in Netbeans i have a main Frame and some Dialog windows that open up if you press some buttons.
    when one window opens i want the main Frame script to pause and wait for it to complete.
    i have tried 3 different ways:
    questionDialog.setVisible(true);
    while (questionDialog.isVisible()) {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
    } but that shows the frame of the dialog box but never loads the inside and the whole application freezes.
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            questionDialog.setVisible(true);
    while (questionDialog.isVisible()) {
        try {
            Thread.sleep(200);
        } catch (Exception e) {
    }that loaded my Dialog box but the script never waits for it to close i assume it is because it waits until "later" to show the dialog box and in that time it skips the while loop.
    Thread t = new Thread(new Runnable() {
        public void run() {
            questionDialog.setVisible(true);
            while (questionDialog.isVisible()) {
                try {
                    Thread.sleep(200);
                } catch (Exception e) {
    t.start();
    System.out.println("Dialog started");
    System.out.println(questionDialog.isVisible());
    try {
        t.join();
    } catch (Exception e) {
    }but that had the same result as the first code it waited but never showed the dialog.
    where am i going wrong how should i go about this?
    Scott.
    EDIT:
    by finish i mean become not Visible. so isVisible() will return false
    Edited by: ratcateme on Nov 20, 2008 3:02 PM

    You don't have to do anything to do that
    questionDialog.setVisible(true), this method will block the thread, it would't keep going until the questionDialog is unvisible, this is the mistake of the way 1 and way 3.
    and the way 2: the while block will be execute before the questionDialog.setVisible(true) is execute, so questionDialog.isVisible() will return false
    my en is very poor, good luck!

  • Hp34970a read vi doesnot wait for scan to finish

    hi all.... i am facing problem ..im tryin to read DC current values from two channels.. i modified the advanced scan vi example..
    the read
    vi is not waiting for the scan to finish.... i used trigger vi outside
    a for loop and i want the readings to be taken for a number of times
    which is equal to the trigger count.... i even placed a time delay
    between the standard event vi and the read vi....the standard event
    register vi has been set for operation complete bit. Yet the read vi is
    not waiting.
    so can anyone let me knw if the delay helps in waiting the read vi to finish the scan??
    will the read vi give out the readings for each scan or will it just display random values??
    im
    posting the vi here... i kept the scan count to be 15 and scan-scan
    interval as 1sec. ( so it implies that im using a timer source for
    triggering) I used a time delay of 0.9secs in between standard event
    register vi and the read vi. 
    i used a for loop insted of
    a while loop coz i need the number of readings = scan count. i placed
    the trigger vi outside the for loop.
    can anyone have a look over this vi and help me out?
    Attachments:
    final2.vi ‏59 KB

    Now I placed a while loop around the standard event register vi and i am running it till i get a true in the bits set output. this time i checked the parameter'operation complete bit' instead of setting it. Only then i can see true value on the bit set output or else false.
    The bit 1 is true after some time (after scanning is done), but the instrument is showing -410 error. This error actually says ' a command was received which sends data to the output buffer, but the ouput buffer contained data from previous command(previous data is not overwritten).The output buffer is cleared when power has been off or after a bus Device Clear.'
    What should i do? Can you tell whether what i did is right? I atached the vi which has while loop around the standard event register vi.
    Attachments:
    final3.vi ‏49 KB

  • Quiz slide waits for Audio to finish before proceeding to next question

    Hi guys, hope you can help. I have 5 questions with audio inside narrating the question and the answer in selection. Once you you have chosend your answer then click submit button..it waits until the audio finishes then proceeds to the next question.
    hope you can help
    Thank you

    Having this action on Slide Exit of the Quiz Results slide may not work if the user clicks a button there to Review Quiz because that will mean that the last frame of the Quiz Results slide doesn't get played.
    There is an internal Captivate system variable that gets set on each question slide when it's in Review Mode, but I don't think you can read this variable via Advanced Actions.  If you could read it, you could check it and then trigger the mute action on Slide Enter of each question slide.
    UPDATE: Just thought of another possible workaround.  There's a system variable called cpInfoPrevSlide that records the last slide you visited before the current one.  You could use this in a conditional action to trigger cpCmndMute.  When the user clicks Review Quiz on the Quiz Results slide it will take them back to the first scoring object in the Quiz Scope. OnSlideEnter of this slide you need to check whether or not cpInfoPrevSlide is the Quiz Results slide, and if it is, set cpCmndMute to 1.  That should turn off the audio on the slides from then on.
    For instruction audio on the Quiz Results slide I prefer to have the audio attached to a rollover caption.  That way, the user only gets the audio if they explicitly roll over the HELP button (or whatever you call it).

  • Automator doesn't wait for app to finish launching.

    During "watch me do" actions that lauch an app Automator does not wait for the app to launch. This seems like a bug since Automator does infact know it is launching an app, this shouldn't be something that should require a sleep every time.

    Did you try one these actions?

  • HT1212 My iPad was locked & disabled & tried every possible way to restore but nothing is working - After select Restore, & waited for updates to finish, gets iPad Cannot be resotred at this time because server could not be contacted - Pls help

    Friends,
    My iPad2 was locked and disabled because my kids entered several times the passcode and now it is locked. I tried every possible ways and read all related items and followed precisely articel http://support.apple.com/kb/HT1212 but after i restored and update teh iPad, itunes keeps giveing me the same message:
    The iPad "iPad" cannot be restored at this time because the iPad software update server could not becontacted or is temporarily unavailable.
    I tired at different time of teh day and noght and different days yet kept getting the same message.
    Pls assist me as now the iPad is useless
    Regards,
    Joe

    If reset doesn't work, try and force the iPad into Recovery Mode.
    Recovery Mode
    1. Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
    2. Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.
    3.While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
    4. Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears, release the Home button. iTunes should alert you that it has detected a device in recovery mode. Click OK, and then click Restore to restore the device.
    Note: Data will be lost. You may have to repeat the above many times.

  • Wait for song to finish applescript

    I would like to have an applescript that will use the if statment to test if the selected song it finished and to pause the script until it does

    Well, without seeing more code, it is hard to tell for sure. What you may want to do, is to wrap your refresh in a synchronized block and wait, and then have your Form, a separate Thread I presume, notify when it is finished.
    public void add() {
      new TeamAdd(this); // pass this so you can notify later
      synchronized (this) {
        this.wait(); // wait until notified
        refresh();
    } Of course, you will have to put the corresponding notify() on the passed Object when you are through with it in TeamAdd, otherwise your main thread will hang forever.
    Hope this helps

  • Wait for progressbar to finish then continue code?

    How would you create a program where you have to type a number in numericupdown which will change the progressbar's value number and
    then click button1. When click button1 you will be navigated to google.com and then progressbar will start. when progressbar is finished navigate to bing.com. Does anyone know how to do this?
    Thanks in Advance!

    I haved moved question to C# which can be found here: New
    Forum Question
    Hello,
    I have helped you move this thread to winform forum before you post the reply above.
    In addition, I found that you have got this issue resolved in that thread.
    Regards,
    Carl
    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.

  • Waiting for Thread to finish execution

    I have a program which uses a thread to copy files. While they are copying, a ProgressMonitor comes up displaying the current file being copied. After this has completed, my main program needs to be notified and go on with it's own code. Either I get the 'I'm done waiting!' message instantly, or not at all, instead of getting it after the thread completes. How do I do this?
    This is what I currently have
    // CLASS 1 //
    //...other code is here
    myMethod()
    ProgressMonitorDemo pmd = new ProgressMonitorDemo();
    while (!pmd.isDone())
    { wait(); }
    System.out.println( "I'm done waiting!" );
    }//Class 2 //
    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    import javax.swing.*;
    public class ProgressMonitorDemo extends JPanel
      public final static int ONE_SECOND = 1000;
      private ProgressMonitor progressMonitor;
      private Timer timer;
      private LongTask task;
      public ProgressMonitorDemo()
        task = new LongTask();
        timer = new Timer( ONE_SECOND, new TimerListener() );
        progressMonitor = new ProgressMonitor( this, "Running a Long Task", "", 0, task.getLengthOfTask() );
        progressMonitor.setProgress( 0 );
        progressMonitor.setMillisToDecideToPopup( 2 * ONE_SECOND );
        task.go( );
        timer.start();
      public boolean isDone()
        return task.isDone();
       * The actionPerformed method in this class
       * is called each time the Timer "goes off".
      class TimerListener implements ActionListener
        public void actionPerformed( ActionEvent evt )
          progressMonitor.setProgress( task.getCurrent() );
          String s = task.getMessage();
          if( s != null )
            progressMonitor.setNote( s );
          if( progressMonitor.isCanceled() || task.isDone() )
            progressMonitor.close();
            task.stop();
            Toolkit.getDefaultToolkit().beep();
            timer.stop();
    }// CLASS 3 //
    import javax.swing.*;
    import java.io.*;
    import java.awt.dnd.DnDConstants;
    public class LongTask
      private int lengthOfTask;
      private int current = 0;
      private boolean done = false;
      private boolean canceled = false;
      private String statMessage;
      public LongTask()
        //Compute length of task...
        //In a real program, this would figure out
        //the number of bytes to read or whatever.
        lengthOfTask = 400;
       * Called from ProgressBarDemo to start the task.
      public void go( )
        final SwingWorker worker = new SwingWorker()
          public Object construct()
            current = 0;
            done = false;
            canceled = false;
            statMessage = null;
            return new CopyMove();
        worker.start();
       * Called from ProgressBarDemo to find out how much work needs
       * to be done.
      public int getLengthOfTask()
        return lengthOfTask;
       * Called from ProgressBarDemo to find out how much has been done.
      public int getCurrent()
        return current;
      public void stop()
        canceled = true;
        statMessage = null;
       * Called from ProgressBarDemo to find out if the task has completed.
      public boolean isDone()
        return done;
       * Returns the most recent status message, or null
       * if there is no current status message.
      public String getMessage()
        return statMessage;
       * The actual long running task.  This runs in a SwingWorker thread.
      class CopyMove
        private String currOldLoc, currNewLoc, type;
        CopyMove()
          while( current < lengthOfTask )
            try
              Thread.sleep( 1000 );
              current += Math.random() * 100; //make some progress
              if( current > lengthOfTask )
                current = lengthOfTask;
              statMessage = "Completed " + current + " out of " + lengthOfTask + ".";
            catch( Exception e )
              System.out.println( "<ERROR>: Long Task " + e.toString() );
    }

    I tried this but it froze...
    public void myMethod()
    ProgressMonitorDemo pmd = new ProgressMonitorDemo( );
    synchronized( pmd )
       try
         pmd.wait();  
       catch(Exception e){}
    System.out.println( "I'm done waiting!" );
    }Class 2
    class CopyMove
      private String currOldLoc, currNewLoc, type;
      CopyMove()
        while( current < lengthOfTask )
          try
            Thread.sleep( 1000 );
            current += Math.random() * 100; //make some progress
            if( current > lengthOfTask )
              current = lengthOfTask;
            statMessage = "Completed " + current + " out of " + lengthOfTask + ".";
          catch( Exception e )
            System.out.println( "<ERROR>: Long Task " + e.toString() );
        synchronized(this)
          notifyAll();

  • VI waiting for another VI finishing before completing

    Howdy
    i have a goniometer.vi which should move the detectorarm 1°, then starts a spectrometer.vi and measures the spectrum. after completing measurements the goniospectrometer.vi should move another 1° and again...
    i have made the spectrometer.vi a sub.vi and wanted to include it into goniometer.vi, but i have no idea how to tell the goniometer.vi that spectrometer.vi is ready for moving on.
    thanks
    Robert

    Use a while loop. Make sure that both subvi's (goniometer and spectrometer) have error in and error out. Call the goniometer vi first and spectrometer second, wire error out from the first to error in of the second. Put some kind of exit condition to stop the loop. The first vi will execute, then when it is done the second will execute. The process will repeat until the stop condition is met.
    - tbob
    Inventor of the WORM Global

Maybe you are looking for