Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4322130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:50:04+00:00 2026-05-21T08:50:04+00:00

I have a class MyMainApplication which is a SPIisWebServiceApplication. So it is hosted and

  • 0

I have a class MyMainApplication which is a SPIisWebServiceApplication. So it is hosted and running under IIS.

I have a custom sharepoint timer job lets say named CustomTimerJob class which is derived from SPJobDefinition class. So, timer jobs are run under OWSTimer.exe

I have two Questions : [Please see the code below, to relate the questions]

  1. The variables in my CutomTimerJob, are they accessible from the calle, in my example that would be the var job = new CustomTimerJob(); job.RunNow(); , will the varibale job have a reference to the customeTimerJob running, and be able to get the value of job.status ? I have seen, people have used [persisted] keyword marking the variables, to keep the state. I would appreciate if anyone can elaborate more on that. Why that is used and how it actually works, where does it persist to ?

  2. Can the exception float back to the callee ?
    As far I understand, it is logical that the exception will not float back to the callee, as the timer job is running on a seperate process. But, then by question is, when it does this var job = new CustomTimerJob();, what is the job variable pointing to ?

The code I wrote looks something like this :

>     Class MyMainApplication : SPIiWebServiceApplication
>     {
>     // something
>     .
>     .
>     .
>     void some_function()
>     {
>     // Create and run the timer job immediately
>     
>     var job = new CustomTimerJob()
>     job.RunNow();
>     
>     // Give it a bit of time before checking the status
>     Thread.Sleep(5000);
>     
>     // Want to print the status to see if it was changed when it ran 
>     Console.Writeln( job.Status );
>     
>     }
>     
>     }
>     
>     ----------------------
>     
>     class CustomTimerJob : SPJobDefinition
>     {
>     
>     public Boolean status;
>     // something
>     
>     public override void Execute(Guid contentDbId)
>     {
>     status = true;
>     try {
>     // do some processing
>     } catch (Exception) {
>     
>     // Can I throw the exception up from here ? And will the calle get the exception
>     // throw new CustomException(e);
>     
>     }
>     
>     }

I really appreciate the readers who had the heart to read all the way through till this line. Kudos from me !

Thanks in Advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:50:04+00:00Added an answer on May 21, 2026 at 8:50 am

    The SPJobDefinition.RunNow() method only schedules the execution, which is then performed in the context of the OWSTimer.exe process. Hence the answers to your questions are:

    1. No, they are not accessible. More precisely, the instance you created is not the same instance as is going to be executed and it even lives in another process.
    2. No, for the same reason the exception won’t be propagated to your that place where you call RunNow(). Generally it is a bad practice to allow an unhandled exception to be propagated outside a custom timer job, because the job is then considered failed. Unless that’s what you need to achieve handle exceptions properly.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have class A with class A { final String foo() { //
I have class which has a method that needs to return three DataTables. I
I have class Employee which is something like this. class Emp { int EmpID;
I have class Country which has collections of Cities. At client I use webmethod
I have class A (in A.h) which depends on class B in (B.h) and
I have class Zones with properties and i want add data which i read
I have class Foo which defines property Id . Class Bar inherits from Foo
I have class method that returns a list of employees that I can iterate
I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is
I have class A: public class ClassA<T> Class B derives from A: public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.