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

  • Home
  • SEARCH
  • 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 7433565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:41:31+00:00 2026-05-29T09:41:31+00:00

I have 2 methods contain selft jobs, for example protected void method1(){ String name=getName();//return

  • 0

I have 2 methods contain selft jobs, for example

protected void method1(){
 String name=getName();//return name based on combobox selection
 Job job= new Job("first job"){
            @Override
            protected IStatus run(IProgressMonitor monitor) {
            someActions();
      }
   }
}

protected void method2(){
 String name=getName();//return name based on combobox selection
 Job job= new Job("second job"){
            @Override
            protected IStatus run(IProgressMonitor monitor) {
            someActions();
      }
   }
}

method1 and method2 can invoked seperated.With own progress bar

I have also some button to invoke both methods

 btnUpdate.addListener(SWT.MouseUp, new Listener() {

            @Override
            public void handleEvent(Event event) {
                         method1();
                         method2();
                    }
     }

but this construction works incorrect becouse job from method2() start execute early then job from method1() finished. Also if i mark job from method1() as join then method2() will not start till the method1() execute, but progress bar doesn’t displayed

How to make it work correctly?)

  • 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-29T09:41:32+00:00Added an answer on May 29, 2026 at 9:41 am

    Prevent the 2 jobs from running simultanously by setting a job-rule:

    public class Mutex implements ISchedulingRule {
    
            public boolean contains(ISchedulingRule rule) {
                return (rule == this);
            }
    
            public boolean isConflicting(ISchedulingRule rule) {
                return (rule == this);
            }
    
    }// Mutex
    
    public static final ISchedulingRule mutex = new Mutex();
    

    for both of your jobs:

    job.setRule(<your mutex instance>);
    

    Make sure that both jobs use the same mutex-instance!

    This should:

    1. Prevent 2 jobs from running at the same time (if they both make use of the same rule)
    2. Execute them in the order you schedule them

    Btw.: You are not scheduling your jobs using job.schedule(), so actually they should not even be executed using the code you posted…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that contains two methods like these: public String getFoo(Int32 a)
I have a class which must return a CGRect from one of its methods:
I currently have 2 concrete methods in 2 abstract classes. One class contains the
I have an ActiveX/COM DLL. It contains many methods and properties. I would like
I have a Python class and its methods are partially covered by unit tests
I have a Python set that contains objects with __hash__ and __eq__ methods in
I have a UITable containing some customs UITableCells. Those cells contain a few UILabels
In my model I have a field which should contain only the values 'A',
i have an NSDictionary that contain in value and i need to get this
I have a class whose instances have attributes that are containers which themselves contain

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.