Results 1 to 4 of 4
  1. #1
    gonzalioz is offline Member
    Join Date
    May 2011
    Posts
    8
    Rep Power
    0

    Default setCoalesce() in java.util.tiimer?

    Hi all,

    Is it possible to do something equivelant to setCoalesce() on a java.util.timer? I am creating an application for android and therefore can't use the swing timer.

    Thanks a lot in advance for your help!

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,864
    Rep Power
    8

    Default

    Wouldn't util.Timer's fixed-delay execution cover that?

    What exact effect are you going for?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    gonzalioz is offline Member
    Join Date
    May 2011
    Posts
    8
    Rep Power
    0

    Default

    Hi, thanks for your reply. I don't know the difference between fixedrate and delay. I can't find a good explanation of this on the internet.

    I am developing a streaming application and the server (android device) needs to send a frame to the client every 100ms. But the server might not keep up. If sending it takes longer than 100ms, the next timerevent will have to wait for it to complete if I understand correctly. So the queue of timerevents will get really big. I need the event to look if the previous task has been completed, if not then skip.

    I'll try fixedrate tommorrow. Thanks so far!

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,864
    Rep Power
    8

    Default

    This is just from the API for util.Timer: Timer (Java Platform SE 6)

    In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).

    In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will occur in rapid succession to "catch up." In the long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. java.util.NoSuchElementException
    By Parkuss in forum New To Java
    Replies: 1
    Last Post: 03-25-2011, 07:33 AM
  2. java.util.LinkedList;
    By Andrew_2 in forum New To Java
    Replies: 4
    Last Post: 03-25-2011, 04:40 AM
  3. java.util
    By Java Tutorial in forum Java Tutorial
    Replies: 1
    Last Post: 02-07-2008, 01:46 PM
  4. how to use java.util.Properties?
    By christina in forum New To Java
    Replies: 2
    Last Post: 08-03-2007, 05:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •