Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Windows Service

Windows Service

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasehelpquestion
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    Hi, I am writing an application for Windows Service, I want to run this Service for every 1 minutes, the Windows Service does call some database objects and performs operations, this is fine up to here. But my question is what if the first cycle of Windows Service didn't complete its operations and if second cycle starts, doesn't this interference can cause Service to fail. Similar type of question I have for the Windows Scheduler too, what if the first cycle of Windows Schedule hasn't completed yet and as per timing if 2nd Scheduler cycle tries to run the same application, isn't it going to interfere and created Problems. Any help a code snippet, a link or a suggestion is going to help me a lot, thanks in advance.

    Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

    L Richard DeemingR A 5 Replies Last reply
    0
    • I indian143

      Hi, I am writing an application for Windows Service, I want to run this Service for every 1 minutes, the Windows Service does call some database objects and performs operations, this is fine up to here. But my question is what if the first cycle of Windows Service didn't complete its operations and if second cycle starts, doesn't this interference can cause Service to fail. Similar type of question I have for the Windows Scheduler too, what if the first cycle of Windows Schedule hasn't completed yet and as per timing if 2nd Scheduler cycle tries to run the same application, isn't it going to interfere and created Problems. Any help a code snippet, a link or a suggestion is going to help me a lot, thanks in advance.

      Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Why do you bother? In the time it took you to write up this post, you could have typed the same thing in Google; using fewer words. Do you have a problem with Google or search engines in general? Are you a bot? An unintelligent agent?

      "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

      1 Reply Last reply
      0
      • I indian143

        Hi, I am writing an application for Windows Service, I want to run this Service for every 1 minutes, the Windows Service does call some database objects and performs operations, this is fine up to here. But my question is what if the first cycle of Windows Service didn't complete its operations and if second cycle starts, doesn't this interference can cause Service to fail. Similar type of question I have for the Windows Scheduler too, what if the first cycle of Windows Schedule hasn't completed yet and as per timing if 2nd Scheduler cycle tries to run the same application, isn't it going to interfere and created Problems. Any help a code snippet, a link or a suggestion is going to help me a lot, thanks in advance.

        Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Why not just code the service to do its own timing internally? That way you can prevent a new cycle from starting if a previous one has not completed.

        I 1 Reply Last reply
        0
        • I indian143

          Hi, I am writing an application for Windows Service, I want to run this Service for every 1 minutes, the Windows Service does call some database objects and performs operations, this is fine up to here. But my question is what if the first cycle of Windows Service didn't complete its operations and if second cycle starts, doesn't this interference can cause Service to fail. Similar type of question I have for the Windows Scheduler too, what if the first cycle of Windows Schedule hasn't completed yet and as per timing if 2nd Scheduler cycle tries to run the same application, isn't it going to interfere and created Problems. Any help a code snippet, a link or a suggestion is going to help me a lot, thanks in advance.

          Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

          Richard DeemingR Online
          Richard DeemingR Online
          Richard Deeming
          wrote on last edited by
          #4

          The Windows task scheduler has an option to not start a new instance if the task is already running.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          I 2 Replies Last reply
          0
          • I indian143

            Hi, I am writing an application for Windows Service, I want to run this Service for every 1 minutes, the Windows Service does call some database objects and performs operations, this is fine up to here. But my question is what if the first cycle of Windows Service didn't complete its operations and if second cycle starts, doesn't this interference can cause Service to fail. Similar type of question I have for the Windows Scheduler too, what if the first cycle of Windows Schedule hasn't completed yet and as per timing if 2nd Scheduler cycle tries to run the same application, isn't it going to interfere and created Problems. Any help a code snippet, a link or a suggestion is going to help me a lot, thanks in advance.

            Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            That could be answered in a few minutes by testing it. Create a task that writes somewhere for one minute. Start them from your service or the Task-scheduler, with an interval of 10 seconds. So, unless you do something that locks (writing to files and the like) it should not fail.

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            I 1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              The Windows task scheduler has an option to not start a new instance if the task is already running.


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              I Offline
              I Offline
              indian143
              wrote on last edited by
              #6

              Thank you very much.

              Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

              1 Reply Last reply
              0
              • L Lost User

                Why not just code the service to do its own timing internally? That way you can prevent a new cycle from starting if a previous one has not completed.

                I Offline
                I Offline
                indian143
                wrote on last edited by
                #7

                Thank you very much

                Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

                1 Reply Last reply
                0
                • L Lost User

                  That could be answered in a few minutes by testing it. Create a task that writes somewhere for one minute. Start them from your service or the Task-scheduler, with an interval of 10 seconds. So, unless you do something that locks (writing to files and the like) it should not fail.

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  I Offline
                  I Offline
                  indian143
                  wrote on last edited by
                  #8

                  Thank you very much

                  Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

                  1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    The Windows task scheduler has an option to not start a new instance if the task is already running.


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    I Offline
                    I Offline
                    indian143
                    wrote on last edited by
                    #9

                    Hi Richard, Can you please give me the name of the option if you don't mind?

                    Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

                    Richard DeemingR 1 Reply Last reply
                    0
                    • I indian143

                      Hi Richard, Can you please give me the name of the option if you don't mind?

                      Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

                      Richard DeemingR Online
                      Richard DeemingR Online
                      Richard Deeming
                      wrote on last edited by
                      #10

                      It's at the bottom of the "settings" page: Screen-shot[^]


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      1 Reply Last reply
                      0
                      • I indian143

                        Hi, I am writing an application for Windows Service, I want to run this Service for every 1 minutes, the Windows Service does call some database objects and performs operations, this is fine up to here. But my question is what if the first cycle of Windows Service didn't complete its operations and if second cycle starts, doesn't this interference can cause Service to fail. Similar type of question I have for the Windows Scheduler too, what if the first cycle of Windows Schedule hasn't completed yet and as per timing if 2nd Scheduler cycle tries to run the same application, isn't it going to interfere and created Problems. Any help a code snippet, a link or a suggestion is going to help me a lot, thanks in advance.

                        Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

                        A Offline
                        A Offline
                        Ashwin Shetty
                        wrote on last edited by
                        #11

                        If you can add the request to in-memory .net queue it should solve your problem. Keep a thread which will monitor and trigger job from the queue. This way you can decide on a number of threads which can run parallelly (one or multiple).

                        Ashwin Shetty

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups