Force servlet to do afunction at specific time

Can I force servlet to do some function at specifig time? such as I want my servlet to execute function1 at 12 o'clock everyday

Like any class, you can make it multithreaded and spawn a thread that loops infinitely, waking up at the desired time, performing an action, and then sleeps again.
However, your doGet(), doPost(), doService(), methods are only called in response to a request to the web server. Therefore, these aren't the best methods to place that kind of code in.
You will probably want to kick off a thread in your init() method in the servlet. This launches as soon as the servlet is first loaded (you can preload it in your web.xml). I still don't recommend using the servlet for this type of process though. Better to create a class that extends thread and have the servlet launch it than to use the servlet itself. Servlets are supposed to answer web requests, nothing more. Mixing that functionality is asking to mixing model and view, which might be ok in some circumstances, but probably not in most.

Similar Messages

  • Servlet that executes at specific time intervals ?

    Hi
    I need to have my Servlet that is loaded onto the webserver, run at specific time intrevals, say every 10 minutes.
    How do I do that ?
    Thanx in advance
    Aragorn

    I have trouble with this concept.
    HTTP is a request/response protocol. Usually a servlet runs when it receives an HTTP request and sends back an HTTP response.
    If you want the servlet to wake up and do something at a fixed interval, it's not responding to an HTTP request anymore. What does it do with the HTTP response that's generated? What happens if it receives an HTTP request from an external client after waking up and starting the timed process? Have you made sure that your servlet is thread-safe in that case?
    This feels less like a servlet and more like something else (e.g., an RMI service, EJB, or multi-threaded server). It sounds like you're using the servlet engine/container as a convenient service container, but I don't think servlets were meant to be used that way.
    I'll be happy to take instruction on this if I'm incorrect. I just thought I'd disagree to see what the response might be. Thanks - MOD

  • Auto-Run the servlet class at specificed time

    Hi,
    I am new to Jsp. I remember there is a feature where I define something in web.xml to auto-run a servlet at certain time.
    something like for everyday 4:30am, I want to clear up all the log file in my server.
    Please tell me how to do it or any reference.
    Thank you.

    if you are using a windows machine you can just schedule a task every day at that specified time and just run it. As far as the web.xml file telling the servlet to run at a specified time, I haven't heard of that. I just know that you can tell the server at what precedence you want the loading of the servlet(s).
    Hope this helps. Also, search the forum for more information on this matter. I'm sure that there are more posts on this matter that could assist you further.
    Good luck

  • How to address a specific time in VOD for iOS

    Using Flash and RTMP it's easy to go to a specific time in a VOD stream served from AMS using the seek method.
    Is there similar ability to seek to a specific time in VOD delivered to Safari on iOS?  The native video player provides a currentTime method, but I've not seen documentation anywhere to suggest currentTime or another method to provide rapid and accurate time based access from AMS.
    FWIW, Wowza documentation provides an answer:
    http://www.wowza.com/forums/content.php?326-How-to-specify-a-play-start-time-and-duration- for-HTTP-streaming
    TIA,
    RT

    Nitin, the link you provided is a bit better than nothing, but it refers to the AVPlayer object in applications, rather than iOS delivered data.  In our experience currentTime is a settable property for the native video player in mobile Safari, using a normal progressive uploaded stream, as the documentation shows:
    http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLMediaEle mentClassReference/HTMLMediaElement/HTMLMediaElement.html
    The question is "Are there browser based methods that seek AMS delivered streams more quickly or with better accuracy?" 
    Everyone is aware that mobile is exploding.  On some of our videocentric apps the share for iOS is approaching 20%.  PM Kevin Towes, what are you doing to accomodate this need???

  • How to automatically open and close an application at specific times?

    Hi,
    I am trying to figure out how to open and close an application at specific times.
    I have set iCal up to open it no problem...however, the application needs you to click yes before entering into it upon boot.
    How do I do this and close the app. I tried creating a workflow in automator, but iCal simply opens the workflow and does not play it. This also does not solve the issue of needing the 'yes' button to be clicked.
    Kind regards,

    Hi,
    I am trying to figure out how to open and close an application at specific times.
    I have set iCal up to open it no problem...however, the application needs you to click yes before entering into it upon boot.
    How do I do this and close the app. I tried creating a workflow in automator, but iCal simply opens the workflow and does not play it. This also does not solve the issue of needing the 'yes' button to be clicked.
    Kind regards,

  • Automatically open and quit app at specific times

    I want to open the DVD Player app at a specific time in the morning and have it play a DVD all day (it's looped). I then want the app to quit at a specific time at night. The computer will go to sleep from when the app quits until right before it opens (I have that part figured out).
    Can someone show me how to open and quit the app at specific times or point me somewhere where I can learn how to do this? I'm an AppleScript newbie, so explanations are grateful. I will be using a Mac Mini for this installation.
    Thanks!

    Use iCal alarms to run the following scripts:
    tell application "DVD Player" to run
    tell application "DVD Player" to quit
    Each line is a separate script.
    (25193)

  • How can I perform data logging for a specific time??

    hello everyone,
    I am quite new in labview and I have a basic question regarding data logging. Currently I am using a cRIO9074 and doing some data logging for my test. The data logging it self works ok so far.
    But my problem is I would like to write my datas in a text file either for a specific time interval (ex)10 seconds) or for a specific amounts of data (ex)500 Samples). Can anyone give me some help regarding my problem?? Attached you can find my RT.vi 
    I would appreciate for anyhelp!
    Regards
    Yun 
    Attachments:
    BP250 Encoder Position & Velocity (Host).vi ‏92 KB

    Run your loggging program for that time. When your program terminates then it will write all the logged data so far in text file.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • Is there any way to have a message sent at a specific time?

    Greetings:
    I am trying to figure out if there is a way to send an email to someone (not my own address) at a specific time on a specific date? Essentially I want to compose the email but only have it sent at midnight on December 1.
    Thanks in advance.
    Jeff

    I don't think so, not in Mail.app. However, there is a group of apple scripts available known as "Mail Scripts 2.10" that has as one of the scripts a thing called "Schedule Delivery (Mail)." From the webpage, it states that this script "Allows you to send individual messages at predefined times (this script uses iCal for scheduling message delivery)." I've not personally used it so I'm not familiar with it, but this may be of interest to you.

  • Is there a way to create a smart playlist that lists my top 25 plays from a specific time period (i.e. - top plays from the last 90 days)?

    Is it possible to create an itunes smart playlist that lists my top 25 most played songs in a specific time period (i.e. - the last 90 days)?  It seems that any "most played" list I create counts every spin a track has had in it's history of being in my library. 

    The challenge is is not to determine which of the tracks that have been played in the last X days has been played most since the beginning of time, but which have been played most in the last X days. iTunes can do the first one but it simply doesn't have the power to do the second.
    tt2

  • In setting up my ICal calendar I have specific times (as new events) that I want to be included in the print out.  This doesn't happen.

    In setting up my ICAL calendar I have specific times (as new events) for each day.  When it prints out the time does not show up (rather its a bar).  I would like the time for each appointment to print out. How do I do this?

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    Note if you have failed to move contacts and calendar items across you should create one dummy entry of each in your new profile and iTunes should  merge the existing data from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library or a backup then then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.
    tt2

  • How do you set a calendar alarm for a specific time on the day of the event without it being an all-day event

    Does anyone know how to set a calendar alert at a specific time on the day of the event.
    So that the alert date adjusts accordingly if you were to copy and past it to another date.
    The custom alert function kind of does this, but because it is an absolute alert (not relative) it will still refer to the date you initially set it to when you copy and paste it to another date. So this creates more work where you would have to go and manually change all the custom alerts. I have potential
    Anyone know how to set this kind of calendar alert?
    Thanks in advance

    Greetings: Set the alarm to message you (on your screen) and then snooze it every day for 15 days, or, set 15 separate alarm messages. There is probably an AppleScript somewhere on the web too, try searching that way as well.

  • Server 2008. How do I create a task to turn the server on at a specific time?

    I'm running Server 2008 R2 Standard, SP1.
    The electricity is scheduled to be turned off in my building for a couple hours over night.
    I can shut the server down, but was wondering if there was a way to 'schedule' my server to turn itself on at a specific time the following morning?
    Thank you

    Hi,
    Windows cannot turn itself on. it can resume sleep, but even then relies on the underlying hardware to do the boot.
    i would recommend checking whether the BIOS (or EFi for that matter) supports scheduled boots 
    Alternatively, you can check BIOS whether you can configure the powerstate the computer needs to be in after power is restored; most computers do support that.
    MCP/MCSA/MCTS/MCITP

  • How do I set iCal alerts to a specific time the previous day, regardless of their specific time (so I can get an overview of tomorrow)?

    I think it would be incredibly useful to be able to get at, say, 10pm each evening, a pop up overview of the next day's events. I'm hoping for a tick box somewhere to set my default reminder as a specific time on the previous day, in the same way that you can do '15 minutes before'. Currently you can set reminders for a specific time and date, but, entering this for every item – especially if you want them to coincide – is more than slightly tedious. Furthermore, I input a lot of my Calender events on my iPhone (they sync via iCloud), which has no such functionality, rendering this essentially defunct.
    Any ideas?

    apple don't have a version of windows
    only microsoft have windows
    as how one automatate windows to send mails at a time
    googled it for you
    http://www.howtogeek.com/125045/how-to-easily-send-emails-from-the-windows-task- scheduler/
    more options in the search
    https://www.google.dk/search?client=opera&q=automatically+send+email+in+windows& sourceid=opera&ie=UTF-8&oe=UTF-8

  • How do I fast forward a track to a specific time with my iPod Touch in iTunes?

    Hello,
    I have an iPod Touch and would like to find out how can I fast forward a track to a specific time in iTunes? There is only play/pause, ff & rewind, and volume buttons but no time clock to see where I am in the track. This is the case for podcast and music in iTunes Is there a seting that I need to change?
    Thanks for your help.

    You can use a third-party program like those discussed here:
    new PC: Apple Support Communities

  • Can I set my macbook to install updates at a specific time? My internet is limited through the day but between 2am and 7am it is unlimited?

    My internet is limited through the day and I want to know if I can set a specific time for updates to be carried out to make sure my macbook is working efficiently.

    Yes. When you get a notification that an update is available, select "Try Tonight". That will constrain the update to occur between 2:00 and 5:00 AM.

Maybe you are looking for