title: Communication between threads defined on two different instances of same class?
body: <p>I have a class (say) <code>Task.java</code> which performs some task scheduling activity.
  This class contains two types of activities- 1) To schedule periodic tasks and 2) To schedule aperiodic tasks.
  Periodic task has higher priority over aperiodic.</p>
  
  <pre><code>public class Task implements Runnable{
    ArrayList&lt;&gt; list;
    public Task(ArrayList&lt;&gt; list){
      this.list = list;
    }
  public void run(){
      handlePeriodicTask(){...}
      handleAPeriodicTask(){...}
    }
  }
  </code></pre>
  
  <p>In main class, I've one global list of task which contains both periodic and aperiodic tasks. I am splitting this list into two sublists each containing different periodic tasks but may be repeating aperiodic tasks. And I'm supplying these sublists to two different threads created on two different instances of <code>Task.java</code></p>
  
  <pre><code>public class Main{
    ArrayList&lt;&gt; globalList;
  
    //splitting globalList to get two sublists
    ArrayList&lt;&gt; subList1; 
    ArrayList&lt;&gt; subList2;
    public static void main(..){
       Task task1 = new Task(subList1);
  
       Task task2 = new Task(subList1);
       new Thread(task1).start();
       new Thread(task2).start();
    }
  }
  </code></pre>
  
  <p>I want all periodic tasks in two sublists to be scheduled independently, however aperiodic, (since they are aperiodic in nature), need prior knowledge if it is already scheduled by another thread. If so, current thread should ignore them. 
  I don't know how to achieve this communication via <code>wait()</code> <code>notify()</code> on two threads created on two different instances. I've seen several examples of <code>wait()</code> <code>notify()</code> that operates on single instance, but how to achieve this on two different instances. I'm not well versed in multithreading, so the question may stand silly/invalid, but I want proper guidance for that. 
  Anybody please guide me. 
  Thanks.</p>