Questions tagged [timer]

Timer is a component that has the functionality to trigger a user defined action at regular intervals as configured by the user.

Timer is a component that has the functionality to trigger a user defined action at regular intervals as configured by the user.

Some timers (such as Java Swing timer, WPF DispatcherTimer, WinForms Timer) are also capable of firing they events in GUI thread so there is no need to switch into this thread in order to update the components. Other timers do not have this capability and are more optimized to handle big number of scheduled events.

Depending on how does the scheduler behaves if the new even should be fired when the current event has not yet been fully processed, the timer may be coalescing or non coalescing. A coalescing timer reduces multiple pending events to a single event, reducing the number of events to handle. A non-coalescing timer fires pending overtime events in rapid succession with no delay between them, in order to catch up.

19566 questions
4
votes
1 answer

Android listview timer run in every second

I have a issue with using a timer on a listview. In the list item I showed using sqlite values. There is a textview which showing time difference of last updated time of the data and current time. i have to show it in every one second. so the user…
Thushara
  • 559
  • 7
  • 22
4
votes
2 answers

How to run code every minute in android activity?

In my android project I have an activity that needs to run a code every minute. How can I do this? The code needs to run every minute while the activity is running and not paused (i.e. the user is seeing it and not some other activity). Also it…
omega
  • 40,311
  • 81
  • 251
  • 474
4
votes
1 answer

Cron syntax with Java EE 5?

Timer Tasks in Java EE are not very comfortable. Is there any util, to configure timer with cron syntax like "0 20 20 * * "? I wonder, if it would be a good way to use Quartzinside (clustered) Java EE application. According to…
marabol
  • 1,247
  • 2
  • 15
  • 22
4
votes
7 answers

Timer doesn't want to start again after it was disabled

I am writing a simple C# program that attempts to do something every x amount of seconds using System.Forms.Timer The tick event calls a method that starts a new thread and disables the timer, then when the thread is done with its work, it enables…
user3200174
  • 81
  • 1
  • 5
4
votes
1 answer

android how to deal with android timer when phone goes to sleep

Our Application has a service which starts a timer to schedule a task every 4 hours. But the phone often goes to sleep when the screen is off. I don't expect the task to run when the phone is sleeping. But I want that it can be run immediately if…
NicePiao
  • 41
  • 3
4
votes
3 answers

Timer with autoreset is causing System.OutOfMemoryException

I have the following piece of code, that runs a "select" on certain table that needs to be monitored every 200 miliseconds timerMonitoreoOrdenes = new System.Timers.Timer(FRECUENCIA_MONITOREO_ORDENES); timerMonitoreoOrdenes.Elapsed += new…
Mauricio Gracia Gutierrez
  • 10,288
  • 6
  • 68
  • 99
4
votes
4 answers

Python Timer module

I found this snippet of code somewhere: t = Timer(10.0, hello) t.start() Where 10.0 is the time in seconds for when the timer is supposed to execute, and hello is the method that will run when the time parameter is met. However, I can't find the…
user1650305
4
votes
4 answers

Two threads accessing same hashmap, one thread is continuously running other runs after 2 mins and clears that hashmap, how to handle this in java

The first thread is of JMS subscriber that listens to a topic. As soon as it gets a message it adds/updates/deletes entries in a hashmap. Another thread runs after every 2 mins using TimerClass and reads the contents of the same hashmap and stores…
Yamini
  • 73
  • 7
4
votes
3 answers

C# timer for database cyclic polling

I'm not very familiar with C# so far, at least not enough to feel confident when choosing ways of doing something when it comes for the first time. What could be the best way to organize SQL Server database timer based polling from my WPF…
rem
  • 16,745
  • 37
  • 112
  • 180
4
votes
3 answers

My timer is stopping at random intervals in java

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.custom.CLabel; import…
Rundown
  • 43
  • 3
4
votes
6 answers

C# User control with timer starts even in design mode

I have the following problem: I made a user control library (DLL), which just has an enabled Timer. When I try to use this control in an application, as soon as I drag it to the Form in design mode, it starts to count! Even if the application is not…
4
votes
2 answers

netlogo: how to make turtles stop for a set number of ticks then continue

I'm trying to create a model where turtles walk randomly (but with a tendency for forward movement) until they land on a yellow coloured patch which represents a baited object. When a turtle lands on one of the yellow patches, I'd like it to stop on…
NZHelen
  • 43
  • 1
  • 1
  • 5
4
votes
1 answer

Timer updating label

I know this is a common question but I can't seem to get it right. I have a form that goes out to gmail and processes some emails. I want to have a timer on the form to count how long the action has been running for. So once a user click the "start…
MaylorTaylor
  • 4,671
  • 16
  • 47
  • 76
4
votes
1 answer

onFinish() CountDownTimer method too long?

Update: 20/11/13: This is still unresolved. I am making a CountDownTimer and in the onFinish() method, I am apparently doing too much work as the delay between the last second and the finish takes longer than 1 second (which is my delay between…
user2442638
4
votes
2 answers

Throw exception in TimerTask to another method

I want to throw the following exception to another method, but I don't know how to achieve this correctly. public void startTimeoutHandler() throws TimeoutException { timer = new Timer(); timerTask = new TimerTask() { …
marc3l
  • 2,525
  • 7
  • 34
  • 62
1 2 3
99
100