Worker Thread and Helper Thread for Gauge updates

Hi
I know that in the Smart Ticket sample application there is an example with the implematation of "Each worker thread also has a helper thread that displays an animated gauge to indicate the progress of the worker thread".
But i can't find the sample on java.sun.com anymore..:-(. Do you have the source code of smart ticket or even an example of the helper thread implemetation. The worker thread i have already implementated.
Thanx
Michael

Here's a simple outline of what I do. This has been drastically stipped down from my actual code as I use teh message for all kinds of things incluing requests on a queue to the worker and resposes back. So in the real code I also have a success flag, a command type, an argument object and a result object with get and set methods for all of them.
1) define an interface that the GUI code can implement and pass a reference to the worker which stores it in myTarget.
interface MessageTarget
     void postMessage(Message m);
     void runMessage(Message m);
}2) define a message class
class Message implements Runnable
     Object data;
     MessageTarget target;
     Message(MessageTarget target, Object data)
          this.target = target;
          this.data = data;
     public void run(){target.runMessage(this);}
     public Object getData(){return data;}
     public void postMessage(){target.postMessage(this);}
}3) implement the MessageTarget interface in the GUI
// put a response from the database onto the swing queue
public void postMessage(Message r)
     javax.swing.SwingUtilities.invokeLater((Runnable)r);
// process messages
public void runMessage(Message m)
     Object data = m.getData();
}4) post messages back from the worker
       new Message(myTarget,myData).post();

Similar Messages

  • I upgraded to Mountain Lion yesterday, but since doing so I find that my 1Password app will not work. I have checked for 1Password updates but there are none. Is there a compatibility issue

    I upgraded to Mountain Lion yesterday, but since doing so I find that my 1Password app will not work. I have checked for 1Password updates but there are none. Is there a compatibility issue

    Hmmm...I'm using 1Password Version 3.8.20 (build 31499) with a fresh install (scrape and pave) of Mt. Lion on my iMac and it's working fine.
    I use Dropbox to sync 1Password so for my fresh install I simply downloaded 1Password from Agilbits website and installed it.
    Have you tried reinstalling 1Password?  Depending on how you purchased it, download it from their website or from the Mac App store to reinstall/replace it.  (IIRC v3.8.x comes directly from Agilbits and v3.9 from the Mac App store.)  You shouldn't have to uninstall it, the new download should overwrite the existing copy.
    As with anything else, be sure to run a  backup first!
    More here:
    http://support.agilebits.com/discussions/1password-38-for-mac-from-agilebits-web site/17861-finding-existing-data-file-when-reinstalling-1password
    http://support.agilebits.com/discussions/1password-in-mac-app-store/3377-how-to- reinstall
    http://support.agilebits.com/discussions/1password-38-for-mac-from-agilebits-web site/13769-reinstall
    http://support.agilebits.com/discussions/1password-in-mac-app-store/2394-reinsta lling-1-password
    Hope that helps.
    D'oh!  Mende1 beat me to it! 

  • I connected my iphone 3g to itunes which was in 4.1 firmware and itunes ask for an update which i downloaded an updated the phone to version 6.1.3 but my phone cannot start it shows no service my sim card is not getting network and i cannot use the phone.

    i connected my iphone 3g to itunes which was in 4.1 firmware and itunes ask for an update which i downloaded an updated the phone to version 6.1.3 but my phone cannot start it shows no service my sim card is not getting network and i cannot use the phone. what should i do.?

    First, you do not have a 3G if you could upgrade it to 6.1.3, because 4.2.1 is the last version that will work on the 3G. So you either have a 3GS or you somehow hacked the phone to install an incompatible version. You can check the model you have by entering your serial number here: https://selfsolve.apple.com/agreementWarrantyDynamic.do
    Assuming you have a 3GS the most likely reason for your problem is you have a gray market phone that was hacked or jailbroken to unlock it. When you upgraded it you removed the hack, so the phone is now locked to its original carrier.

  • I have a IPhone 4S. About a week ago my wifi wouldn't let me slide it to on. And my personal hotspot won't work. AND I PAY FOR THAT every month. I'm not going to keep paying for it if it doesn't work. What's the point?

    I have a IPhone 4S and since about a week ago my wifi wouldn't let me slide it to the on side and my personal hotspot doesn'tI don't live in Quincy anymore:( but I'm game some weekend! work either. AND also I see a lot of other people with the same problem. And I PAY FOR IT EVERY MONTH . I'm going to stop paying if You can't help me thanks.

    Is your wifi greeyd out; have you attempted to reboot the system?

  • Ipod Shuffle 3rd gen is working great and is perfect for my needs

    I just wanted to post that my iPod Shuffle 3rd gen is working great. No problems and I love it. I use it mainly for listening to podcasts. As soon as I turn it on it begins on the podcast I last listened to --where I was in the middle of the podcast. I stick the Shuffle in my pocket and all I ever have to do is use the headphone controls to pause, move forward or backward in the podcast, skip to the next one, or go back to the beginning, etc. I also love to be able to use the volume control on the headset without having to fumble around for my Shuffle in my pocket where it is safely tucked and won't get knocked off or damaged. I listen to my Shuffle for a few hours a day when doing yard work, household tasks and driving back and forth to work.
    All the features are working just the way they are supposed to on my Shuffle. There are a bunch of negative posts about the Shuffle and I just wanted to say that mine works great and I enjoy it very much. I have had the Shuffle for 4 weeks and have not had any problems whatsoever. I own several other models of iPods (first version Mini, Video 60gb, Nano 1 & 2, Shuffle 1,2,& 3, Touch) But the handsfree/visual free ability of this 3rd gen Shuffle is great and very useful for me.
    Just my two cents.

    Linda,
    No I just use one earbud in my ear. I put the earbud in my right ear--away from the window side and it is also the one with the in-line controls, so that works great. I don't put it on very loud either.
    If I am not listening to a podcast and just want to hear music I sometimes will plug it into a line-in cable, but then I don't have a choice on what I am listening to. It's not a real problem because I like all the songs I have on it anyway. I can still adjust the volume on the car stereo, so that is the way I do it.
    I am watching closely for any accessories that might allow a headphone splitter to work, but nothing so far. I am sure we will see some useful additions in the near future. And by the way, the earbuds that came with it work great in my ears--never fall out and are comfortable to me.

  • TS5329 i did an update on my sons phone and now it is in recovery mode and than refuses to reboot. says it can not restore? it was working fine until it called for this update and while doing it it went into recovery mode?! please help!!!

    i did an update on my sons iphone 4s and now it says it is in recovery mode and that it can not reboot or restore the phone?! it will not power down normal and keeps saying hook to itunes. all i did was an update and it went into recovery mode and will now not restore! how do i fix this???

    Do exactly as it says, connect to a computer running iTunes and restore.

  • HT3180 I just bought an apple tv. installed it. `it worked. Got a message for an update and pressed yes. The apple tv started with please hold , doing preservation, then after a while got message installing. Then nothing, please advice

    Apple tv is not responding. I connected it to my macbook but also I don't know how to set it back to the original settings. The manual says open iTunes and saelect apple tv, WHERE can I find this???

    Welcome to the Apple Community.
    If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
    Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
    Connect the micro USB cable to the Apple TV and to your computer.
    Reconnect the power cable (only for Apple TV 3)
    Open iTunes.
    Select your Apple TV in the Devices list, and then click Restore.
    (You may already have a micro USB cable if you have a camera or other digital device)

  • Help needed for dynamic update form

    I could really use some advice - I've been asked to build a time tracking application (basically a timesheet) and I have a fair bit done but the part I am really struggling with is the best way to accommodate some of the specifications. I am NOT a programmer (I have some coldfusion experience but nothing really advanced) so I have not managed to sucessfully integrate the various methods I've found on the web so far. The database is created and so are all the queries, and I have also written a cfc to handle the drop-down menu logic needed but I don't really know how to integrate it with the form.
    Our production server has ColdFusion MX7 so all the great functionality in the CF8 examples I can't use.
    The issue is the user should ideally be able to add/edit/delete multiple rows at once- I like CFGRID, and the HTML version seems best. The main issue with the Flash version is the scrolling to get to the insert/delete buttons- I couldn't see how to get rid of that. A separate add and edit form could be ok depending on how easy it is to use.
    One problem I have is that I can't work out how to have default values with the grid (the userID which is a session variable, and the date which is constantly changing- there is a cfcalendar for the user to change date).
    The biggest hurdle is the related select drop-downs I need- it's not quite as simple as the city,state,postcode examples. For the first drop down the pick an option- and for only 2 of those options there is a second drop-down. Anything else and it stops there. For the second drop-down, there are 2 options, and depending on which one of these they pick the 3rd drop-down pulls a query from one or another table in the database (2 entirely different things). The three  options have different database tables. The main timesheet table just stores the id number from those tables (so I also need to display the names on the drop-down from the options tables not the number).
    I played with simple and complicated javascript and coldfusion solutions as well, but because it's a form to update records and also because of the above specs I just couldn't get anything to work right. I tried binding with the cfc and nothing would bind, plus I don't know how to make all happen without a page reload.
    Does anyone have any advice for the best approach to this? As I mentioned I've got tables, queries and even a cfc but I'm not too clear on how to put it all together properly within the constraints of MX7.
    PS I also can't post a lot of code because of where I work- I know that's not helpful but am looking for the best approach to this, then I can work on the details. Right now I am jumping from solution to solution and not getting anywhere.

    Well, a lot of code has come and gone because I couldn't make it work, where I'm currently at is:
    <cfform name="updateform" id="updateform" action="#CurrentPage#?#CGI.QUERY_STRING#">
      <cfgrid name="MainData" height="400" insertbutton="add" deletebutton="remove" query="getMainData" insert="yes" delete="yes" rowheight="20"  selectmode="edit" format="html">
      <cfgridcolumn name="id" display="no">
    <cfgridcolumn name="userID" display="no">
    <cfgridcolumn name="entrydate" display="no">
    <cfgridcolumn name="activityID" >
    <cfgridcolumn name="typeID">
    <cfgridcolumn name="projectID" values="#ValueList(getProjects.id)#" valuesdisplay="#ValueList(getProjects.name)#">
    <cfgridcolumn name="time" width="10">
    <cfgridcolumn name="comment" width="150">
    </cfgrid>
    <cfinput type="hidden" name="entrydate" value="#Session.username#">
    <cfinput type="hidden" name="entrydate" value="#editdate#">
    <cfinput name="update" type="Submit" value="Update">
    </cfform>
    ** for some reason getProjects.name doesn't work and causes an error. I haven't worked out how to get the default inputs for the date and user ID to work either. I also tried binding and a flash form somewhere along the way.
    ** the CFC is below, #ds# didn't work and I had to put in the actual DSN name, not sure why, but anyway this is the logic of the thing. Ideally I would like to use this logic with the cfgrid, but I'm not sure if that is possible? It seems like it would be the most user friendly approach.
    The CFC so far is:
    <cfcomponent>
       <cffunction name="getActivities" access="remote" returnType="query">
            <cfquery name="getActivities" datasource="#ds#">
    SELECT * FROM timesheet_activities
    </cfquery>
            <cfreturn getActivities>
        </cffunction>
        <cffunction name="getTypes" access="remote" returnType="query">
        <cfargument name="Activity" type="any" required="true">
        <cfif ARGUMENTS.Activity EQ "">
            <cfset getType = "">
        <cfelse>
            <cfquery name="getTypes" datasource="#ds#">
            SELECT * FROM timesheet_type
            </cfquery>
        </cfif>
        <cfreturn getTypes>
        </cffunction>
        <cffunction name="GetProjects" access="remote" returnType="query">
        <cfargument name="Activity" type="any" required="true">
        <cfargument name="Type" type="any" required="true">
        <cfif ARGUMENTS.Activity EQ "" OR ARGUMENTS.Type EQ "">
            <cfset LstProjects = "">
        <cfelseif ARGUMENTS.Activity EQ "1" OR "3">
        <cfquery name="getProjects" datasource="#ds#">
    SELECT id,name FROM projectsa
    WHERE completed = 'false'
    </cfquery>
    <cfelse>
    <cfquery name="getEProjects" datasource="#dse#">
    SELECT id,name FROM projectsb
    WHERE statusID = '6'
    </cfquery>
        </cfif>
        <cfreturn getProjects>
        </cffunction>
    </cfcomponent>
    Any attempts to actually use the cfc didn't work. I tried to use it with a normal html update form and got the message- failed to bind, Activity didn't exist. I also tried to bind it to a flash grid. The argument for Activity needs to come from the drop-down Activity type selected. Maybe I'm missing something.
    ETA:
    just moved everything to the live MX7 server (because my dev server is Coldfusion8) and I get the following:
    Attribute validation error for tag CFGRID. The tag does not allow the attribute(s) BINDONLOAD,BIND.
    Does this mean I definitely can't use the CFC with the cfgrid on MX7? Or is there a way to do it?
    Any advice would be greatly appreciated.

  • Help needed for data updation in User Defined Tables

    Hello Experts,
    I am developing one add-on in SAP B1 8.8 to input data in a User Defined Table described as under
    Table Name
    DriverMst UDT Type is No Object
    Description
    Stores the Driver master data which are used to get reference in Sale Delivery Form and Driver data management activity
    User defined fields
    Data Name
    Data source
    Size
    Pane Level
    Description
    Driver Code
    Code
    Alphanumeric
    0
    No object table fixed field
    System Name
    Name
    Alphanumeric
    30
    0
    No object table fixed field
    Full Name
    FullName
    Text
    50
    0
    Father Name
    FatherName
    Text
    50
    0
    Birth Date
    BirthDate
    Date
    0
    Phone Number
    PhoneNo
    Alphanumeric
    50
    0
    Mobile No
    MobileNo
    Alphanumeric
    13
    0
    I have created one form using screen painter displaying text boxes and bind them to the table.
    This form is working absolutely fine when there are some data in table (i.e. Browse using navigation)
    My problem is, when I click add button from tool bar the "OK" button turn to "Add" that means the form is set to Add mode, but when I click "Add" button after entering some data nothing happens and input data is not stored in Table. The same "OK" Button turned to "Update" when I do changes in loaded data, but my changes are not reflected to table after I click "Update".

    Thanks Nagarajan,
    None.
    There is no such query. The table fields is directly linked to Edit Box or Combo Box in form.
    From the examples I learned that I have to do something like this to get my table updated
    Dim oUsrTbl As SAPbobsCOM.UserTable
    Dim Res As Integer
    oUsrTbl = oCompany.UserTables.Item("DRIVERMST")
    oUsrTbl.Code = oBPC.Value 'Item Specific of Driver Code Edit Box
    oUsrTbl.Name = Left(oBPN.Value, 30) 'Item Specific of Name Edit Box
    oUsrTbl.UserFields.Fields.Item("U_FullName").Value = oMFN.Value
    oUsrTbl.UserFields.Fields.Item("U_FatherName").Value = oFTHN.Value
    oUsrTbl.UserFields.Fields.Item("U_BirthDate").Value = oDOB.Value
    oUsrTbl.UserFields.Fields.Item("U_PhoneNo").Value = oPHN.Value
    (Similar For rest ofthe fields)
    Res = oUsrTbl.Add()
    Just let me know that is this necessary to do like above.. To be frank there are few more fields and matrices on the form which I didn't mentioned. I am just trying to get recovered from first step to proceed further.
    Regards

  • Shared Capacity For Work Managers and state SUSPEND for ManagedServer

    Hi!
    I have 3 ManagedServers in cluster. I want configure the Overload Conditions for each ManagedServer - set Shared Capacity For Work Managers = 100. So, if the count of concurrent requests will be more than 100 for ManagedServer, this ManagedServer stopes processing new requests (as for sutdown state) and finishes processing the current requests, and all next requests go to a other ManagedServers.
    Could you please tell me how to achieve it?
    Now, ManagedServer changes state to OVERLOAD temporarily, and becoms to RUNNING.
    Failure Action = Suspend this server (dindt help)

    You can consider using the capacity constraint
    capacity - Causes the server to reject requests only when it has reached its capacity. The default is -1. Note that the capacity includes all requests, queued or executing, from the constrained work set. Work is rejected either when an individual capacity threshold is exceeded or if the global capacity is exceeded. This constraint is independent of the global queue threshold.
    Check the below links for more on this:
    http://docs.oracle.com/cd/E12839_01/web.1111/e13701/self_tuned.htm#i1060813
    http://www.oracle.com/technetwork/articles/entarch/workload-management3-087769.html

  • Can't open e-mails/long-time problem/can't delete just does NOT work right and hasn't for some time but today it just keeps loading and loading goes from "done" & I click on an e-mail/starts loading and transferring nothing is working

    I have always had trouble with e-mail. I have deleted cookies, etc. Checked connections. opened firewalls/closed firewalls. I have tried to go thru all the suggestions from Yahoo and Foxfire and this is the first time I have done this. E-mails are a real problem. On a system check, it says computer is working and other programs are working, JUST e-mail system.
    == This happened ==
    A few times a week
    == On and off for 2 months

    Oh no... NOT THE 99-PAGER!!! Anything but THAT!!!

  • ASAP Help needed for iOS4 - Updating without syncing to iTunes

    Right, I'm currently unavailable to access the computer that I sync my iPhone with and cannot access it for the forseeable future as I'm going away from home for a while tomorrow. I need to know if I can sync my iPhone with a computer that is not my standard syncing one that has iOS4 downloaded on it without my iPhone syncing and losing all of my data - and if this is possible how to do it.
    Thanks
    Message was edited by: Wrigle

    You should be ok to update your phone on any pc or mac.
    When you update iTunes will back up your phone to that computer, and will update only the os.
    If you restore though you won't be able to sync your music, photos, podcasts, or apps but your contacts, email accounts and setting will be restored.

  • Help: SQL for Bulk update (lead function)

    Hello,
    I am using Oracle11.2. I would like to update the column hist_dttm of tb_hist with the value of column crt_dttm of tb_base in the next row, which is ordered by crt_dttm. here are the details:
    creat table tb_base(tid varchar2(32), crt_dttm timestamp(6));
    creat table tb_hist(tid varchar2(32), crt_dttm timestamp(6), upd_dttm timestamp(6));
    insert into tb_base values ('AAA', to_timestamp('01-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff') );
    insert into tb_base values ('AAA', to_timestamp('05-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff') );
    insert into tb_base values ('AAA', to_timestamp('16-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff') );
    insert into tb_base values ('AAA', to_timestamp('01-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'), null );
    insert into tb_base values ('AAA', to_timestamp('05-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'), null );
    I am using the following SQL to update the upd_dttm column of tb_hist, I expect the upd_dttm will be updated as ''05-12-05 14:00:00.123456' and '16-12-05 14:00:00.123456'. However they remains in NULL. Any suggestion?
    update tb_hist hist
    set (upd_dttm) = (select lead(base.CRT_DTTM over (Partition by base.tid order by base.crt_dttm)
    from tb_base base
    where base.tid = hist.tid
    and base.crt_dttm = hist.crt_dttm)
    ;

    After some modifications in your sample data
    DROP TABLE tb_base;
    DROP TABLE tb_hist;
    create table tb_base(tid varchar2(32), crt_dttm timestamp(6));
    create table tb_hist(tid varchar2(32), crt_dttm timestamp(6), upd_dttm timestamp(6));
    insert into tb_base values ('AAA', to_timestamp('01-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff') );
    insert into tb_base values ('AAA', to_timestamp('05-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff') );
    insert into tb_base values ('AAA', to_timestamp('16-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff') );
    insert into tb_hist values ('AAA', to_timestamp('01-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'),null  );
    insert into tb_hist values ('AAA', to_timestamp('05-12-05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'),null );The following statement can do the job?
    MERGE INTO tb_hist dst
    USING
      SELECT tid, crt_dttm, LEAD(crt_dttm) OVER(PARTITION BY tid ORDER BY tid, crt_dttm) as d
        FROM tb_base
    ) src
    ON (dst.tid = src.tid AND src.crt_dttm = dst.crt_dttm)
    WHEN MATCHED THEN
      UPDATE SET dst.upd_dttm = src.d;

  • Where do you go for a discussion and help area for Enterprise Manager?

    Ron Schweiger
    [email protected]

    I have been posting enterprise manager questions in this forum for a few week, but it seems not very helpful becasue not many people are replying people questions. So, if you discover another place where people can discuss question regarding enterprise manager, please let me know. Thank You

  • HT4796 When I first bought my iPod, iPhone, and iPad, I had a PC and used that for my updates.  I now have a MacBook Pro and would like to use that for my software updates.  Can I switch from a PC to a Mac for updates, and if so, how do I do it?

    How do change from doing updates on a PC to a Mac?

    Thanks, Sig.  I think I should've been a little clearer.  I've attempted to do the updates on my Mac, but I get a warning that it will erase everything except calenders, email, etc from the iPad.  I've syned the iPad with the Mac with no problem, but get scary messages when I try to do the latest update.

Maybe you are looking for

  • "kernel: 3864 ASYNC INCOMING TCP" message - What is it?

    Since setting up my new 2 TB Time Capsule (4th gen.) last week, I've noticed a message logged in my Console every second or two, in the form: 6:13:48 PM kernel: 3864 ASYNC INCOMING TCP conStatus:0 flags:0 -> from 127.0.0.1:55977 This message is repea

  • HT201270 IPad 1 repeated crashes: Will an update to carrier settings reduce the number of crashes and make my ipad 1 useable again?

    Since updating to iOs 5.1, my iPad 1 crashes so often it is unuseable.  It normally crashes when using Chrome or Safari - but also on other programs such as  MotionX GPS.  I've just "restored" it using itumes - and on the way out was invited to updat

  • Abap workbench-2003 certification

    I should certification for my project requirement .If any one taken certification please help me in this . Give me the details about registeration and the materials to be refered for the exam. Thanks & Regards, devika.

  • Premiere 6 error writing file - disk full?

    have premiere installed on new windows 7 pc. plenty of space. edited short (minute) video. went to render and get this error message saying error occurred while making the movie, eoor writing file...disk full?  saw forums on settings...am clueless as

  • Creating a DLL Driver for Use in VB

    Hi, I am trying to export a dll file for use in VB.  I used the build > dll option within my project to create a dll, but when I try to add the reference to Visual Studio, it says that it is not a valid assembly or COM component and I cannot add it.