org.eclipse.team.core_3.6.0.I20110525-0800

2
    //   21: invokeinterface 247 3 0
    //   26: aload_0
    //   27: aload_3
    //   28: invokespecial 227	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:addRule	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;)V
    //   31: iconst_1
    //   32: istore 4
    //   34: goto +35 -> 69
    //   37: astore 5
    //   39: iload 4
    //   41: ifne +25 -> 66
    //   44: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
    //   47: aload_3
    //   48: invokeinterface 246 2 0
    //   53: goto +13 -> 66
    //   56: astore 6
    //   58: iconst_4
    //   59: ldc 3
    //   61: aload 6
    //   63: invokestatic 221	org/eclipse/team/internal/core/TeamPlugin:log	(ILjava/lang/String;Ljava/lang/Throwable;)V
    //   66: aload 5
    //   68: athrow
    //   69: iload 4
    //   71: ifne +33 -> 104
    //   74: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
    //   77: aload_3
    //   78: invokeinterface 246 2 0
    //   83: goto +21 -> 104
    //   86: astore 6
    //   88: iconst_4
    //   89: ldc 3
    //   91: aload 6
    //   93: invokestatic 221	org/eclipse/team/internal/core/TeamPlugin:log	(ILjava/lang/String;Ljava/lang/Throwable;)V
    //   96: goto +8 -> 104
    //   99: aload_0
    //   100: aload_3
    //   101: invokespecial 227	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:addRule	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;)V
    //   104: aload_3
    //   105: areturn
    // Line number table:
    //   Java source line #64	-> byte code offset #0
    //   Java source line #65	-> byte code offset #6
    //   Java source line #66	-> byte code offset #13
    //   Java source line #68	-> byte code offset #16
    //   Java source line #69	-> byte code offset #26
    //   Java source line #70	-> byte code offset #31
    //   Java source line #71	-> byte code offset #37
    //   Java source line #72	-> byte code offset #39
    //   Java source line #78	-> byte code offset #44
    //   Java source line #79	-> byte code offset #56
    //   Java source line #81	-> byte code offset #58
    //   Java source line #84	-> byte code offset #66
    //   Java source line #72	-> byte code offset #69
    //   Java source line #78	-> byte code offset #74
    //   Java source line #79	-> byte code offset #86
    //   Java source line #81	-> byte code offset #88
    //   Java source line #88	-> byte code offset #99
    //   Java source line #90	-> byte code offset #104
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	106	0	this	ThreadInfo
    //   0	106	1	resource	ISchedulingRule
    //   0	106	2	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   5	100	3	rule	ISchedulingRule
    //   14	56	4	success	boolean
    //   37	30	5	localObject	Object
    //   56	6	6	e	RuntimeException
    //   86	6	6	e	RuntimeException
    // Exception table:
    //   from	to	target	type
    //   16	37	37	finally
    //   44	53	56	java/lang/RuntimeException
    //   74	83	86	java/lang/RuntimeException
  }
  
  /* Error */
  public void popRule(ISchedulingRule rule, org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.team.core.TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 222	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:isFlushRequired	()Z
    //   4: ifeq +85 -> 89
    //   7: aload_0
    //   8: aload_2
    //   9: invokevirtual 225	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:flush	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   12: goto +77 -> 89
    //   15: astore_3
    //   16: aload_0
    //   17: invokespecial 226	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:removeRule	()Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   20: astore 4
    //   22: aload_1
    //   23: ifnonnull +7 -> 30
    //   26: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   29: astore_1
    //   30: aload 4
    //   32: aload_1
    //   33: invokevirtual 210	java/lang/Object:equals	(Ljava/lang/Object;)Z
    //   36: new 101	java/lang/StringBuffer
    //   39: dup
    //   40: ldc 4
    //   42: invokespecial 212	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   45: aload_1
    //   46: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   49: ldc 2
    //   51: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   54: aload 4
    //   56: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   59: ldc 1
    //   61: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   64: invokevirtual 211	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   67: invokestatic 217	org/eclipse/core/runtime/Assert:isTrue	(ZLjava/lang/String;)Z
    //   70: pop
    //   71: aload_1
    //   72: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   75: if_acmpeq +12 -> 87
    //   78: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
    //   81: aload_1
    //   82: invokeinterface 246 2 0
    //   87: aload_3
    //   88: athrow
    //   89: aload_0
    //   90: invokespecial 226	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:removeRule	()Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   93: astore 4
    //   95: aload_1
    //   96: ifnonnull +7 -> 103
    //   99: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   102: astore_1
    //   103: aload 4
    //   105: aload_1
    //   106: invokevirtual 210	java/lang/Object:equals	(Ljava/lang/Object;)Z
    //   109: new 101	java/lang/StringBuffer
    //   112: dup
    //   113: ldc 4
    //   115: invokespecial 212	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   118: aload_1
    //   119: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   122: ldc 2
    //   124: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   127: aload 4
    //   129: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   132: ldc 1
    //   134: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   137: invokevirtual 211	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   140: invokestatic 217	org/eclipse/core/runtime/Assert:isTrue	(ZLjava/lang/String;)Z
    //   143: pop
    //   144: aload_1
    //   145: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   148: if_acmpeq +12 -> 160
    //   151: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
    //   154: aload_1
    //   155: invokeinterface 246 2 0
    //   160: return
    // Line number table:
    //   Java source line #104	-> byte code offset #0
    //   Java source line #105	-> byte code offset #7
    //   Java source line #107	-> byte code offset #15
    //   Java source line #108	-> byte code offset #16
    //   Java source line #109	-> byte code offset #22
    //   Java source line #110	-> byte code offset #26
    //   Java source line #112	-> byte code offset #30
    //   Java source line #113	-> byte code offset #71
    //   Java source line #114	-> byte code offset #78
    //   Java source line #116	-> byte code offset #87
    //   Java source line #108	-> byte code offset #89
    //   Java source line #109	-> byte code offset #95
    //   Java source line #110	-> byte code offset #99
    //   Java source line #112	-> byte code offset #103
    //   Java source line #113	-> byte code offset #144
    //   Java source line #114	-> byte code offset #151
    //   Java source line #117	-> byte code offset #160
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	161	0	this	ThreadInfo
    //   0	161	1	rule	ISchedulingRule
    //   0	161	2	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   15	73	3	localObject	Object
    //   20	35	4	stackedRule	ISchedulingRule
    //   93	35	4	stackedRule	ISchedulingRule
    // Exception table:
    //   from	to	target	type
    //   0	15	15	finally
  }
  
  private ISchedulingRule getRuleForResoure(ISchedulingRule resourceRule)
  {
    ISchedulingRule rule;
    ISchedulingRule rule;
    if ((resourceRule instanceof IResource))
    {
      IResource resource = (IResource)resourceRule;
      ISchedulingRule rule;
      if (resource.getType() == 8)
      {
        rule = BatchingLock.NULL_SCHEDULING_RULE;
      }
      else
      {
        ISchedulingRule rule;
        if (resource.getType() == 4) {
          rule = resource;
        } else {
          rule = resource.getParent();
        }
      }
    }
    else
    {
      ISchedulingRule rule;
      if ((resourceRule instanceof MultiRule))
      {
        ISchedulingRule[] rules = ((MultiRule)resourceRule).getChildren();
        Set projects = new HashSet();
        for (int i = 0; i < rules.length; i++)
        {
          ISchedulingRule childRule = rules[i];
          if ((childRule instanceof IResource)) {
            projects.add(((IResource)childRule).getProject());
          }
        }
        ISchedulingRule rule;
        if (projects.isEmpty())
        {
          rule = BatchingLock.NULL_SCHEDULING_RULE;
        }
        else
        {
          ISchedulingRule rule;
          if (projects.size() == 1) {
            rule = (ISchedulingRule)projects.iterator().next();
          } else {
            rule = new MultiRule((ISchedulingRule[])projects.toArray(new ISchedulingRule[projects.size()]));
          }
        }
      }
      else
      {
        rule = BatchingLock.NULL_SCHEDULING_RULE;
      }
    }
    return rule;
  }
  
  public boolean isNested()
  {
    return !rules.isEmpty();
  }
  
  public void addChangedResource(IResource resource)
  {
    changedResources.add(resource);
  }
  
  public boolean isEmpty()
  {
    return changedResources.isEmpty();
  }
  
  public IResource[] getChangedResources()
  {
    return (IResource[])changedResources.toArray(new IResource[changedResources.size()]);
  }
  
  /* Error */
  public void flush(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.team.core.TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 208	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:operation	Lorg/eclipse/team/internal/core/subscribers/BatchingLock$IFlushOperation;
    //   4: aload_0
    //   5: aload_1
    //   6: invokeinterface 249 3 0
    //   11: goto +34 -> 45
    //   14: astore_2
    //   15: aload_2
    //   16: athrow
    //   17: astore_2
    //   18: aload_0
    //   19: aload_2
    //   20: invokespecial 224	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:handleAbortedFlush	(Ljava/lang/Throwable;)V
    //   23: aload_2
    //   24: athrow
    //   25: astore_2
    //   26: aload_0
    //   27: aload_2
    //   28: invokespecial 224	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:handleAbortedFlush	(Ljava/lang/Throwable;)V
    //   31: aload_2
    //   32: athrow
    //   33: astore_3
    //   34: aload_0
    //   35: getfield 206	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:changedResources	Ljava/util/Set;
    //   38: invokeinterface 238 1 0
    //   43: aload_3
    //   44: athrow
    //   45: aload_0
    //   46: getfield 206	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:changedResources	Ljava/util/Set;
    //   49: invokeinterface 238 1 0
    //   54: return
    // Line number table:
    //   Java source line #173	-> byte code offset #0
    //   Java source line #174	-> byte code offset #14
    //   Java source line #175	-> byte code offset #15
    //   Java source line #176	-> byte code offset #17
    //   Java source line #177	-> byte code offset #18
    //   Java source line #178	-> byte code offset #23
    //   Java source line #179	-> byte code offset #25
    //   Java source line #180	-> byte code offset #26
    //   Java source line #181	-> byte code offset #31
    //   Java source line #182	-> byte code offset #33
    //   Java source line #185	-> byte code offset #34
    //   Java source line #186	-> byte code offset #43
    //   Java source line #185	-> byte code offset #45
    //   Java source line #187	-> byte code offset #54
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	55	0	this	ThreadInfo
    //   0	55	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   14	2	2	e	OutOfMemoryError
    //   17	7	2	e	Error
    //   25	7	2	e	RuntimeException
    //   33	11	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	11	14	java/lang/OutOfMemoryError
    //   0	11	17	java/lang/Error
    //   0	11	25	java/lang/RuntimeException
    //   0	33	33	finally
  }
  
  private boolean isFlushRequired()
  {
    return (rules.size() == 1) || (remainingRulesAreNull());
  }
  
  private boolean remainingRulesAreNull()
  {
    for (int i = 0; i < rules.size() - 1; i++)
    {
      ISchedulingRule rule = (ISchedulingRule)rules.get(i);
      if (rule != BatchingLock.NULL_SCHEDULING_RULE) {
        return false;
      }
    }
    return true;
  }
  
  private void handleAbortedFlush(Throwable t)
  {
    TeamPlugin.log(4, Messages.BatchingLock_11, t);
  }
  
  private void addRule(ISchedulingRule rule)
  {
    rules.add(rule);
  }
  
  private ISchedulingRule removeRule()
  {
    return (ISchedulingRule)rules.remove(rules.size() - 1);
  }
  
  public boolean ruleContains(IResource resource)
  {
    for (Iterator iter = rules.iterator(); iter.hasNext();)
    {
      ISchedulingRule rule = (ISchedulingRule)iter.next();
      if ((rule != BatchingLock.NULL_SCHEDULING_RULE) && (rule.contains(resource))) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.BatchingLock.ThreadInfo
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.Policy;
import org.eclipse.team.internal.core.TeamPlugin;

public class BatchingLock
{
  private static final boolean DEBUG = Policy.DEBUG_THREADING;
  static final ISchedulingRule NULL_SCHEDULING_RULE = new ISchedulingRule()
  {
    public boolean contains(ISchedulingRule rule)
    {
      return false;
    }
    
    public boolean isConflicting(ISchedulingRule rule)
    {
      return false;
    }
  };
  
  public static abstract interface IFlushOperation
  {
    public abstract void flush(BatchingLock.ThreadInfo paramThreadInfo, IProgressMonitor paramIProgressMonitor)
      throws TeamException;
  }
  
  public class ThreadInfo
  {
    private Set changedResources = new HashSet();
    private BatchingLock.IFlushOperation operation;
    private List rules = new ArrayList();
    
    public ThreadInfo(BatchingLock.IFlushOperation operation)
    {
      this.operation = operation;
    }
    
    /* Error */
    public ISchedulingRule pushRule(ISchedulingRule resource, IProgressMonitor monitor)
    {
      // Byte code:
      //   0: aload_0
      //   1: aload_1
      //   2: invokespecial 228	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:getRuleForResoure	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;)Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   5: astore_3
      //   6: aload_3
      //   7: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   10: if_acmpeq +89 -> 99
      //   13: iconst_0
      //   14: istore 4
      //   16: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
      //   19: aload_3
      //   20: aload_2
      //   21: invokeinterface 247 3 0
      //   26: aload_0
      //   27: aload_3
      //   28: invokespecial 227	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:addRule	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;)V
      //   31: iconst_1
      //   32: istore 4
      //   34: goto +35 -> 69
      //   37: astore 5
      //   39: iload 4
      //   41: ifne +25 -> 66
      //   44: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
      //   47: aload_3
      //   48: invokeinterface 246 2 0
      //   53: goto +13 -> 66
      //   56: astore 6
      //   58: iconst_4
      //   59: ldc 3
      //   61: aload 6
      //   63: invokestatic 221	org/eclipse/team/internal/core/TeamPlugin:log	(ILjava/lang/String;Ljava/lang/Throwable;)V
      //   66: aload 5
      //   68: athrow
      //   69: iload 4
      //   71: ifne +33 -> 104
      //   74: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
      //   77: aload_3
      //   78: invokeinterface 246 2 0
      //   83: goto +21 -> 104
      //   86: astore 6
      //   88: iconst_4
      //   89: ldc 3
      //   91: aload 6
      //   93: invokestatic 221	org/eclipse/team/internal/core/TeamPlugin:log	(ILjava/lang/String;Ljava/lang/Throwable;)V
      //   96: goto +8 -> 104
      //   99: aload_0
      //   100: aload_3
      //   101: invokespecial 227	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:addRule	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;)V
      //   104: aload_3
      //   105: areturn
      // Line number table:
      //   Java source line #64	-> byte code offset #0
      //   Java source line #65	-> byte code offset #6
      //   Java source line #66	-> byte code offset #13
      //   Java source line #68	-> byte code offset #16
      //   Java source line #69	-> byte code offset #26
      //   Java source line #70	-> byte code offset #31
      //   Java source line #71	-> byte code offset #37
      //   Java source line #72	-> byte code offset #39
      //   Java source line #78	-> byte code offset #44
      //   Java source line #79	-> byte code offset #56
      //   Java source line #81	-> byte code offset #58
      //   Java source line #84	-> byte code offset #66
      //   Java source line #72	-> byte code offset #69
      //   Java source line #78	-> byte code offset #74
      //   Java source line #79	-> byte code offset #86
      //   Java source line #81	-> byte code offset #88
      //   Java source line #88	-> byte code offset #99
      //   Java source line #90	-> byte code offset #104
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	106	0	this	ThreadInfo
      //   0	106	1	resource	ISchedulingRule
      //   0	106	2	monitor	IProgressMonitor
      //   5	100	3	rule	ISchedulingRule
      //   14	56	4	success	boolean
      //   37	30	5	localObject	Object
      //   56	6	6	e	RuntimeException
      //   86	6	6	e	RuntimeException
      // Exception table:
      //   from	to	target	type
      //   16	37	37	finally
      //   44	53	56	java/lang/RuntimeException
      //   74	83	86	java/lang/RuntimeException
    }
    
    /* Error */
    public void popRule(ISchedulingRule rule, IProgressMonitor monitor)
      throws TeamException
    {
      // Byte code:
      //   0: aload_0
      //   1: invokespecial 222	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:isFlushRequired	()Z
      //   4: ifeq +85 -> 89
      //   7: aload_0
      //   8: aload_2
      //   9: invokevirtual 225	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:flush	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
      //   12: goto +77 -> 89
      //   15: astore_3
      //   16: aload_0
      //   17: invokespecial 226	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:removeRule	()Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   20: astore 4
      //   22: aload_1
      //   23: ifnonnull +7 -> 30
      //   26: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   29: astore_1
      //   30: aload 4
      //   32: aload_1
      //   33: invokevirtual 210	java/lang/Object:equals	(Ljava/lang/Object;)Z
      //   36: new 101	java/lang/StringBuffer
      //   39: dup
      //   40: ldc 4
      //   42: invokespecial 212	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
      //   45: aload_1
      //   46: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
      //   49: ldc 2
      //   51: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
      //   54: aload 4
      //   56: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
      //   59: ldc 1
      //   61: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
      //   64: invokevirtual 211	java/lang/StringBuffer:toString	()Ljava/lang/String;
      //   67: invokestatic 217	org/eclipse/core/runtime/Assert:isTrue	(ZLjava/lang/String;)Z
      //   70: pop
      //   71: aload_1
      //   72: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   75: if_acmpeq +12 -> 87
      //   78: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
      //   81: aload_1
      //   82: invokeinterface 246 2 0
      //   87: aload_3
      //   88: athrow
      //   89: aload_0
      //   90: invokespecial 226	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:removeRule	()Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   93: astore 4
      //   95: aload_1
      //   96: ifnonnull +7 -> 103
      //   99: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   102: astore_1
      //   103: aload 4
      //   105: aload_1
      //   106: invokevirtual 210	java/lang/Object:equals	(Ljava/lang/Object;)Z
      //   109: new 101	java/lang/StringBuffer
      //   112: dup
      //   113: ldc 4
      //   115: invokespecial 212	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
      //   118: aload_1
      //   119: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
      //   122: ldc 2
      //   124: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
      //   127: aload 4
      //   129: invokevirtual 213	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
      //   132: ldc 1
      //   134: invokevirtual 214	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
      //   137: invokevirtual 211	java/lang/StringBuffer:toString	()Ljava/lang/String;
      //   140: invokestatic 217	org/eclipse/core/runtime/Assert:isTrue	(ZLjava/lang/String;)Z
      //   143: pop
      //   144: aload_1
      //   145: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
      //   148: if_acmpeq +12 -> 160
      //   151: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
      //   154: aload_1
      //   155: invokeinterface 246 2 0
      //   160: return
      // Line number table:
      //   Java source line #104	-> byte code offset #0
      //   Java source line #105	-> byte code offset #7
      //   Java source line #107	-> byte code offset #15
      //   Java source line #108	-> byte code offset #16
      //   Java source line #109	-> byte code offset #22
      //   Java source line #110	-> byte code offset #26
      //   Java source line #112	-> byte code offset #30
      //   Java source line #113	-> byte code offset #71
      //   Java source line #114	-> byte code offset #78
      //   Java source line #116	-> byte code offset #87
      //   Java source line #108	-> byte code offset #89
      //   Java source line #109	-> byte code offset #95
      //   Java source line #110	-> byte code offset #99
      //   Java source line #112	-> byte code offset #103
      //   Java source line #113	-> byte code offset #144
      //   Java source line #114	-> byte code offset #151
      //   Java source line #117	-> byte code offset #160
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	161	0	this	ThreadInfo
      //   0	161	1	rule	ISchedulingRule
      //   0	161	2	monitor	IProgressMonitor
      //   15	73	3	localObject	Object
      //   20	35	4	stackedRule	ISchedulingRule
      //   93	35	4	stackedRule	ISchedulingRule
      // Exception table:
      //   from	to	target	type
      //   0	15	15	finally
    }
    
    private ISchedulingRule getRuleForResoure(ISchedulingRule resourceRule)
    {
      ISchedulingRule rule;
      ISchedulingRule rule;
      if ((resourceRule instanceof IResource))
      {
        IResource resource = (IResource)resourceRule;
        ISchedulingRule rule;
        if (resource.getType() == 8)
        {
          rule = BatchingLock.NULL_SCHEDULING_RULE;
        }
        else
        {
          ISchedulingRule rule;
          if (resource.getType() == 4) {
            rule = resource;
          } else {
            rule = resource.getParent();
          }
        }
      }
      else
      {
        ISchedulingRule rule;
        if ((resourceRule instanceof MultiRule))
        {
          ISchedulingRule[] rules = ((MultiRule)resourceRule).getChildren();
          Set projects = new HashSet();
          for (int i = 0; i < rules.length; i++)
          {
            ISchedulingRule childRule = rules[i];
            if ((childRule instanceof IResource)) {
              projects.add(((IResource)childRule).getProject());
            }
          }
          ISchedulingRule rule;
          if (projects.isEmpty())
          {
            rule = BatchingLock.NULL_SCHEDULING_RULE;
          }
          else
          {
            ISchedulingRule rule;
            if (projects.size() == 1) {
              rule = (ISchedulingRule)projects.iterator().next();
            } else {
              rule = new MultiRule((ISchedulingRule[])projects.toArray(new ISchedulingRule[projects.size()]));
            }
          }
        }
        else
        {
          rule = BatchingLock.NULL_SCHEDULING_RULE;
        }
      }
      return rule;
    }
    
    public boolean isNested()
    {
      return !rules.isEmpty();
    }
    
    public void addChangedResource(IResource resource)
    {
      changedResources.add(resource);
    }
    
    public boolean isEmpty()
    {
      return changedResources.isEmpty();
    }
    
    public IResource[] getChangedResources()
    {
      return (IResource[])changedResources.toArray(new IResource[changedResources.size()]);
    }
    
    /* Error */
    public void flush(IProgressMonitor monitor)
      throws TeamException
    {
      // Byte code:
      //   0: aload_0
      //   1: getfield 208	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:operation	Lorg/eclipse/team/internal/core/subscribers/BatchingLock$IFlushOperation;
      //   4: aload_0
      //   5: aload_1
      //   6: invokeinterface 249 3 0
      //   11: goto +34 -> 45
      //   14: astore_2
      //   15: aload_2
      //   16: athrow
      //   17: astore_2
      //   18: aload_0
      //   19: aload_2
      //   20: invokespecial 224	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:handleAbortedFlush	(Ljava/lang/Throwable;)V
      //   23: aload_2
      //   24: athrow
      //   25: astore_2
      //   26: aload_0
      //   27: aload_2
      //   28: invokespecial 224	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:handleAbortedFlush	(Ljava/lang/Throwable;)V
      //   31: aload_2
      //   32: athrow
      //   33: astore_3
      //   34: aload_0
      //   35: getfield 206	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:changedResources	Ljava/util/Set;
      //   38: invokeinterface 238 1 0
      //   43: aload_3
      //   44: athrow
      //   45: aload_0
      //   46: getfield 206	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:changedResources	Ljava/util/Set;
      //   49: invokeinterface 238 1 0
      //   54: return
      // Line number table:
      //   Java source line #173	-> byte code offset #0
      //   Java source line #174	-> byte code offset #14
      //   Java source line #175	-> byte code offset #15
      //   Java source line #176	-> byte code offset #17
      //   Java source line #177	-> byte code offset #18
      //   Java source line #178	-> byte code offset #23
      //   Java source line #179	-> byte code offset #25
      //   Java source line #180	-> byte code offset #26
      //   Java source line #181	-> byte code offset #31
      //   Java source line #182	-> byte code offset #33
      //   Java source line #185	-> byte code offset #34
      //   Java source line #186	-> byte code offset #43
      //   Java source line #185	-> byte code offset #45
      //   Java source line #187	-> byte code offset #54
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	55	0	this	ThreadInfo
      //   0	55	1	monitor	IProgressMonitor
      //   14	2	2	e	OutOfMemoryError
      //   17	7	2	e	Error
      //   25	7	2	e	RuntimeException
      //   33	11	3	localObject	Object
      // Exception table:
      //   from	to	target	type
      //   0	11	14	java/lang/OutOfMemoryError
      //   0	11	17	java/lang/Error
      //   0	11	25	java/lang/RuntimeException
      //   0	33	33	finally
    }
    
    private boolean isFlushRequired()
    {
      return (rules.size() == 1) || (remainingRulesAreNull());
    }
    
    private boolean remainingRulesAreNull()
    {
      for (int i = 0; i < rules.size() - 1; i++)
      {
        ISchedulingRule rule = (ISchedulingRule)rules.get(i);
        if (rule != BatchingLock.NULL_SCHEDULING_RULE) {
          return false;
        }
      }
      return true;
    }
    
    private void handleAbortedFlush(Throwable t)
    {
      TeamPlugin.log(4, Messages.BatchingLock_11, t);
    }
    
    private void addRule(ISchedulingRule rule)
    {
      rules.add(rule);
    }
    
    private ISchedulingRule removeRule()
    {
      return (ISchedulingRule)rules.remove(rules.size() - 1);
    }
    
    public boolean ruleContains(IResource resource)
    {
      for (Iterator iter = rules.iterator(); iter.hasNext();)
      {
        ISchedulingRule rule = (ISchedulingRule)iter.next();
        if ((rule != BatchingLock.NULL_SCHEDULING_RULE) && (rule.contains(resource))) {
          return true;
        }
      }
      return false;
    }
  }
  
  private Map infos = new HashMap();
  
  protected ThreadInfo getThreadInfo()
  {
    Thread thisThread = Thread.currentThread();
    synchronized (infos)
    {
      ThreadInfo info = (ThreadInfo)infos.get(thisThread);
      return info;
    }
  }
  
  private ThreadInfo getThreadInfo(IResource resource)
  {
    synchronized (infos)
    {
      for (Iterator iter = infos.values().iterator(); iter.hasNext();)
      {
        ThreadInfo info = (ThreadInfo)iter.next();
        if (info.ruleContains(resource)) {
          return info;
        }
      }
      return null;
    }
  }
  
  public ISchedulingRule acquire(ISchedulingRule resourceRule, IFlushOperation operation, IProgressMonitor monitor)
  {
    ThreadInfo info = getThreadInfo();
    boolean added = false;
    synchronized (infos)
    {
      if (info == null)
      {
        info = createThreadInfo(operation);
        Thread thisThread = Thread.currentThread();
        infos.put(thisThread, info);
        added = true;
        if (DEBUG) {
          System.out.println("[" + thisThread.getName() + "] acquired batching lock on " + resourceRule);
        }
      }
    }
    try
    {
      return info.pushRule(resourceRule, monitor);
    }
    catch (OperationCanceledException e)
    {
      if (added) {
        synchronized (infos)
        {
          infos.remove(Thread.currentThread());
        }
      }
      throw e;
    }
  }
  
  protected ThreadInfo createThreadInfo(IFlushOperation operation)
  {
    return new ThreadInfo(operation);
  }
  
  public void release(ISchedulingRule rule, IProgressMonitor monitor)
    throws TeamException
  {
    ThreadInfo info = getThreadInfo();
    Assert.isNotNull(info, "Unmatched acquire/release.");
    Assert.isTrue(info.isNested(), "Unmatched acquire/release.");
    info.popRule(rule, monitor);
    synchronized (infos)
    {
      if (!info.isNested())
      {
        Thread thisThread = Thread.currentThread();
        if (DEBUG) {
          System.out.println("[" + thisThread.getName() + "] released batching lock");
        }
        infos.remove(thisThread);
      }
    }
  }
  
  public void resourceChanged(IResource resource)
  {
    ThreadInfo info = getThreadInfo();
    Assert.isNotNull(info, "Folder changed outside of resource lock");
    info.addChangedResource(resource);
  }
  
  public void flush(IProgressMonitor monitor)
    throws TeamException
  {
    ThreadInfo info = getThreadInfo();
    Assert.isNotNull(info, "Flush requested outside of resource lock");
    info.flush(monitor);
  }
  
  public boolean isWithinActiveOperationScope(IResource resource)
  {
    synchronized (infos)
    {
      return getThreadInfo(resource) != null;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.BatchingLock
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.IResource;

public abstract class ChangeSet
{
  private String name;
  
  protected ChangeSet() {}
  
  public ChangeSet(String name)
  {
    this.name = name;
  }
  
  public abstract IResource[] getResources();
  
  public abstract boolean isEmpty();
  
  public abstract boolean contains(IResource paramIResource);
  
  public abstract void remove(IResource paramIResource);
  
  public void remove(IResource[] resources)
  {
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      remove(resource);
    }
  }
  
  public abstract void rootRemoved(IResource paramIResource, int paramInt);
  
  public abstract String getComment();
  
  public String getName()
  {
    return name;
  }
  
  protected void setName(String name)
  {
    this.name = name;
  }
  
  public abstract boolean containsChildren(IResource paramIResource, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.ChangeSet
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.runtime.ISafeRunnable;

class ChangeSetManager$1
  implements ISafeRunnable
{
  final ChangeSetManager this$0;
  private final IChangeSetChangeListener val$listener;
  private final ChangeSet val$set;
  
  ChangeSetManager$1(ChangeSetManager paramChangeSetManager, IChangeSetChangeListener paramIChangeSetChangeListener, ChangeSet paramChangeSet)
  {
    this$0 = paramChangeSetManager;val$listener = paramIChangeSetChangeListener;val$set = paramChangeSet;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.nameChanged(val$set);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.ChangeSetManager.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.runtime.ISafeRunnable;

class ChangeSetManager$2
  implements ISafeRunnable
{
  final ChangeSetManager this$0;
  private final IChangeSetChangeListener val$listener;
  private final ChangeSet val$oldSet;
  private final ChangeSet val$defaultSet;
  
  ChangeSetManager$2(ChangeSetManager paramChangeSetManager, IChangeSetChangeListener paramIChangeSetChangeListener, ChangeSet paramChangeSet1, ChangeSet paramChangeSet2)
  {
    this$0 = paramChangeSetManager;val$listener = paramIChangeSetChangeListener;val$oldSet = paramChangeSet1;val$defaultSet = paramChangeSet2;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.defaultSetChanged(val$oldSet, val$defaultSet);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.ChangeSetManager.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.runtime.ISafeRunnable;

class ChangeSetManager$3
  implements ISafeRunnable
{
  final ChangeSetManager this$0;
  private final IChangeSetChangeListener val$listener;
  private final ChangeSet val$set;
  
  ChangeSetManager$3(ChangeSetManager paramChangeSetManager, IChangeSetChangeListener paramIChangeSetChangeListener, ChangeSet paramChangeSet)
  {
    this$0 = paramChangeSetManager;val$listener = paramIChangeSetChangeListener;val$set = paramChangeSet;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.setAdded(val$set);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.ChangeSetManager.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.runtime.ISafeRunnable;

class ChangeSetManager$4
  implements ISafeRunnable
{
  final ChangeSetManager this$0;
  private final IChangeSetChangeListener val$listener;
  private final ChangeSet val$set;
  
  ChangeSetManager$4(ChangeSetManager paramChangeSetManager, IChangeSetChangeListener paramIChangeSetChangeListener, ChangeSet paramChangeSet)
  {
    this$0 = paramChangeSetManager;val$listener = paramIChangeSetChangeListener;val$set = paramChangeSet;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.setRemoved(val$set);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.ChangeSetManager.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ISafeRunnable;

class ChangeSetManager$5
  implements ISafeRunnable
{
  final ChangeSetManager this$0;
  private 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd