How to control the sleep time exactly

i have a thread that sleeps for 15 minutes and wakes up does some thing( send some mails ) and sleep. the problem i am facing is the thread is not running exactly in 15minutes intervals.
EX:
14:12:06
( no mails sent )
14:27:06
( no mails sent )
14:42:06
( sends some mails )
14:57:29
(no mails )
15:12:29
so that means whenever there is some processing to bo done (sendng mails ) it takes more than 15minutes.
how to control this sleep time to exactly 15 minutes no matter what it does ?

If you need exact time to elapse, you have two options:
1. use util.Timer set at fixed intervals;
2. mark current System.millis (I never remember exact terms) when sending starts and then adjust sleeptime every time you are going to send next mail. Here you can find info on this
http://developer.java.sun.com/developer/Books/threads/
Ch. 9 swing counter (note that it does not apply to swing only, it's just technique).

Similar Messages

  • How to control the looping time of the for loop in 10 microseconds in labview?

    I need to create a +/- 9 volt square wave with period of 20us using a D/A card (Not NI card). I can write command to the card using outport provide by Labview. Right now, I can generate square wave with 4ms period which is limited by the resolution of the wait until next ms icon I used inside the for loop. Could anyone tell me how to control the execution time of the for loop to about 10 us? Your help would be much appreciated.

    I'm not sure if this will hep, but this answer seems to answer this question
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000029410000&UCATEGORY_0=_30_%24_12_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=microsecond+resolution+1ms&USEARCHCONTEXT_QUESTION_S=0

  • [Urgent!!]How to control the running time??

    Hi,
    I'm an undergraduate researcher in the University of Michigan. I used NI labVIEW FPGA on my current project and now i meet a problem.
    I have a labview code that has runs with 3 subroutines. they execute one after another for a given time period for each iteration of the entire code. that is i built them in a flat sequence structure inside a large while loop and each of the subroutine is a while loop with several subvi's in it. not that complicated but i have to specify how long each subroutine runs. now i have a problem to set that execution time. i don't know exactly what kind of timing function i shall use. i tried the "Elapsed time" function but that only works for the first iteration. from the second iteration on each subroutine only runs for once, instead of continuing to run until the given time elapsed. so i don't know how to correctly control the running time. It's reallly urgent, so could you please give me some suggestions about it? Thanks a million!!
    Xiaofei

    Thank you for your suggestion!
    sorry but that this method won't help because my code is sort of difficult to put into a for loop .
    the logic is like this: first the output is set to 0 for a user-defined amount of time (means no excitation). secondly it gets excitation and gets output but no data saving is allowed for a user-defined amount of time. at the same time, one paramater is automatically changed. (the reason for not saving data is that there is a transient response when the parameter changes). thirdly, data saving begins with the same
    parameters as before, also for a user-defined amount of time. and then after these three steps one iteration is done. for iterations there is a different parameter, the user defines the range of the parameter and the number of different values in between and the code will do the increment at equal intervals automatically. my problem now is that i don't know how to correctly control the time. i have tried various ways but no one works.
    the second problem is that i don't know how to let it run and not saving data and then saving data without changing everything else. what i have now is to call the same VI twice, once for only running and no data saving and the other for saving data. but then the problem is that in between these two routines, the output suddenly becomes zero and gets excited again after i call it.  My professor said that i cannot let the output become zero, otherwise there is no meaning in waiting for the excitation to become stablee. but then i don't know how to call a VI only once and let it do the saving for only the latter part of the running time. i have been working on this thing for two weeks now and still have no idea....Sorry the problem is long and tedious, but if anyone have any idea about it, please let me know, i will be most grateful. Thanks a million!!!

  • Pxie-6556 - How to control the rise time in the digital lines (hsdio)

    Hi,
    Is there any way to control the rise time in the PXIe-6556 digital lines?
    Even in a low frequency signal 10kHz the rise time is about 2ns.  
    Tks,
    Solved!
    Go to Solution.

    Hello engfpe,
    The PXIe-6556 is a 50 Ohm system, meaning the output is source series terminated to be 50 Ohms and all our cables and accessories are 50 Ohms.  With this setup regardless of the data rate you should have a clean rising or falling edge regardless of the data rate. The quality of the output (rising or falling edge) at your device will be related to the impedance matching of your cables. 
    The PXIe-6556 cannot adjust the slew rate by itself.  However you can insert some simple passive components to do this for you.  I've attached below to images.  The first is a schematic showing one way of slowing down the edge.  The second is the a simulated waveform showing the original edge rate before slowing it down, and the slowed down edge.   This simulation is not of the PXIe-6556 but instead a generic digital output for concept.  In the schematic R1 is set to 34 Ohms because U1.8 has the additional 16 Ohms inside it.  TL1 is the 50 Ohm output simulating the cable on the PXIe-6556.  R2, R3 and C1 are components you could insert after the PXIe-6556 cable before it goes to your device/cables.  In this setup the cable going to your device is TL2 which is also 50 Ohms but it could be another impedance in which case you would change R3 to match.
    You can see in the attached images you can significantly slow down the edge with this setup by altering C1.  I hope this helps,
    Jesse O. | National Instruments R&D
    Attachments:
    edge_compare_schematic.jpg ‏94 KB
    edge_compare_waveform.jpg ‏44 KB

  • How to control the maximum time that a dynamic sql can execute

    Hi,
    I want to restrict the maximum time that a dynamic sql can execute in a plsql block.
    If the execution is not completed, the execution should be terminated and a exception should be raised.
    Please let me know, if there is any provision for the same in Oracle 10g.
    I was reading about Oracle Resource Database Resource Manager, which talks about restricting the maximum time of execution for Oracle session for a user.
    However I am not sure, if this can be used to control the execution of dynamic sql in a plsql block.
    Please provide some pointers.
    Thank you,
    Warm Regards,
    Navin Srivastava

    navsriva wrote:
    We are building a messaging framework, which is used to send time sensitive messages to boundary system.I assume this means across application/database/server boundaries? Or is the message processing fully localised in the Oracle database instance?
    Every message has a time to live. if the processing of message does not occurs within the specified time, we have to rollback this processing and mark the message in error state.This is a problematic requirement.. Time is not consistent ito data processing on any platform (except real-time ones). For example, messageFoo1 has a TTL (time to live) of 1 sec. It needs to read a number of rows from a table. The mere factor of whether those rows are cached in the database buffer cache, or still residing on disk, will play a major role in execution time. Physical I/O is significantly slower that logical I/O.
    As a result, with the rows on disk, messageFoo1 exceeds the 1s TTL and fails. messageFoo2 is an identical message. It now finds most of the rows that were read by messageFoo1 in the buffer cache, enabling it to complete its processing under 1s.
    What is the business logic behind the fact that given this approach, messageFoo1 failed, and the identical messageFoo2 succeeded? The only difference was physical versus logical I/O. How can that influence the business validation/requirement model?
    If it does, then you need to look instead at a real-time operating system and server platform. Not Windows/Linux/Unix/etc. Not Oracle/SQL-Server/DB2/etc.
    TTL is also not time based in other s/w layers and processing. Take for example the traceroute and ping commands for the Internet Protocol (IP) stack. These commands send an ICMP (Internet Control Message Protocol) packet.
    This packet is constructed with a TTL value too. When TTL is exceeded, the packet expires and the sender receives a notification packet to that regard.
    However, this TTL is not time based, but "+hop+" based. Each server's IP stack that receives an ICMP packet as it is routed through the network, subtracts 1 from the TTL and the forwards the packet (with the new TTL value). When a server's IP stack sees that TTL is zero, it does not forward the packet (with a -1 TTL), but instead responds back to the sender with an ICMP packet informing the sender that the packet's TTL has expired.
    As you can see, this is a very sensible and practical implementation of TTL. Imagine now that this is time based.. and the complexities that will be involved for the IP stack s/w to deal with it in that format.
    Making exact response/execution times part of the actual functional business requirements need to be carefully considered.. as this is very unusual and typically only found in solutions implemented in real-time systems.

  • How to control the starting time in terms of expression?

    Hallo again!
    I know there must be some ways to trigger the expression to start not immediately, but at any time I wish.
    For e.g. I have here a code:
    veloc = 35;
    amplitude = 30;
    decay = 1.0;
    y = amplitude*Math.cos(veloc*time)/Math.exp(decay*time);
    value + [0,y]
    And I would like to delay the start in 2sek not just by pulling the layer to the right, but to do it in terms of a code.
    Could anybody give me a hint?
    would be very thankful

    I think this is more what you're looking for:
    timeToStart = 2;
    t = time - timeToStart;
    if (t >= 0){
      veloc = 35;
      amplitude = 30;
      decay = 1.0;
      y = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);
    }else{
      y = 0;
      value + [0,y]
    Dan

  • How do I get to the sleep timer settings on iPad?

    THe very first time I turned on my new iPad, I was offered the chance to change the timeout value of the sleep timer; how many seconds or minutes of inactivity before the iPad puts itself to sleep.  I changed it from 15 seconds to 'Never' and now I can't find the config screen that allows me to alter the value.
    There must be a config screen somewhere. I remember it having about 10 settings; with  'Never' being the last.

    Yes but auto lock doesnt work in BBC iPlayer or youtube for example while watching a video. What if i want it to sleep while watching something? How do i do that?

  • How to control the opening form multiple times

    Greetings to all,
    I used Open_Form to open the form in my 'Menu.mmb'.
    My Question is:
    How we control the opening of a form from multiple times?
    Ex:
    In my menu.mmb I used OPEN_FORM.If we open the form,which was already opened ,I want to stop the form to open. How to do this?
    Thanks,
    Bhujendra

    pls try with
    FIND_FORM('EMPDETAILS1');
    OPEN_FORM('C:\INH\EMPDETAILS1');
    jeneesh                                                                                                                                                                                           

  • Any ideas on how to control the amount of sustain pedal data that Logic Pro 9 records? Every time I press the sustain pedal down, it records 4 sustains. Same thing when I release the pedal. Thanks!

    Any ideas on how to control the amount of sustain pedal data that Logic Pro 9 records? Every time I press the sustain pedal down, it records 4 sustains. Same thing when I release the pedal. Thanks!

    This gets confusing, you have two Macs with different issues and two pedals with different issues? First let's sort out what's what. So, do the issues come from the pedals or from the Mac software? To find out, simply switch the pedals and note their behaviour. No change: it's the software, change: it's the pedals (imho the most likely scenario).
    Second, what kind of pedals are they? Can you name the type of pedal too? The Yamaha what and the Mgear which?
    Third, with the 4 fold data problem, are the doubled events simultaneous, or a few ticks apart, or more?
    Also, you have no MIDI keyboard? Are the pedals both "standalone"?
    I think you have to sort this problem at its' source, which are the pedals. You could, if push really comes to shove, perhaps create some sort of ingeneous/elaborate transformer setup in the environment to filter the extra messages, although with the 4/4 sustain events that may not even be possible. With the "stepped" events you could set up a filter to just block all events with values 20-110 or so.
    But much better would be to configure the pedal(s) correctly.

  • How to control the measure based on the related dimension.

    Hi Experts,
    In order to improve performance, I have created three kinds of time tables in DB,such as Year .Month, Day.
    Then import them into the physical layer in RPD, and combine them into one dimension in BMM.
    Actually, it has three level fact related with three time tables,so they are also dragged into one fact in BMM,and one column will be corresponding with three column derived from different Fact table in physical layer.
    So I want to know how to control the measure based on the related dimension.
    For example:
    when users drag the Year,Sales column, it will come from Year Dimension and Year Fact Table.
    when users drag the Month,Sales column, it will come from Month Dimension and Month Fact Table.
    when users drag the Day,Sales column, it will come from Day Dimension and Day Fact Table.

    Hi,
    Create a dimension Hierarchy, with Year >> Month >> Day Levels and
    Next Double click on Year Table LTS >> click on Ocntetnt Tab >> set as Year
    same way for Month LTS and Day LTS.
    So now when you select year column then server canknow which LTS to hit and Hits Year LTS.
    Mark If Helpfu/correct
    Thanks.

  • How to control the size of live data in Coherence?

    How to control the size of live data in Coherence?
    See the following statement:
    Pause times increase as the amount of live data in the heap increases. We recommend not exceeding 70% live data in your heap. This includes primary data, backup data, indexes, and application data.
    --Excerpted from http://coherence.oracle.com/display/COH35UG/Best+Practices                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    In any Java program, it is good practice to make sure your live objects leave some room in the heap for "scratch space." Without this, you will spend too much time in GC, and, in the worst cases, run out of memory. In the general case, you can see how much live data your application requires by looking at the heap used after a full GC's. For Coherence, you should ensure that live data, as you say, is under 70% of the maximum heap size.
    Coherence provides you tools to help enforce this policy. [http://coherence.oracle.com/display/COH35UG/local-scheme] describes how to size limit your cache. By implementing an eviction policy, you can control what happens when a size limit is exceeded.

  • How could control the scroll events in ALV OO?

    Hello experts!
    I'm programing a report, inside there is a field that need time of processing. I'm using ALV OO.
    I have thought that it could only calculate the field for the lines that visualize.
    How could control the scroll events to calculate the field of the visualized lines?
    I'm using CL_SALV_TABLE class and cl_salv_events_table to control the events, but there aren't any event to control the scroll.
    best regards!

    Hi Sriram,
    I did view the information that you was attaching, but this don't resolve my problem. With methods get_scroll_info_via_id and set_scroll_info_via_id, we can get and put information of selection and view rows in the screen but we don't control when the user click in the scroll for advance or to back down a page.
    I would like to refresh the data in ALV when the user view news rows.
    I want your genial ideas.
    Best regards!

  • How to increase the waiting time for response in Adapter Engine not in IE

    Hi Experts,
                It is a SOAP to Proxy Synchronous interface. SOAP system is sending the request to PI, PI sending the same request to ECC system, After execution of some logic response back to PI in 7 minutes. In ABAP Stack(sxmb_moni) processing the response message also successfully with success flag after completion of these 7 minutes. But exactly 5 minutes later getting the error at Java Stack RWB- in communication channel monitoring i.e
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessageExpiredException: Message bd2bf8d0-b2c2-11e0-c383-001cc4fb5cb7(OUTBOUND) expired.  We have set the "runtime-HTTP_TIMEOUT" parameter as 3600. thats why in Integration engine it is processing successfully.
    kindly suggest me how to increase the waiting time for response in Adapter Engine. Exactly after 5 mins getting the above error in rwb, but in Integration Engine getting successful flag after 7 mins until then it is waiting for response with  status flag Log version.
    Thanks & Regards,
    Srihari.

    Hi,
    Please see
    How To... Investigate Timeouts In Synchronous XI/PI Scenarios
    It will answer all your queries
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c059d583-a551-2c10-e095-eb5d95e03747?QuickLink=index&overridelayout=true

  • How to control the size of SVG images in epub files?

    There is unfortunately no support for SVG files in InDesign.
    Most of my images in jpg convertes nicely, but the small ones do not.
    Therefore I want to use SVG files which I have created in Illustrator.
    But how do I set the size in the epub file? Right now, whatever I do, they come out too big and I don't know how to control the size.
    Is there a program, like Sigil or other, that can place the image for me - I'm no html wizard you see....

    In any Java program, it is good practice to make sure your live objects leave some room in the heap for "scratch space." Without this, you will spend too much time in GC, and, in the worst cases, run out of memory. In the general case, you can see how much live data your application requires by looking at the heap used after a full GC's. For Coherence, you should ensure that live data, as you say, is under 70% of the maximum heap size.
    Coherence provides you tools to help enforce this policy. [http://coherence.oracle.com/display/COH35UG/local-scheme] describes how to size limit your cache. By implementing an eviction policy, you can control what happens when a size limit is exceeded.

  • How to control the number of instances of an object ?

    Hi all,
    Can anybody answer, How to control the number of instances of an object being created?
    suppose at any point of time, if i would like to have 5 instances at the maximum, how can i disable the further requests?
    Thanks in advance
    Pradi

    write a factory method that controls the number of instances for you:
    import java.util.List;
    import java.util.Arrays;
    public class Bar
       private static final int MAX_BARS = 5;
       private static int numBars = 0;
       private int id;
       public static void main(String [] args)
          try
             int numBars = ((args.length > 0) ? Integer.parseInt(args[0]) : MAX_BARS+1);
             Bar [] bars = new Bar[numBars];
             for (int i = 0; i < bars.length; ++i)
                bars[i] = Bar.create();
             System.out.println(Arrays.asList(bars));
          catch (Exception e)
             e.printStackTrace();
       private Bar() { this.id = numBars++; }
       public String toString() { return "I am bar number " + this.id; }
       public static Bar create()
          Bar nextBar = null;
          if (numBars < MAX_BARS)
             nextBar = new Bar();
          return nextBar;
    }%

Maybe you are looking for

  • Error while reading empty value in DOM

    While I try to read an xml file with data similar to this <DisplaySettings> <Option1>Company</Option1> <Option2>Author</Option2> <Option3 /> <Option4>Project</Option4> <Option5>Reference</Option5> </DisplaySettings> when it comes to assigining data f

  • How to setup printer (HP LaserJet P1102w) on Wine?

    I have installed and working printer on my arch. But when I trying to print from Wine, got error that no printers installed. And this log in console: $ wine notepad fixme:winspool:WINSPOOL_EnumPrintersW We don't handle PRINTER_ENUM_CONNECTIONS Accord

  • 55HT1U LCD TV - how to play home videos from external hard drive

    Hey guys, I'm connecting my external hard drive to my 55HT1U LCD TV via HDMI to watch home movies. The TV is able to recognize the external drive, I'm able to browse folders and see pictures, but the movie files are not recognized! Does anyone know w

  • Error in BW x ECC (EHP4)

    We made two refresh P56 (ECC) -> Q56 (BCS) and PWU (BW) -> QWU (BW) But not reestablish communication between Q56 and QWU. Before re-establish communication gets upgraded EHP4 in Q56, which was successful. After the upgrade we made the connection bet

  • Error Creating Work Area in JDeveloper for SCM

    In the Repository Object Navigator for 9i SCM, my userID has been granted the the following permissions to a shared work area called pdshare by the owner/build manager: Select Administrate Insert Update Delete Version Compile Update Spec. However, in