Time Sensitive Driven Operations

Hi all,
I'm probably at a low intermediate level in Java.
I'm developing an application which will be open for a long period of time. However, about every 10 minutes, I want it to call a short maintenance method to take care of some other stuff.
However, polling is very inefficient, and hence I don't want to keep comparing System.currentTimeMillis() or a Date object in a while loop, as this would use needless resources that other programs could be using while my program has nothing to do until 10 minutes has passed but compare the time.
This brought me to consider threading and interrupts, something which I have never really delved into before. Any resource that could point me in the right direction would be greatly appreciated.
Perhaps it would be possible to make a new thread object at the end of my main, after all the GUI is built, and immediately make a loop and call sleep on it for 10 minutes and then do my maintenance, and then wait again? Not sure.

>
Perhaps it would be possible to make a new thread
object at the end of my main, after all the GUI is
built, and immediately make a loop and call sleep on
it for 10 minutes and then do my maintenance, and
then wait again? Not sure.Yes. An example:
==================
import javax.swing.*;
import java.awt.event.*;
public class PeriodicMaintenance {
     PeriodicMaintenance() {
          Maintainer m = new Maintainer();
          JButton b = new JButton("Test");
          b.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ae) {
                         System.out.println("Click");
          JFrame f = new JFrame();
          f.add(b);
          f.setSize(400,300);
          f.setVisible(true);
          Timer t = new Timer(5000, m);
          t.start();
     public static void main(String[] args) {
          new PeriodicMaintenance();
class Maintainer implements ActionListener {
     public void actionPerformed(ActionEvent ae) {
          doMaintenance();
     private void doMaintenance() {
          System.out.println("Performing maintenance");
          try {
               Thread.sleep(2000);
          } catch(InterruptedException ie) {
               ie.printStackTrace();
}Note that this example performs the maintenance on the EventDispatchThread (EDT). You'll notice that the GUI is unresponsive for the 2 seconds that the Maintainer is running. If you have long running tasks to perform, use the SwingWorker class which will move the work to a non-EDT thread keeping the UI responsive while the task runs.

Similar Messages

  • Calculate interest on arreast: Time-sensitive interest terms

    Hello,
    Can you please help me. I try to run transaction F.2A  I receive following error message:
    "The table of time-sensitive interest terms is not maintained for the
    following transaction types and interest calculation indicators.
    Interest ID  Trans.type
    Y         CREIR
    (CREIR: Calc. credit interest on arrears; C SAL: Calc.acct bal.cred.interest;
    DEBIR: Calc. debit interest on arrears;  D SAL: Calc.acct bal.debt interest)"
    Do you know what I should do to correct this error?
    Thanks.
    rgs.Markku

    Hi,
    Customer was using z-program for interest calculation and the problem was in that program. Our programmer did some fixing but I do actually know what. There is some place in configuration (you can search it) where you can assign CRED  type to the interes indicators.
    rgs.Markku

  • Need to update the actual start date & time of a operation in workorder

    Hi Experts,
                   I need to update the Actual Start date and Actual start time of a Operation of  a WorkOrder through a Function Module.
    I was looking into the BAPI_ALM_ORDER_MAINTAIN FM, but i couldn't find any field relating to the actual start date and start time of a operation.
    Kindly Suggest me which Function module i can use to complete my task.
    Thanks in Advance
    bye

    Hi,
    It is system's standard behavior and no other MRP type will help you in moving the start date outside the planning time fence. With MRP type P3 new requirements are covered at the end of the fixing period, the end date is set and planed order is scheduled backword. Hence the start date will lie within the planning time fence.
    Rgds,

  • Inserting & Deleting in Trees?? Time sensitive issue

    We have a tree that is populated with information linked to a client. When the user clicks on a node, it populates a block to the right with that data. Then the user can manipulate that data on the block to the right. If the users inserts a new record in the block on the right, in the key-crerec trigger for that block, I am also inserted a node into the tree with "[] New Item" as the Label and "0" as the value. My question is how do I delete this node if the user decides not to save. For example, they insert a new record, fill in all the data and then click on another node in the tree (to see it's data). The form pops the message "Do you want to save your changes?" (this message is coming from FORMS not me. If the user says "No". The record is not saved but the node still appears in the tree. Where do I put the code to delete the node?
    Any help would be greatly appreciated. This is a time sensitive issue.

    Just a guess (never did that before) - servlets are server-side code. As you already suspected, it's looking for that c:\... file on the server, not on the client. Shouldn't you instead get the upload (input) stream from the request?

  • ERR Driver Status: (Hex 0xBFFA2003) Max Time exceeded before operation completed. (TEK DPO2014)

    Hi NI.
    I'm trying to aquire signals from an Tektronix DPO2014 oscilloscope using Labview SignalExpress.
    I have downloaded and installed the appropriate driver (at least I think )) : tkdpo2k using NI download station.
    I run an ethernet connection and I do see the device in MAX, however im not quite sure if I have configured the IVI driver sessions correctly.
    Anyway, when I open Signal Express, and select "IVI scope aquire" I can select my device under "resource descriptor" and the appropriate driver under "Instrument driver". I then turn on my Oscilloscope, tune in the machines tachogenerator, which is the signal the oscilloscope is to measure, and then select "autosetup" The sinosoidal waweform shows up on the oscilloscope and in SignalExpress, it is only done once. I then try and run the program and the error message accurs:
    Timeout.
    <ERR>Driver Status:  (Hex 0xBFFA2003) Max Time exceeded before operation completed.
    Is the problem regarding problems with triggertime or write/read problems with the TCP/IP connection?
    What can I do to fix this problem?
    Best Regards
    Danny Joergensen
    University of Aalborg Denmark
    Attachments:
    MAXscreenshot.png ‏265 KB
    device.png ‏320 KB

    How are you communicating? GPIB? Are you sure you have the correct address. Can you send an IDN command with MAX? Does MAX see the instrument?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Lines During Capture? (Time Sensitive)

    Hi - I'm capturing HD video off miniDV into PProCS4 and I see these "lines" in the picture every time there's motion (panning, quick zoom) in the shot.  However, the picture looks perfect on the little camera screen.
    Does anyone have any ideas how to fix this?
    Thanks in advance for your thoughts!  (This is for a Christmas video, so this is time sensitive!)

    Thank you!
    I'm going to send the finished piece as a video Christmas Card over the internet - just in case that matters.
    So if I keep it interlaced, will it look right after export?

  • Time sensitive in App purchase not working - Help Fast

    Trying to purchase a time sensitive in app purchase and I get a msg saying "Your purchase could not be completed". Then I get a msg saying "Notice Cannot connect to iTunes store"  Need this resolved ASAP to make my purchase.

    If you are also getting a message to contact iTunes Support then to do so (these are user-to-user forums) :
    - go to http://www.apple.com/support/itunes/ww
    - click on your country's flag
    - click on the Contact Support at the bottom of the left-hand column
    - click on Contact iTunes Store Support on the right-hand side of the page
    - then Purchases, Billing & Redemption

  • Old External to New MBP cable question (Time sensitive)

    I have a new MBP (purchased late january 2011). New external drives all connected properly and working. However, I need to access some old files for tax purposes (and that is why this is a time sensitive question.) These files were kept on a 60GB, small, portable drive: SmartDisk FireLite Model #FWFL60-N. This drive connected to my old MBP with a 4-pin firewire cable (wire has IEEE 1394 printed on it.) Obviously that cable is outdated for my new MBP. Question: Is there some type of wire (or conversion adaptor) I can purchase that will allow me to connect this old drive to the new computer? I never thought I'd need those old files -- but tax season has me scrambling for help or advice. Thanks!

    You need a 9-pin to 4-pin cable or adapter. For example this one from Macsales.
    [http://eshop.macsales.com/item/Newer%20Technology/1394B94036/|http://eshop.macs ales.com/item/Newer%20Technology/1394B94036>
    Similar are available from Amazon and other places. [Best Buy lists one (for a higher price)|http://www.bestbuy.com/site/Dynex%26%23153%3B-+6'+FireWire+9-Pin+to+4-PinCable/9539092.p?id=1218121950002&skuId=9539092&st=firewire&cp=1&lp=4]so if you are near a Best Buy, perhaps they'll have it in stock, if you need it sooner.

  • Data folder can not be opened in finding " AirPort Time Capsule " The operation can not be completed because the original item for " data" does not exist .

    Hi
    I have a " AirPort Time Capsule " (firmware 7.7.3) When I try to open the data folder in "finder". Then I got the message  " The operation can not be completed because the original item for " data" does not exist". I have a lot of data and I can understand why I get this message?
    Anyone who can help? Thanks..
    Br. Bo

    Get a USB drive of 2TB or more.. assuming your TC is 2TB. Either preformatted Mac or plug into your Mac and format it standard Mac OS Extended Journaled in disk utility.
    Do a full archive of the TC. You do this using airport utility. Do not click the erase disk.. I marked in green.. just the archive.. that is to backup the internal disk to the USB disk. It is not fast.. take it that the process will go at around 40-50GB/hr.
    Once you complete the archive .. it is a direct image of the data on your TC.. you can then plug it into your computer directly.. and then try and open the files you lost.. if you cannot open them.. open disk utility and fix the permissions.
    http://osxdaily.com/2015/01/13/repair-disk-permissions-mac-os-x/
    Or try the methods apple recommends..
    OS X Yosemite: Set permissions for items on your Mac
    It is possible to fix things on the USB drive because it is locally mounted.. but you cannot fix it on TC which is network drive.

  • Changing a custom report to be time sensitive

    Hi
    I posted this in FI too thought the MM people might have some inputs as to how to correct the Zvenclass if we use the standard SAP field on the accounting view table LFB1 MINDK minority indicator
    We need to change the custom report zvenclass, it is a report that tells us the amount spent for each vendor in a specific class. I have the date/time sensistive information for the amount spent but not the change in vendor class from the vendor master. I need this to be date driven too. As in if a vendor is a small business in 2005 and you change the vendor to be a large vendor in 2011. Then I want the report for dates and values in 2008 to show small business and the dates and values in 2011 to show large business.
    The assignment is not time dependent, it has to be manually changed.
    I did see through the CDHDR and CDPOS tables, but could not pinpoint to the changes in the valuation classes.
    Is there any other way if I can find whether I can find the changes?
    Now I did review the values from the custom tables, here I find that there is a difference in the sum totals of the postings when I add up the individual years compared to the consolidated report (for ex: 200720082009 is not equal to 2007 to 2009) so am I right in assuming that the system does account for the changes. Any other help in this regard would be appreciated.
    Any inputs on this will be appreciated.
    Thanks

    We are trying to solve this by altering the code for the report.
    Will update if it works though.

  • How to maintain time spec.of operations in routing and work centers

    Dear consultants,
    We dont have any time specifications in routing or work center ..
    we just create an order and the execution of the production involves many operations....
    now we want to be specific about the time of operations as the need is to track the operations.( In the sense which of the operations are delayed).....
    How and where should i do these in the routing and workcenters..
    Please explain in detail....
    Karthick

    Hi Karthick,
    In your work center in basic data page you maintain std. value key eg: SAP1, this has Setup Machine & Labor fields. In the default values page you specify the unit of measure Eg: HR
    Now when you add this work center in your routing operation page, you will find Setup Machine & labor, here you maintain the time required for each of the process.
    Now while doing confirmation via co11n, you inform the user to specify the time actually spent on each of the activity. In OPK4 for order type - plant combination you can specify a few defaults such as propose the value etc.
    Hope the above is clear.
    Regards,
    Vivek

  • Execution of Coded UI scripts with least possible test execution time in Windows7 Operating system using Visual Studio Test Agent 2010 without VS2010 installed

    Hi All,
    We are trying to execute coded UI scripts without Visual Studio installed. We are using “Visual Studio Test Agent 2010” for executing coded UI scripts without VS2010 in Windows 7, it is working fine. Also we verified executing the same script with VS2010
    Premium, it works fine as well.
    Here the challenge we are facing is with the Test execution time.
    When we run the coded UI script with IE11-Windows 7 OS-Visual Studio 2010 Premium it takes
    3min 36sec to complete the execution whereas with IE11-Windows 7 OS-Visual Studio Test Agent 2010  it takes
    6min 40sec for the same script to execute (which is almost double the time it takes while executing using VS2010).
    My question is what may be the reason for this difference? and how we can reduce the test execution time when running from Test Agent 2010?
    Kindly let us know what is the best practice to execute the coded UI scripts with least test execution time in Windows 7 Operating system using Visual Studio Test Agent 2010 without VS2010
    installed.
    Looking forward for your positive response.
    Thanks in advance..!!

    Tina-Shi, Thanks for the information.
    As you mentioned, we tried to execute the coded UI test using Mstest.exe in command on VS2010 Premium and checked on the execution
    time, there was a slight difference.
    Please find below execution time.
    Using Mstest.exe in command on VS2010 Premium/Win7 – 3.47 minutes
    Using VS2010 Premium/Win7 – 3.53 minutes
    Using Test Agent/Win7 – 7.3 minutes
    Also, I closed all the other processes in Task manager before starting up the execution.
    Still , I am facing the same Issue. Could you please suggest any other way to reduce the scripting time of coded UI script execution
    through Test agent 2010.
    Looking forward for your earliest response.

  • Change over time setup between operations

    Hi,
    1) In the Discrete MFG process, there 2 operations. In between there is a change over time or cleaning up time.
    Where do we capture these change over or cleaning timings?
    2) If i have 2 simultaneous operations, how do we handle them in routing?
    Thanks,
    Jey

    Here are a few sites with various Motion tutorials:
    http://www.motionsmarts.com/
    http://applemotion.net/
    http://www.kenstone.net/fcphomepage/fcp_homepageindex.html

  • It is my first time updating an operating system on my mac.will lion delete my files off my hard drive when I upgrade to lion?

    I reccently bought my imac around christmas of 2009, and this is the first time I have ever upgraded the operating system on my mac. will upgrading to lion completely wipe out all the files and data on my hard drive?

    No, it won't. But you should make a backup of your files, document your settings and check application compatibility.

  • Time Schema & PCR - Operation Help

    Hello Gurus,
    I have a scenario where in I have to change the processing type / time type class in a PCR. I know that the configuration can be done for this in table T555Y table for this. But my requirement is that I should be doing this in a PCR in the custom schema. I am looking for a operation like colop XXXX , which changes the time type. I need to change the processing type / time type instead.
    FILLP operation does not serve the purpose as it can change the processing type entry in TIP table but not the processing type / time type entry in TIP.
    Any help in this regard is much appreciated.
    Thanks,
    Saroj.

    Hi,
    although SAP - documentation provices the following info:
    The processing type/time type class is determined when the time data i
    imported. For absence and attendance records from infotypes 2001/2002,
    this class is read according to the subtype in the "Absence: Time
    Evaluation" table (T554S), in the "Processing type/time type" field.
    For all other time data, field TIP-CLTIM has an initial value of "00".
    Field TIP-CLTIM can be queried using operation OUTTP and changed using
    operation FILLP.
    I can't figure out which parameter to use. Nor via documentation nor via some searching in the relevant coding for operation FILLP.
    Wilfred.

Maybe you are looking for

  • QM Notification and EXIT_SAPMIWO0_020 ( Save Notification )

    Hello. i'm using the customer exit EXIT_SAPMIWO0_020 in XQQM for generating an email when the notification is saved. Now i want to add the partner I_PARNR in the structure RQM02. I know that we can call the following statement to get the partner: SEL

  • Data transfer between EREC 606 and HR system EHP5

    Hi All, we have similar scenario to the discussions: http://scn.sap.com/thread/3513535 http://scn.sap.com/thread/3513421 with that abbreviation that out system hosting partner has recommended EREC 606 as the right level. The main reason was as I reca

  • How do I remove the VESA over for a Touchsmart 520-1070

    Hello, Recently I had encountered a problem with my wireless keyboard and I was to check on the wireless receiver but however I cannot seem to get the VESA cover open, any help would be appreciated.

  • May be off topic ?

    I am creating a web site for a church that I belong to and I have been asked if there is any way to put recordings of sermons on the web site. I have no idea what sort of equipment/software would be needed to do this. I am guessing that the source wo

  • RFBIBL00 - change/overwrite parked document ?

    Hi there, As the topic says, is it possible to change/overwrite a parked document using RFBIBL00, if so, how ? I managed to park a document (BBKPF-TCODE = 'FBV1'). Tried TCODE='FBV2' but this transaction is not supported. Tried TCODE = 'FBV1' and BEL