Results 1 to 5 of 5

Thread: Periodic function in java

  1. #1
    Join Date
    Aug 2009
    Posts
    155

    Periodic function in java

    Hello,
    I'd like to launch a regular basis, like every 5 minutes. I would have liked to know if I necessarily had to make the multi process, or if there are ways to add a timer in the loop of execution of the application, or another method. I would like that the function does not slow down the rest of the application of preference. Any help with an sample code would be great. Thank you.

  2. #2
    Join Date
    Nov 2009
    Posts
    359

    Re: Periodic function in java

    A timer (more precisely a wxTimer) will be entirely the case to start the function periodically. Then, depending on the type of function, if you do not want that to slow down the base application, it will probably go through the threads (wxThreads). If you need more info, do not hesitate.

  3. #3
    Join Date
    Dec 2009
    Posts
    204

    Re: Periodic function in java

    The mutli-process is when the system consists of different applications (each process). The multi-thread, is when one application has several son execution. The main difference between the two is that the process does not share a common memory area so that the threads of a single application may address the same memory areas.

  4. #4
    Join Date
    Nov 2009
    Posts
    359

    Re: Periodic function in java

    Hello,
    Check out the following code

    Code:
    class tm: Private wxTimer
    (
    public : tm(int per) : wxTimer()
       (
          Start(per);
       )
    private:
       virtual void Notify()
       (
          / / Just do it ...
       )
    );

  5. #5
    Join Date
    Dec 2009
    Posts
    296

    Re: Periodic function in java

    You can continue the above code with some thing like this

    Code:
    class myfrm: public wxFrame
    (
    public: myfrm();
    private:
       void otm(wxTimerEvent &); / / processing of the event
    private: wxTimer mtim; / / Timer
    private: DECLARE_EVENT_TABLE()
    ); BEGIN_EVENT_TABLE(myfrm, wxFrame)
       EVT_TIMER(wany, otm) / / Add the event to the event table
    END_EVENT_TABLE()
     
    myfrm::myfrm(const wxString & title)
           : wxFrame(NULL, wany, WXT("Timer Sample"))
           , mtim(this) / / we tell the timer that should generate an event to this window
    (
       mtim.Start(2000); / / we started
    )
     
     
    void myfrm::otm(wxTimerEvent &)
    (
    / / just do it!
    )

Similar Threads

  1. Windows 7 periodic lag
    By Dazed89 in forum Operating Systems
    Replies: 8
    Last Post: 04-01-2012, 01:15 AM
  2. Replies: 10
    Last Post: 31-12-2011, 08:41 AM
  3. exec() function in java
    By Lauren Ambrose in forum Software Development
    Replies: 5
    Last Post: 11-03-2010, 11:23 AM
  4. What is the meaning of function($) in java?
    By Steadfast in forum Software Development
    Replies: 5
    Last Post: 22-02-2010, 09:08 PM
  5. Periodic change of slides
    By Halyn in forum Windows Software
    Replies: 4
    Last Post: 05-12-2009, 06:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,125,969.49012 seconds with 17 queries