Thread concurrency problem - how to know when thread is dead?

My applet uses a thread to draw an iteration graph step by step.
The user as the option of pressing two buttons:
- PLAY button - iteration Points are stored in an arrayList and drawn step by step (a sleeping time follows each step) (drawIterations thread)
- TO_END button - iteration Points are all stored in the arrayList (swingworker thread) and after all of them have been stored the graph is drawn instantly.
I have problems in this situation:
When executing the PLAY-button thread, if the user presses TO_END button, the remaining graph lines should draw instantly. Sometimes I get more points on the graph than I should. It seems that the PLAY thread, which I stop when TO_END buton is pressed, still remains storing new points into the arrayList concurrently to the new thread created after TO_END button was pressed .
Any ideas?
I'm already using synchronization.
private volatile Thread drawIterations;
public void playButtonClick(JToggleButton btn) {
     pointSet1 = new ArrayList<Point2D.Double>();
     if (drawIterations == null) drawIterations = new Thread(this,   "drawIterations");
     drawIterations.start();
public void toEndButtonClick(JToggleButton btn) {
     stopThread() ;
     pointSet1 = new ArrayList<Point2D.Double>();
     computeIterationGraphPointsAndRefreshGraph();
public synchronized void stopThread() {
     drawIterations = null;
     notify();
private void computeIterationGraphPointsAndRefreshGraphs() {
     SwingWorker worker = new SwingWorker() {
          public Object construct() {
               // compute all iteration points
                     //repaint graph
     worker.start();
}Is there a way of testing if a thread is actually dead after setting the thread object to null??

In general, a Thread keeps running until it's run
method completes. Threads don't stop when their
handle is set to null. Your run method should
constantly be checking on a variable to know when to
stop running and exit the run method. In this case,
you could check on the drawIterations variable to see
if it's null.<br>
<br>Even using the following line on my run method I get the the same problem:
<br>
<br>while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
<br>...
<br>
<br>Here's the whole method:
<br>(actually there are 2 graphs being drawn and the second is only refreshed every 2 steps:)
<br>
<br>     <br>public void run() {
     <br>  Thread myThread = Thread.currentThread();
     <br>  int totalIterations = transientIterations +iterationsToDraw ;
          <br>  while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
          <br>     computeNextHalfIterationGraphPoint( );
          <br>      if (!TRANSIENT_IS_ENABLED || halfStep >= 2*transientIterations ) {// is     not in transient calculations
          <br>                       graphArea1.repaint();
          <br>                       if (halfStep%2 ==0 ) graphArea2.repaint();
          <br>                       if (halfStep < 2*totalIterations){//no need to execute the following block if at last iteration point
               <br>                         if (lastIterationPointsFallOutsideGraphArea(toEndCPButtonActive)) break;
                    <br>          try {
                         <br>                      Thread.sleep(sleepingTimeBetweenHalfIterationRendering);
                         <br>                      if (threadInterrupted ){//if clause included to avoid stepping into a synchronized block if unnecessary
                              <br>                        synchronized (this) {
                                   <br>                          while (threadInterrupted && myThread==drawIterations ) wait();
                                                  <br>    }
<br>                                               }
     <br>                                   } catch (InterruptedException e) {
          <br>                                     break;
               <br>                         }     
                    <br>               }
<br>                            }
     <br>        stopThread();
     <br>     }
<br>

Similar Messages

  • HT2173 How to know when a hard drive has failed ?

    How to know when a hard drive has failed ?

    Machine doesn't boot.  You experience strange crashes.  Gets wrong results.  Your harddrive is five or more years old.  Time to consider repacing it.   You do have backup?
    You may want to run these "standard" fixes if the problem persists.
    1) Check the amount of free space on your harddrive.  You should have a several gigs free.
    2) You should run disk utility
         a) verify the disk
         b) update your permissions.
    3) Try a safe boot.
        Shutdown your machine.  Hold down the shift key.  Poweron.  Wait awhile Wait awhile while you harddrive
          is being checked.
        http://support.apple.com/kb/ht1455
    4) You may want to run applejack to clean up your machine.
         http://applejack.sourceforge.net/
    a lot more ways to fix your Mac.
    http://www.thexlab.com/faqs/faqs.html
    verify & repair your startup drive
    To verify & repair you file system on the startup drive, you will need to run disk utility from you installation DVD.
    This article  will tell you how to get to disk utility.  Once in a disk utility, you can go and attempt to recover the disk.
    http://support.apple.com/kb/TS1417
    To repair your startup drive, you will need to run disk utility from your startup DVD.
    Mac OS X 10.4: About the utilities available on the Mac OS X 10.4 Install DVD
    http://support.apple.com/kb/HT2055
    How to run disk utility from your startup DVD.
    Insert your  startup DVD  into your reader.  Power down your machine.  Hold down to the c key.  Power on your machine.  This will bootup your startup DVD.
    This will bring you to a panel asking you for your language.  Pick your language.
    You you come to the Install Mac OS panel.  Do not install.
    Click on Utilities menu item.  This will give you a pulldown list of utilities.
    Click on the disk utility.
    You are now in disk utility.  Pick your disk.  Click on repair it should be on the lower right of the panel.
    Once the repair completes successfully, you should update your permissions.
    Verify a disk
    As an alternative, you can verify that the filesystem on the disk is correct. You will not be able to repair the file system.
    I suggest that you use disk utility to verify that your startup disk is OK. 
    Macintosh-HD -> Applications -> Utilities -> Disk Utility 
    Start up disk utility.  On the left pane view, you will see a list of all your disks.  
    Click on your startup disk.
    Click on the First Aid  Tab.
    Click on verify.  
    Hopefully your disk will verify.  If not, you have to boot from your installation DVD and run Disk Utility from there to attempt to repair your file-system.

  • I'm a Microsoft Outlook for Mac user, I need information of how to know when e-mail was readed and confirm receipt of e-mails sent. thank you!  regards Mauricio

    I'm a Microsoft Outlook for Mac user, I need information of how to know when e-mail was readed and confirm receipt of e-mails sent. thank you!  regards Mauricio

    Mail and Address book

  • How to know when the PRICE AFTER DISCOUNT changed and get the value

    Hi,
    Everything I do to see if a value changed in the grid works except for PRICE AFTER DISCOUNT
    which seems to be inaccessible.
    Any idea how to know when exactly this value changed and do actions accordinly ?
    Also I always get 0.00 if I try to get the value of it
    This works to get in the condition of a vlaue changing but I always get 0.00 as the value of the column
    if (pVal.ItemUID == "38" && pVal.ColUID == COL_DISCOUNT.ToString() && pVal.EventType == BoEventTypes.et_VALIDATE && pVal.ItemChanged == true && pVal.ActionSuccess == true)
        try
            SAPbouiCOM.Matrix Matrix = (SAPbouiCOM.Matrix)SBO_Application.Forms.ActiveForm.Items.Item("38").Specific;
            SAPbouiCOM.EditText Editor = (SAPbouiCOM.EditText)Matrix.Columns.Item(COL_DISCOUNT).Cells.Item(pVal.Row).Specific;
            SBO_Application.MessageBox("Discount changed for : " + Editor.Value + "...", 1, "Ok", "", "");
        catch (Exception ex)
            SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
    And this do not even get into the condition even tought I SEE the column PRICE AFTER DISCOUNT:
    if (pVal.ItemUID == "38" && pVal.ColUID == COL_PRICEAFTERDISCOUNT.ToString() && pVal.EventType == BoEventTypes.et_VALIDATE && pVal.ItemChanged == true && pVal.ActionSuccess == true)
        try
            SAPbouiCOM.Matrix Matrix = (SAPbouiCOM.Matrix)SBO_Application.Forms.ActiveForm.Items.Item("38").Specific;
            SAPbouiCOM.EditText Editor = (SAPbouiCOM.EditText)Matrix.Columns.Item(COL_PRICEAFTERDISCOUNT).Cells.Item(pVal.Row).Specific;
            SBO_Application.MessageBox("Price after discount changed for : " + Editor.Value + "...", 1, "Ok", "", "");
         catch (Exception ex)
             SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");

    just idea, maybe it will works
    Create one udf in row level and set there FS based on changes on price after discount and fill value what is in price after discount. Then the validation make on this field instead of standard SAP field.

  • How i know when a EXECUTE_QUERY retrieved last record

    Hi...
    How i know when the EXECUTE QUERY retrieved the last record in a block ....?
    Exist a trigger after trigger POST-QUERY?
    Regards
    Hector Gabriel Ulloa Ligarius
    Santiago of Chile
    http://es.groups.yahoo.com/group/desarrolloOracle/

    Kevin, sorry
    But the :system.last_record not change the value during the execution of EXECUTE_QUERY.
    Only useful when the data was retrieved into blocks...not during..
    Other mode?
    Regards
    Hector Gabriel Ulloa Ligarius
    Santiago of Chile
    http://es.groups.yahoo.com/group/desarrolloOracle/

  • How to know when invoke bytecode implements?

    I've got a classfile - it has few invokeinterface bytecodes inside - their count is defined dynamically - when class is running.
    And I've got a program, which runs this class.
    The aim of this program - to gather statistics of invokeinterface calling frequency.
    How to know when invokeinterface bytecode implements?
    (In that moment I plan to update several digits)
    Have You got an advise for me?
    Thanks.

    You must use the debugging interface, or get a code profiler. Do a search on all forums for profiler, you'll get tons of information.

  • How to know when I'm doing a createInsert?

    how to know when I'm doing a createInsert, this to hide a button when you run this action, I am using a task flow.
    my version of jdeveloper is 12c

    hi,
      So you are using the createInsert as a method call in task flow. That is your form/table will be come new rows and you want to disable some button.
    Your task flow might be as below
          CreateInsert---->Page.
    To do so
    1.) Take properties of your method call and bind the Method property to a method in a bean (bean registered in the task flow with scope view or any higher scope)
    2) Call the create insert operation programmatically in that method.
    3) And in that method after the createinsert ,set a boolean variable in pageFlowScope.
    4)Put this variable in the disable property or visible propery of the button you wabt to hide/diable.
    eg:
        public void doCreateInserOperation(){
            try {
               // Programatically invoke CreateInsert
                DCBindingContainer bindings = (DCBindingContainer)getBindingContainer();
                bindings.getOperationBinding("CreateInsert").execute();
            //Set a variable in page Flow Scope 
            AdfFacesContext.getCurrentInstance().getPageFlowScope().put("disableButton", true)
            } catch (Exception e) {
                e.printStackTrace();
        public BindingContainer getBindingContainer() {
            FacesContext facesContext = getFacesContext();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
            return (BindingContainer)valueExp.getValue(elContext);
    you can access this variable in EL expression as #{pageFlowScope.disableButton}. So when your page render it will be in CreateInsert mode and the button will be disabled/hidden.
    I hope this will help you.
    With regards,
    Gijith.

  • How to know when the JComboBox popup is about to show or hide?

    Hi all,
    In JDK 1.4, a new addPopupMenuListener() was added to the JComboBox component. I found out I have to use JDK 1.3, but I already wrote a lot of code around this particular capability. I am trying to figure out how to duplicate it in JDK 1.3. I need to know BEFORE and AFTER the popup is displayed. OR, is there a way with JDK 1.3 that as soon as they click the combo box, it fires an event. The thing is, as soon as they click it, I want to change the background color. When they are done selecting, I can use an ActionListener or ItemListener to find out what was selected and change the color again. My killer is trying to figure out how to know when they have selected the box. I tried adding MouseListener, PropertyChangeListener, AncestorListener. None are doing a thing when the JComboBox is first selected.
    Any help would be much appreciated.
    Thank you.

    Hi all,
    In JDK 1.4, a new addPopupMenuListener() was added to the JComboBox component. I found out I have to use JDK 1.3, but I already wrote a lot of code around this particular capability. I am trying to figure out how to duplicate it in JDK 1.3. I need to know BEFORE and AFTER the popup is displayed. OR, is there a way with JDK 1.3 that as soon as they click the combo box, it fires an event. The thing is, as soon as they click it, I want to change the background color. When they are done selecting, I can use an ActionListener or ItemListener to find out what was selected and change the color again. My killer is trying to figure out how to know when they have selected the box. I tried adding MouseListener, PropertyChangeListener, AncestorListener. None are doing a thing when the JComboBox is first selected.
    Any help would be much appreciated.
    Thank you.

  • How to know when ListView finished rendering elements?

    I have a ListView with many items inside.
    After I assign the ListView an ItemsSource, I need to know when all items finished rendering on my page.
    I can just nothing with my eyes it takes like 2 seconds to render all elements, and I need to subscribe to an event like "ListView.RenderingCompleted", because I can proceed with other operations after all elements are rendered and
    visible to the user ( meanwhile I can show a loading bar ).
    I cannot find something similar, how can I do that?

    >>I need to know when all items finished rendering on my page.
    I am afraid there is "all containers generated" event.
    The ListView uses UI virtualization so visual containers are only created for the currently visible items, i.e. not all the containers will be created at once.
    You could handle the Loaded event of the root item in the ItemTemplate to know when each individual container is ready for interaction:
    <ListView x:Name="listview" Height="200">
    <ListView.ItemTemplate>
    <DataTemplate>
    <Grid Loaded="grid_Loaded">
    <TextBlock Text="{Binding}"></TextBlock>
    </Grid>
    </DataTemplate>
    </ListView.ItemTemplate>
    </ListView>
    If you know the approximate number of items you can then for example write some code in the code-behind that hides the loading bar when a certain number of Loaded events has been raised.
    Or you could possibly handle the Loaded event of the ListView. The Loaded event occurs when the element has been constructed, added to the visual tree and is ready for interaction.
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • How to know when the process to be killed

    I want to run 4 .exe programs under win98 in sequence, how should i know when does the .exe program end?

    If you ran the .exe file using the Process class, there is a method called waitFor() which
    will cause the current thread to wait for the process to finish
    eg
    public void execute() {
    Runtime runtime = System.getRuntime();
    System.out.println("Start minesweeper");
    Process process = runtime.exec("winmine.exe");
    process.waitFor();
    System.out.println("Finished");
    }

  • How to know when to upgrade to ICS...

    Is there a way to know when the upgrade to ICS is available without plugging my phone into my computer like twice a day? Basically would it be similar to how the Arc S, Neo V and Ray were updated, where the SI number of released phone was displayed in the following document?
    Smartphones:
    Xperia X10 mini pro, Xperia X8, Xperia Live with Walkman, Xperia L & Xperia SP
    Solved!
    Go to Solution.

    keep an eye on the official Blog
    http://blogs.sonymobile.com/products/
    and also Markus is creating new threads were he will post the SI numbers
    like this
    Xperia Mini/Mini Pro
    http://talk.sonymobile.com/message/199352#199352
    Xperia Active
    http://talk.sonymobile.com/message/199352#199352
    Xperia Ray
    http://talk.sonymobile.com/message/199350#199350
    Neo/V & Pro
    http://talk.sonymobile.com/message/199354#199354
    http://talk.sonymobile.com/message/199355#199355
    Don't forget to mark theCorrect Answers & Helpful Answers
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • How forms know when Report Server is down

    Environment: Oracle Developer Suite 10g 10.1.2.0.2 R2
    os :windows xp
    I have button to call a report object :when-button-pressed
    declare
    v_report_name VARCHAR2(30):='REQ010';----report name without .rdf
              v_repid REPORT_OBJECT;
              vc_rep VARCHAR2(20);
              vc_rep_status VARCHAR2(20);
              vc_URL VARCHAR2(100);
              vc_rep_job VARCHAR2(10);
              Plist ParamList;
              dummy NUMBER;
              Report_Plist_name VARCHAR2(30) := 'REPORT_PARAM_LIST';
              REPORT_NOT_GENERATED EXCEPTION;
              PARAMETER_LIST_SECTION_PROBLEM EXCEPTION;
    BEGIN
    --=========================================================================          
    BEGIN     
                        --prepare the list of parameters to be sent to the report
                        Plist := Get_Parameter_List(Report_Plist_name);
                        IF NOT Id_Null(Plist) THEN
                             Destroy_Parameter_List(Report_Plist_name);
                        END IF;     
                        Plist := Create_Parameter_List(Report_Plist_name);      
                        IF Id_Null(Plist) THEN
                             dummy := Show_Alert('PARAM_LIST_CREATION_PROBLEM');
                             RAISE Form_Trigger_Failure;
                        END IF;
                        --Add parameter(s) to list just created
                        Add_Parameter(Plist, 'P_REQUEST_ID', TEXT_PARAMETER, :CUSTOMER_REQUESTS.CR_REQUEST_ID);
         EXCEPTION
    WHEN OTHERS THEN
    raise PARAMETER_LIST_SECTION_PROBLEM;
    END;
    --=============================================================================
              --START THE REPORT     
              v_repid := FIND_REPORT_OBJECT(v_report_name);
              vc_rep := RUN_REPORT_OBJECT(v_repid,Plist);
              vc_rep_status := REPORT_OBJECT_STATUS(vc_rep);
    --=============================================================================
    BEGIN          
                        IF vc_rep is NOT NULL THEN
                                  -- Wait until report finishes or produces an error
                                  WHILE vc_rep_status in
                                  ('RUNNING', 'OPENING_REPORT', 'ENQUEUED')
                                  LOOP
                                       vc_rep_status := REPORT_OBJECT_STATUS(vc_rep);
                                  END LOOP;
                                  -- Display the report if it is finished
                                  if vc_rep_status = 'FINISHED' then
                                                      vc_rep_job := substr(vc_rep,instr(vc_rep,'_')+1);
                                                      message('Report Completed');
                                                      vc_URL := '/reports/rwservlet/getjobid' ||vc_rep_job||
                                                      '?server='||get_report_object_property
                                                      (v_repid,report_server);
                                                      Web.show_document(vc_URL,'_blank');
                                                      -- Display an error if the report errored
                             END IF;
                        END IF;                              
    EXCEPTION
    WHEN OTHERS THEN
    raise REPORT_NOT_GENERATED;
    END;
    --=============================================================================
    Destroy_Parameter_List('REPORT_PARAM_LIST');
    EXCEPTION
    WHEN REPORT_NOT_GENERATED THEN
    msgbox('Error Calling Report');
    --Causes: 1-Report file name is incorrect,check report name and existance.
    -- 2-Or, Report Server is Down.
    WHEN PARAMETER_LIST_SECTION_PROBLEM THEN
    msgbox('CHECK PARAMETER SECTION ');
    WHEN OTHERS THEN
    msgbox(SQLERRM);
    END;
    Problem:
    ======
    How can I distingwish among these conditions:
    IF Report cannot run :
    when the problem is from the report file object itself.
    and IF the problem is the Report Server is Down.
    and the report file is not exist.
    Tries:
    I try to but many exception to differenciate between these conditions but I fail
    how can I display a message to the user,Inform him the problem ,
    So the support personnel know if the problem from the Report object or the application Server
    .

    Hi Krishan,
    If you want to check if local cache service is running, you can do something like this:
    NamedCache cache = CacheFactory.getCache(sCacheName);
    boolean isRunning = cache.getCacheService().isRunning();If you want to check if any storage enabled nodes (cache servers) are available in the cluster:
    NamedCache cache = CacheFactory.getCache(sCacheName);
    DistributedCacheService service = (DistributedCacheService) cache.getCacheService();
    Set storageEnabledMembers = service.getStorageEnabledMembers();
    if(storageEnabledMembers.isEmpty())
        // no cache servers available ...
        }Regards,
    Dimitri

  • How to know when an object is deleted?

    Hi,
    In Java, instances of classes are eliminate by garbage collector and programmers have no chance to do it.
    I need to do something, when the instance of a class ends its cycle-life .
    How do I know when an object is going to be deleted, in order to make some thing bounded to this event?
    thank you
    Regards
    Angelo

    Thank you for your help ...
    Here some code (I hope that I didn't forget something important):
    1. A class inside the JaveaBeans to manage events:
         * NavBean_EventsBroadcaster is a singleton class used in the JavaBean to manage (fire)
         * the events; and also to manage (add/remove) the listeners.
         * Events are raised when users push buttons with the purpose to change the display of
         * records (of the table) on the screen.
        public class NavBean_EventsBroadcaster implements Serializable {
            private transient Vector listeners;
            private static NavBean_EventsBroadcaster eventsBroadcaster_ForNavBeans = null;
             Method to get the instance of the singleton class
               static public NavBean_EventsBroadcaster getSingletonInstance() {
                    if (eventsBroadcaster_ForNavBeans == null) {
                        eventsBroadcaster_ForNavBeans = new NavBean_EventsBroadcaster();
                    return eventsBroadcaster_ForNavBeans;
                } // getSingletonInstance
            * fireTheEvent_X_navBean(): method that raise events
            public void fireTheEvent_X_navBean(
                    Object source,
                    NavigatorBean_eventsList_ENUM nbEvtENUM,
                    ResultSet rst,
                    int keyReg) {
                if (listeners != null && !listeners.isEmpty()) {
                    // object is going to be created (it contains the infos about the event)
                    NavBeanDB_EventDescriptor event_descr =
                            new NavBeanDB_EventDescriptor(
                            source, // dBbeanNavigator
                            nbEvtENUM,
                            rst,
                            keyReg);
                    // copy of the lisener to use it for add or remove
                    Vector targets;
                    synchronized (this) {
                        targets = (Vector) listeners.clone();
                    // proper event (select first, next, prev, last reg) is raised
                    Enumeration enumerat = targets.elements();
                    while (enumerat.hasMoreElements()) {
                        NavBeanDBListener_INTERFACE l =
                               (NavBeanDBListener_INTERFACE) enumerat.nextElement();
                        l.firedNavigationBeanEvents(event_descr);
                        System.out.println("Method fireTheEvent ----- key = " + priKeyOnTheScreen);
                }  // if
        } // fireTheEvent()
             * Adds a listener to the listener list.
             * @param l The listener to add.
            synchronized public void addNavBeanAddListener(NavBeanDBListener_INTERFACE l) {
                if (listeners == null) {
                    listeners = new Vector();
                listeners.addElement(l);
                System.out.println("E' stato registrato un nuovo ascoltatatore per navigationBar");
            } // addNavBeanAddListener()
         * Removes a listener from the listener list.
         * @param l The listener to remove.
        synchronized public void removeNavBeanRemoveListener(NavBeanDBListener_INTERFACE l) {
            if (listeners.contains(l)) {
                listeners.remove(l);
        }  // removeNavBeanRemoveListener()
        } // class NavBean_EventsBroadcaster2. The used interface
          * This is the interface that specifies the contract between a NavBeans
          * source and listener classes.
          * @author Owner
         public interface NavBeanDBListener_INTERFACE extends EventListener {
             public void firedNavigationBeanEvents(NavBeanDB_EventDescriptor evt);
         } // interface NavDB_BeansListener_INTERFACE3. the class adapter
        public abstract class DbNavigatorBean_Adapter implements NavBeanDBListener_INTERFACE {
             NavigatorBean_eventsList_ENUM navigatorBean_eventsList_ENUM;
             public DbNavigatorBean_Adapter() { // costruttore
             } // costruttore
              * This class have to be implemented from listeners to get events.
              * @param evt
             // NavigatorBean_eventsList_ENUM {user_chang, sequential_first, sequential_prev, sequential_next, sequential_last}
             public void firedNavigationBeanEvents(NavBeanDB_EventDescriptor evt) {
                 navigatorBean_eventsList_ENUM = evt.getEventType();
                 switch (navigatorBean_eventsList_ENUM) {
                     case user_chang:
                         toDoWhen_user_changeRegistration(evt);
                         break;
                     case sequential_first:
                         toDoWhen_setted_firstRegistration(evt);
                         break;
                     case sequential_prev:
                         toDoWhen_setted_prevRegistration(evt);
                         break;
                     case sequential_next:
                         toDoWhen_setted_nextRegistration(evt);
                         break;
                     case sequential_last:
                         toDoWhen_setted_lastRegistration(evt);
                         break;
                 } // witch case
             } // firedNavigationBeanEvents()
             abstract public void toDoWhen_user_changeRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_firstRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_nextRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_prevRegistration(NavBeanDB_EventDescriptor evt); // { }
             abstract public void toDoWhen_setted_lastRegistration(NavBeanDB_EventDescriptor evt); // { }
         } // class class DbNavigatorBean_Adapter_base4. the class used to describe the event
       Class used to dercribe the event that happened.
       public class NavBeanDB_EventDescriptor extends EventObject {
           private NavigatorBean_eventsList_ENUM navigationBean_events_ENUM;
           private int primaryKeyOfRegOnTheScreen;
           private ResultSet resultSet;
           private int totOfRegsRegistredOnTheTable;
            * Costructor: is used to describe the events
            * @param source
            * @param nbEvtENUM
            * @param rst
            * @param keyReg
           public NavBeanDB_EventDescriptor( // costruttore
                   Object source,
                   NavigatorBean_eventsList_ENUM nbEvtENUM,
                   ResultSet rst,
                   int keyReg) {
               super(source);
               this.navigationBean_events_ENUM = nbEvtENUM;
               this.resultSet = rst;
               this.primaryKeyOfRegOnTheScreen = keyReg;
               extractTotRegsInTheTable(rst);
       //        this.totOfRegsRegistredOnTheTable = rgsRegNmbr;
               System.out.println("Viene creata una istanza di event descriptor");
           }// costruttore
            * which possibe action caused the event,
            * was pushed the button (first, prev, next, last, user select...)
            * @return
           public NavigatorBean_eventsList_ENUM getEventType() {
               return navigationBean_events_ENUM;
           } // getEventType
            * primmary key of registration on the screen
            * @return
           public int getPrimaryKeyOfTheRegOnTheScreen() {
               return primaryKeyOfRegOnTheScreen;
           } // getKeyRegOnTheScreen
           * resultSet showed on the screen
           public ResultSet getTheFullRegistrationOnTheScreen() {
               return resultSet;
           } // getTheFullRegistrationOnTheScreen
           Number of registrations actually on the table.
           public int getTotRegsRegistredOnTheTable() {
               return this.totOfRegsRegistredOnTheTable;
           } // getRegsRegistredNmbr
            private classe that get data
           private void extractTotRegsInTheTable(ResultSet rst) {
               ResultSet localRst =rst;
               try {
                   int curRow = localRst.getRow();
                   localRst.last();
                   this.totOfRegsRegistredOnTheTable = localRst.getRow();
                   localRst.absolute(curRow);
               } catch (SQLException ex) {
                   Logger.getLogger(NavBeanDB_EventDescriptor.class.getName()).log(Level.SEVERE, null, ex);
       } // class NavBeansEvent5. a possible use of the JavaBeans
       public class TableClients extends JFrame
           implements LinkTablesToDlgThatRandomizeSelections_INTERFACE {
       private NavigationBean navigationBean;
       public TableClients() {   // constructor
            navigationBean = new NavigationBean();
            navigationBean.initializeDBbeanNavigator(...);
            this.add(navigationBean);
            navigationBean.addActionNavigatorListener(new DbNavigatorBean_Adapter() {
                        @Override
                        public void toDoWhen_user_changeRegistration(NavBeanDB_EventDescriptor nbdbed) {
                            // do something
                        @Override
                        public void toDoWhen_setted_firstRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
                        @Override
                        public void toDoWhen_setted_nextRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
                        @Override
                        public void toDoWhen_setted_prevRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
                        @Override
                        public void toDoWhen_setted_lastRegistration(NavBeanDB_EventDescriptor nbdbed) {
                                // do something
    } // constructor
    } // class TableClientsthis code works well...
    But if I implement the javaBeans on more than one Dialogs (windows) and the user uses
    this dialogs sequentially, then the JavaBean responds to the events always as the caller is the
    first dialog that run...
    If I delete all listener (on the dialog) when the dialog is close then I have not problems
    still thank you
    Regards
    Angelo

  • How to know when File Adapter is complete when debatching?

    I have a BPEL process that reads in a file and debatches it into records of 1 and inserts them into a table.
    How do I know when the entire process is complete and all records in the file have been handled?

    Thats the problem with the file adapter. If you use it in debatch mode, you cannot really control the different BPEL processes that get spawned off one file.
    The other approach for scenarios where the file is huge, could be to use the adapter in notification mode. So the file adapter will notify the BPEL process, that the file is available, and then BPEL process can read the file using xpath functions or java code etc.
    Hope this helps.
    -@

  • How to know when DND in progress?

    How do I know when a DND is in progress can't seem to find any where to call isDragInprogress() or something similar. My problem is that my JPanel flickers when it is dragged over because of the constant call to validate() so I want to disable the validate() method when drag is in progress?

    How about implementing your custom painting correctly instead? You're doing custom painting, right? And you overrode paint() instead of paintComponent() I bet...
    You wouldn't have to deal with validate() etc. when implementing DND for the UI to remain stable, otherwise.

Maybe you are looking for

  • Help on converting xml file to text file

    Hi, I have xml file and i want to convert to text file ... How do i write a perticular tag in perticular line by the time converting xml to text file using xsl ... Ex: input XML file: <NAME> venkat </NAME> <ADDRESS> 5800 Lander Brook Drive </ADDRESS>

  • White lines on my 5c

    i haven't dropped my phone for this to happen, the lines just appeared on my screen first going horizontal then vertical and they keep switching like that. i let it charge overnight and i restarted it but the lines remain.

  • Itunes 10.7 and my out of date operating system

    I have an imac from 2008 and I'm unable to download the required itunes 10.7 in order to restore my new iPhone 5. Does anyone have any suggestions as to what I should do? Or if it is even going to be possible for me to use this device with my 4 year

  • Can't have alter table in SP ?

    I tried to create a procedure CREATE OR REPLACE PROCEDURE sp_disablefk is begin Alter Table ACCOUNTDETAIL Disable constraint SYS_C0022265; end; It returned me a message Encountered symbol Alter when expecting ..... However, when I place same statemen

  • What webbased tools can I use to create a custom PDF Reader Web App?

    I want to build a webtool that allows user to view PDFs but I also want to add my own toolbar to allow users to do some custom things to the document like select text and return that text to the webapp (built with AJAX). Or maybe insert a bookmark or