473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Timer Question

Hi
In ASP.net (c#) I want to be able to send a request to a user i.e. flag a
status (lets say for example you have a
job allocated to you) and then if they have not acknowledged the job within
a set period of time i.e. 1 hour
that job is then reallocated to someone else. I guess i would add a row to
my DB table with a time stamp and then
1 hour later reallocate the job

I am using MySQL so timed triggers may not be a possibility, would this be
done as a windows service
where every n secs i scan the table comparing the time with the server time
and search for records with
the time equal to +1 hour?

Any suggestions would be gratefully appreciated

--
Thanks
Richard
Dec 1 '05 #1
4 1177
You can use another thread

public class IndexerSchedule
{
public static void Install(int interval)
{
ThreadStart myThreadDelegate = new
ThreadStart(IndexerSchedule.run);
Thread myThread = new Thread(myThreadDelegate);
myThread.Name = interval.ToString();
myThread.Start();
}

private static void run()
{
int interval = 0;
interval =
System.Convert.ToInt32(Thread.CurrentThread.Name);
if (interval>0)
{
while(true)
{
//Do what you want

// Pause Thread
Thread.Sleep(interval*1000);
}
}
}
}

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Richard Steele (Basemap)" <Ri******************@discussions.microsoft.com>
wrote in message news:4C**********************************@microsof t.com...
Hi
In ASP.net (c#) I want to be able to send a request to a user i.e. flag a
status (lets say for example you have a
job allocated to you) and then if they have not acknowledged the job
within
a set period of time i.e. 1 hour
that job is then reallocated to someone else. I guess i would add a row
to
my DB table with a time stamp and then
1 hour later reallocate the job

I am using MySQL so timed triggers may not be a possibility, would this be
done as a windows service
where every n secs i scan the table comparing the time with the server
time
and search for records with
the time equal to +1 hour?

Any suggestions would be gratefully appreciated

--
Thanks
Richard

Dec 1 '05 #2
Hi Richard:

I'd go with either a Windows Service, or even easier is to set up a
scheduled task in Windows. You can write a console mode application
that runs every x minutes and queries the database for jobs to
maintain.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 1 Dec 2005 02:59:02 -0800, Richard Steele (Basemap)
<Ri******************@discussions.microsoft.com> wrote:
Hi
In ASP.net (c#) I want to be able to send a request to a user i.e. flag a
status (lets say for example you have a
job allocated to you) and then if they have not acknowledged the job within
a set period of time i.e. 1 hour
that job is then reallocated to someone else. I guess i would add a row to
my DB table with a time stamp and then
1 hour later reallocate the job

I am using MySQL so timed triggers may not be a possibility, would this be
done as a windows service
where every n secs i scan the table comparing the time with the server time
and search for records with
the time equal to +1 hour?

Any suggestions would be gratefully appreciated


Dec 1 '05 #3
It's not scalable if you are creating a thread per user - threads are
precious.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 1 Dec 2005 12:18:26 +0100, "Daniel Fisher\(lennybacon\)"
<in**@lennybacon.com> wrote:
You can use another thread

public class IndexerSchedule
{
public static void Install(int interval)
{
ThreadStart myThreadDelegate = new
ThreadStart(IndexerSchedule.run);
Thread myThread = new Thread(myThreadDelegate);
myThread.Name = interval.ToString();
myThread.Start();
}

private static void run()
{
int interval = 0;
interval =
System.Convert.ToInt32(Thread.CurrentThread.Name) ;
if (interval>0)
{
while(true)
{
//Do what you want

// Pause Thread
Thread.Sleep(interval*1000);
}
}
}
}


Dec 1 '05 #4
Thanks Scott, i'll write some test code and see how it goes
--
Thanks
Richard
"Scott Allen" wrote:
Hi Richard:

I'd go with either a Windows Service, or even easier is to set up a
scheduled task in Windows. You can write a console mode application
that runs every x minutes and queries the database for jobs to
maintain.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 1 Dec 2005 02:59:02 -0800, Richard Steele (Basemap)
<Ri******************@discussions.microsoft.com> wrote:
Hi
In ASP.net (c#) I want to be able to send a request to a user i.e. flag a
status (lets say for example you have a
job allocated to you) and then if they have not acknowledged the job within
a set period of time i.e. 1 hour
that job is then reallocated to someone else. I guess i would add a row to
my DB table with a time stamp and then
1 hour later reallocate the job

I am using MySQL so timed triggers may not be a possibility, would this be
done as a windows service
where every n secs i scan the table comparing the time with the server time
and search for records with
the time equal to +1 hour?

Any suggestions would be gratefully appreciated


Dec 2 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: brian | last post by:
I have an ASP.Net application that uses impersonation. This works fine for accessing/executing the application. However, the app utilizes a timer, that when fired uses the <machine>ASPNET...
5
by: Richard P | last post by:
I need some help on timers. My app is asp.net 1.1 website running in a shared hosting environment with a third-party service provider. I currently request and cache 20 - 40 remote RSS feeds. When a...
6
by: Steve Jorgensen | last post by:
I know quite well that this question falls into the category of "why does Access misbehave when I do unexpected things to its objects?", but I thought I'd ask anyway, and see if anyone knows. ...
1
by: Paul Tomlinson | last post by:
Question about a System.Threading.Timer object and the "state" object you pass to it... Timer stateTimer = new Timer( = new TimerCallback( OnTimer ), o, 1000, 1000); I have an array of timer...
10
by: Bob | last post by:
Okay, I've done this for years but now I'm going to question it just because this idea has been at the back of my head since I started using DotNet... My WinForms app queries a database every 60...
7
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
11
by: Anil Gupte/iCinema.com | last post by:
When I use this Dim instance As New Timer I get the error: Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. Yet, in the help section for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.