Hi,
I have the following:
public static void RunBatch() {
if (OnDemandRunnin g) {
//If OnDemand is Running we will do nothing
}
else{
BatchDirectoryN ame = "C:\\BatchQ ";
String[] BatchDirectory =
Directory.GetFi les(BatchDirect oryName,"*.xml" );
for (int counter = 0; counter < BatchDirectory. Length;
counter++) {
///<remarks>
/// need to break if an OnDemand event happens.
///</remarks>
///
//TODO: Implement actual event handling etc. instead of
the fake event handling doing now.
if (OnDemandRunnin g) { break; }
String BatchFile =
BatchDirectory. GetValue(counte r).ToString();
logthis("Batchf ile" + BatchFile, 1);
File.Delete(Bat chFile);
}
System.Threadin g.Thread.Sleep( 5000);
RunBatch();
}
}
Now I'm not sure if any of the rest of the code is a problem but the
presence of RunBatch(); in RunBatch() is causing it to stall at load.
I've set the Sleep to be really high to avoid any problem like that
but it seems like that does not work. How does one get around that? 3 1906
The service-start method needs to exit promptly; in most cases, the
"start" to a service simply fires up a new thread to run (in this
case) RunBatch - i.e.
protected override void OnStart(string[] args)
{
Thread thread = new Thread(new ThreadStart(Run Batch));
thread.Name = "RunBatch";
thread.Start();
}
Also - why does this need to be recursive? It is surenly guaranteed to
blow the stack eventually... why not just "do/while" or similar?
Marc
On Apr 11, 9:15*am, pantagruel <rasmussen.br.. .@gmail.comwrot e:
Hi,
I have the following:
*public static void RunBatch() {
* * * * * * if (OnDemandRunnin g) {
* * * * * * * *//If OnDemand is Running we will do nothing
* * * * * * }
* * * * * * else{
* * * * * * * * BatchDirectoryN ame = "C:\\BatchQ ";
* * * * * * * * String[] BatchDirectory =
Directory.GetFi les(BatchDirect oryName,"*.xml" );
* * * * * * for (int counter = 0; counter < BatchDirectory. Length;
counter++) {
* * * * * * * * * * ///<remarks>
* * * * * * * * * * /// need to break if an OnDemand event happens.
* * * * * * * * * * ///</remarks>
* * * * * * * * * * ///
* * * * * * //TODO: Implement actual event handling etc. instead of
the fake event handling doing now.
* * * * * * * * * * if (OnDemandRunnin g) { break; }
* * * * * * * * *String BatchFile =
BatchDirectory. GetValue(counte r).ToString();
* * * * * * * * * *logthis("Batch file" + BatchFile, 1);
* * * * * * * * * *File.Delete(Ba tchFile);
* * * * * * * * }
* * * * * * * * System.Threadin g.Thread.Sleep( 5000);
* * * * * * * *RunBatch();
* * * * * * }
* * * * }
Now I'm not sure if any of the rest of the code is a problem but the
presence of RunBatch(); in RunBatch() is causing it to stall at load.
I've set the Sleep to be really high to avoid any problem like that
but it seems like that does not work. How does one get around that?
the OnStart method is intended to return at once.
Create a thread and do your processing there.
Question, what you do when the batch is completed? how the process
gets the next batch?
As Marc indicated, you want to do this kind of operation on a background
thread so your OnStart method returns quickly. Also, instead of Sleep you
probably want to use a timer.
-Peter
"pantagruel " <ra************ *@gmail.comwrot e in message
news:26******** *************** ***********@y18 g2000pre.google groups.com...
Hi,
I have the following:
public static void RunBatch() {
if (OnDemandRunnin g) {
//If OnDemand is Running we will do nothing
}
else{
BatchDirectoryN ame = "C:\\BatchQ ";
String[] BatchDirectory =
Directory.GetFi les(BatchDirect oryName,"*.xml" );
for (int counter = 0; counter < BatchDirectory. Length;
counter++) {
///<remarks>
/// need to break if an OnDemand event happens.
///</remarks>
///
//TODO: Implement actual event handling etc. instead of
the fake event handling doing now.
if (OnDemandRunnin g) { break; }
String BatchFile =
BatchDirectory. GetValue(counte r).ToString();
logthis("Batchf ile" + BatchFile, 1);
File.Delete(Bat chFile);
}
System.Threadin g.Thread.Sleep( 5000);
RunBatch();
}
}
Now I'm not sure if any of the rest of the code is a problem but the
presence of RunBatch(); in RunBatch() is causing it to stall at load.
I've set the Sleep to be really high to avoid any problem like that
but it seems like that does not work. How does one get around that? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TJ |
last post by:
I am running PHP version 4.3.4
I am running an Apache server
I am running on Windows 2000
My PHP server has run perfectly since it was installed last November.
However, I just uncommented the line (I need PHP to interface with an
Oracle database):
extension=php_oracle.dll
|
by: Stian Søiland |
last post by:
all examples performed with:
Python 2.3+ (#2, Aug 10 2003, 11:09:33)
on linux2
(2, 3, 0, 'final', 1)
This is a recursive import:
|
by: Steve Goldman |
last post by:
Hi,
I am trying to come up with a way to develop all n-length permutations of a
given list of values. The short function below seems to work, but I can't
help thinking there's a better way. Not being a computer scientist, I find
recursive functions to be frightening and unnatural. I'd appreciate if
anyone can tell me the pythonic idiom to accomplish this.
Thanks for your help,
|
by: |
last post by:
OK:
Purpose: Using user's input and 3 recursive functions, construct an hour
glass figure. Main can only have user input, loops and function calls.
Recursive function 1 takes input and displays a sequence of spaces;
recursive function 2 uses input to display ascending sequence of digits;
likewise, recursive function 3 uses input to display descending sequence of
digits.
I have not followed the instructions completely regarding the...
|
by: Ryan Stewart |
last post by:
Putting the following code in a page seems to make it go into an infinite
loop unless you give it a very simple node to work with. Either that or it's
very very slow. I'm somewhat new to this, having limited experience with
hacking out JavaScript but no serious coding with it. I do have programming
experience though. The logic seems fine to me. Is there something I'm
missing?
<script type="text/javascript">
var out = "";
| |
by: Victor |
last post by:
Hello,
I've got a situation in which the number of (valid) recursive calls I
make will cause stack overflow. I can use getrlimit (and setrlimit)
to test (and set) my current stack size. However, it is not as
straightforward to determine the base address for my stack space. The
approach I have taken is to save the address of an automatic variable
in main( ), and assume this is a fairly good indicator of my base
address. Then, I can...
|
by: Jerry Camel |
last post by:
I'm posting this here because it seems to be a much more active group that
the standard VB group and I suspect that ASP developers may be more inclined
to write a service, anyway.
I've got my service all nice and compiled and it runs just great. Question
is, how do I populate the description field in the Control Panel Services
applet? Is it a registry hack or should I be able to set this within the
service project in VS? Thanks.
...
|
by: Adrian |
last post by:
Hi
is this possible in VB.Net ?
How should I go about it?
The Idea is the service will run at a given time and shutdown the PC no
matter what state it has been left in!
Any pointers would be helpful not written much and have never written a
service :(
|
by: Csaba Gabor |
last post by:
Inside a function, I'd like to know the call stack. By this I mean
that I'd like to know the function that called this one, that one's
caller and so on.
So I thought to do:
<script type='text/javascript'>
function myFunc(lev) {
// if (lev) return myFunc(lev-1);
var aStack=;
nextFunc = arguments.callee;
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |