org.eclipse.equinox.util_1.0.300.v20110502

16:44:51.488 INFO  jd.cli.Main - Decompiling org.eclipse.equinox.util_1.0.300.v20110502.jar
package org.eclipse.equinox.internal.util;

import org.eclipse.equinox.internal.util.hash.HashIntObjNS;

public class TracerMap
{
  public static HashIntObjNS getMap()
  {
    HashIntObjNS map = new HashIntObjNS(29);
    
    map.put(1, "[BEGIN - start method]");
    map.put(1001, "[BEGIN - Log instance] Loading referent classes took");
    map.put(101, "Getting system props, bundle id and log service took ");
    map.put(102, "Getting Trace Service took ");
    map.put(3001, "Loading tracer map took ");
    map.put(2001, "[END - Log instance] Creating log instance took ");
    map.put(3, "Creating Thread Pool service took ");
    map.put(4, "Registering Thread Pool service took ");
    map.put(33, "Creating Timer service took ");
    map.put(5, "Registering Timer service took ");
    map.put(16, "[END - start method] PutilActivator.start() method executed for ");
    map.put(0, "Putil Activator");
    map.put(65280, "Threadpool");
    map.put(10001, "Registering commands with groupname ");
    map.put(10002, "Unregistering commands with groupname ");
    map.put(10003, "START Running: ");
    map.put(10004, "END Running: ");
    map.put(10005, "Going to run: ");
    return map;
  }
  
  public static HashIntObjNS getStarts()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.TracerMap
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util;

import java.io.PrintStream;
import org.eclipse.equinox.internal.util.impl.tpt.threadpool.ThreadPoolFactoryImpl;
import org.eclipse.equinox.internal.util.impl.tpt.timer.TimerFactory;
import org.eclipse.equinox.internal.util.ref.Log;
import org.eclipse.equinox.internal.util.threadpool.ThreadPoolFactory;
import org.eclipse.equinox.internal.util.threadpool.ThreadPoolManager;
import org.eclipse.equinox.internal.util.timer.Timer;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceRegistration;

public class UtilActivator
  implements BundleActivator
{
  public static ThreadPoolFactoryImpl thMan;
  private ServiceRegistration thManReg;
  public static TimerFactory timer;
  private ServiceRegistration timerReg;
  public static Log log;
  public static int debugLevel = 1;
  public static BundleContext bc;
  public static boolean LOG_DEBUG;
  public static boolean startup;
  static long[] time = null;
  
  static void timeLog(int id)
  {
    time[1] = time[0];
    log.debug(0, id, String.valueOf((time[0] = System.currentTimeMillis()) - time[1]), null, false, true);
  }
  
  public static long[] points = null;
  
  public void start(BundleContext bc)
    throws BundleException
  {
    bc = bc;
    startup = getBoolean("equinox.measurements.bundles");
    if (startup)
    {
      long tmp = System.currentTimeMillis();
      time = new long[] { tmp, 0, tmp };
      points = new long[3];
    }
    bc = bc;
    try
    {
      log = new Log(bc, false);
      LOG_DEBUG = getBoolean("equinox.putil.debug");
      log.setDebug(LOG_DEBUG);
      log.setPrintOnConsole(getBoolean("equinox.putil.console"));
      debugLevel = getInteger("equinox.putil.debug.level", 1);
      if (startup)
      {
        if (LOG_DEBUG) {
          log.setMaps(TracerMap.getMap(), TracerMap.getStarts());
        }
        log.debug(0, 1, null, null, false, true);
        
        log.debug(0, 1001, String.valueOf(points[0] - time[0]), null, false, true);
        
        log.debug(0, 101, String.valueOf(points[1] - points[0]), null, false, true);
        
        log.debug(0, 102, String.valueOf(points[2] - points[1]), null, false, true);
        time[1] = time[0];
        
        log.debug(0, 3001, String.valueOf((time[0] = System.currentTimeMillis()) - points[2]), null, false, true);
        
        log.debug(0, 2001, String.valueOf(time[0] - time[1]), null, false, true);
      }
      String bundleName = ThreadPoolFactoryImpl.getName(bc.getBundle());
      thMan = new ThreadPoolFactoryImpl(bundleName, log);
      if (startup) {
        timeLog(3);
      }
      thManReg = bc.registerService(new String[] { ThreadPoolManager.class.getName(), ThreadPoolFactory.class.getName() }, thMan, null);
      if (startup) {
        timeLog(4);
      }
      timer = new TimerFactory(bundleName, thMan, log);
      if (startup) {
        timeLog(33);
      }
      int i = getInteger("equinox.util.threadpool.inactiveTime", 30);
      timerReg = bc.registerService(Timer.class.getName(), timer, null);
      timer.addNotifyListener(ThreadPoolFactoryImpl.threadPool, 5, 1, i * 1000L, 0);
      
      org.eclipse.equinox.internal.util.ref.TimerRef.timer = timer;
      if (startup) {
        timeLog(5);
      }
      if (startup)
      {
        log.debug(0, 16, String.valueOf(time[0] - time[2]), null, false, true);
        time = points = null;
      }
    }
    catch (Throwable ee)
    {
      ee.printStackTrace();
      System.out.println("log1: " + log);
      log.error("[UtilActivator] An error has occurred while starting ProSyst Utility Bundle.", ee);
      throw new BundleException("Error while starting ProSyst Utililty Bundle!", ee);
    }
  }
  
  /* Error */
  public void stop(BundleContext bc)
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 245	org/eclipse/equinox/internal/util/UtilActivator:thManReg	Lorg/osgi/framework/ServiceRegistration;
    //   4: invokeinterface 288 1 0
    //   9: aload_0
    //   10: getfield 246	org/eclipse/equinox/internal/util/UtilActivator:timerReg	Lorg/osgi/framework/ServiceRegistration;
    //   13: invokeinterface 288 1 0
    //   18: invokestatic 273	org/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory:stopTimer	()V
    //   21: aconst_null
    //   22: dup
    //   23: putstatic 242	org/eclipse/equinox/internal/util/UtilActivator:timer	Lorg/eclipse/equinox/internal/util/impl/tpt/timer/TimerFactory;
    //   26: putstatic 248	org/eclipse/equinox/internal/util/ref/TimerRef:timer	Lorg/eclipse/equinox/internal/util/timer/Timer;
    //   29: invokestatic 270	org/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl:stopThreadPool	()V
    //   32: aconst_null
    //   33: putstatic 241	org/eclipse/equinox/internal/util/UtilActivator:thMan	Lorg/eclipse/equinox/internal/util/impl/tpt/threadpool/ThreadPoolFactoryImpl;
    //   36: goto +39 -> 75
    //   39: astore_2
    //   40: getstatic 243	org/eclipse/equinox/internal/util/UtilActivator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   43: ldc_w 120
    //   46: aload_2
    //   47: invokevirtual 281	org/eclipse/equinox/internal/util/ref/Log:error	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   50: new 141	org/osgi/framework/BundleException
    //   53: dup
    //   54: ldc_w 119
    //   57: aload_2
    //   58: invokespecial 283	org/osgi/framework/BundleException:<init>	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   61: athrow
    //   62: astore_3
    //   63: getstatic 243	org/eclipse/equinox/internal/util/UtilActivator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   66: invokevirtual 276	org/eclipse/equinox/internal/util/ref/Log:close	()V
    //   69: aconst_null
    //   70: putstatic 243	org/eclipse/equinox/internal/util/UtilActivator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   73: aload_3
    //   74: athrow
    //   75: getstatic 243	org/eclipse/equinox/internal/util/UtilActivator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   78: invokevirtual 276	org/eclipse/equinox/internal/util/ref/Log:close	()V
    //   81: aconst_null
    //   82: putstatic 243	org/eclipse/equinox/internal/util/UtilActivator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   85: return
    // Line number table:
    //   Java source line #160	-> byte code offset #0
    //   Java source line #162	-> byte code offset #9
    //   Java source line #163	-> byte code offset #18
    //   Java source line #164	-> byte code offset #21
    //   Java source line #166	-> byte code offset #29
    //   Java source line #167	-> byte code offset #32
    //   Java source line #168	-> byte code offset #39
    //   Java source line #169	-> byte code offset #40
    //   Java source line #170	-> byte code offset #50
    //   Java source line #171	-> byte code offset #62
    //   Java source line #172	-> byte code offset #63
    //   Java source line #173	-> byte code offset #69
    //   Java source line #174	-> byte code offset #73
    //   Java source line #172	-> byte code offset #75
    //   Java source line #173	-> byte code offset #81
    //   Java source line #175	-> byte code offset #85
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	86	0	this	UtilActivator
    //   0	86	1	bc	BundleContext
    //   39	19	2	e	Throwable
    //   62	12	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	36	39	java/lang/Throwable
    //   0	62	62	finally
  }
  
  public static boolean getBoolean(String property)
  {
    String prop = bc != null ? bc.getProperty(property) : System.getProperty(property);
    return (prop != null) && (prop.equalsIgnoreCase("true"));
  }
  
  public static int getInteger(String property, int defaultValue)
  {
    String prop = bc != null ? bc.getProperty(property) : System.getProperty(property);
    if (prop != null) {
      try
      {
        return Integer.decode(prop).intValue();
      }
      catch (NumberFormatException localNumberFormatException) {}
    }
    return defaultValue;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.UtilActivator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.event;

import java.security.AccessController;

public abstract class EventThread
  implements Runnable
{
  public Object bad;
  protected Queue queue;
  protected int state;
  protected long time = 0L;
  protected int counter = 1;
  protected Object element;
  protected String baseName;
  protected String name;
  protected Thread thread;
  protected ThreadGroup group;
  private static PrivilegedActionImpl privilegedAction = null;
  
  public EventThread(ThreadGroup group, String name, int size)
  {
    makeThread(this.group = group, this.name = name + '0');
    baseName = name;
    queue = new Queue(size);
    int priority = getThreadPriority();
    if (priority != 5) {
      thread.setPriority(priority);
    }
  }
  
  public EventThread(ThreadGroup group, String name, Queue queue)
  {
    makeThread(this.group = group, this.name = name + '0');
    baseName = name;
    this.queue = queue;
    int priority = getThreadPriority();
    if (priority != 5) {
      thread.setPriority(priority);
    }
  }
  
  protected EventThread(EventThread old)
  {
    makeThread(group = thread.getThreadGroup(), name = baseName + counter++);
    baseName = baseName;
    counter = counter;
    queue = queue;
    int priority = getThreadPriority();
    if (priority != 5) {
      thread.setPriority(priority);
    }
  }
  
  public void start()
  {
    thread.start();
  }
  
  public void addEvent(Object event, boolean check)
  {
    try
    {
      queue.put(event);
    }
    catch (Throwable t)
    {
      print(t);
      return;
    }
    if ((state & 0x2) != 0) {
      queue.notify();
    } else if ((check) && (checkTime())) {
      try
      {
        state |= 0x1;
        newEventDispatcher();
      }
      catch (Throwable t)
      {
        print(t);
        state &= 0xFE;
      }
    }
  }
  
  public void run()
  {
    synchronized (queue)
    {
      queue.notifyAll();
    }
    try
    {
      for (;;)
      {
        synchronized (queue)
        {
          if ((state & 0x1) != 0)
          {
            return;
            try
            {
              state |= 0x2;
              queue.wait();
              if ((state & 0x1) != 0) {
                return;
              }
              state &= 0xFD;
            }
            catch (InterruptedException localInterruptedException) {}
          }
          if ((element = queue.get()) == null) {
            continue;
          }
        }
        processEvent();
      }
    }
    catch (Throwable t)
    {
      print(t);
      try
      {
        throw new Exception();
      }
      catch (Exception localException) {}
    }
  }
  
  private void makeThread(ThreadGroup group, String name)
  {
    try
    {
      if (privilegedAction == null) {
        privilegedAction = new PrivilegedActionImpl();
      }
      privilegedAction.set(group, this, name);
      thread = ((Thread)AccessController.doPrivileged(privilegedAction));
    }
    catch (RuntimeException re)
    {
      throw re;
    }
    catch (Exception exc)
    {
      throw new RuntimeException(exc.toString());
    }
  }
  
  public Thread getThread()
  {
    return thread;
  }
  
  public String getName()
  {
    return name;
  }
  
  public abstract int getThreadPriority();
  
  public abstract void processEvent();
  
  public abstract boolean checkTime();
  
  public abstract void newEventDispatcher();
  
  public abstract void print(Throwable paramThrowable);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.event.EventThread
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.event;

import java.security.PrivilegedAction;
import org.eclipse.equinox.internal.util.UtilActivator;

class PrivilegedActionImpl
  implements PrivilegedAction
{
  private ThreadGroup group;
  private Runnable runnable;
  private String name;
  private boolean locked = false;
  private int waiting = 0;
  
  void set(ThreadGroup group, Runnable runnable, String name)
  {
    lock();
    this.group = group;
    this.runnable = runnable;
    this.name = name;
  }
  
  public Object run()
  {
    ThreadGroup group = this.group;
    Runnable runnable = this.runnable;
    String name = this.name;
    unlock();
    Thread th = new Thread(group, runnable, name);
    if (!UtilActivator.getBoolean("equinox.disableContextClassLoader")) {
      th.setContextClassLoader(null);
    }
    th.setDaemon(false);
    return th;
  }
  
  private synchronized void lock()
  {
    while (locked) {
      try
      {
        waiting += 1;
        wait();
        waiting -= 1;
      }
      catch (Exception localException) {}
    }
    locked = true;
  }
  
  private synchronized void unlock()
  {
    locked = false;
    group = null;
    runnable = null;
    name = null;
    if (waiting > 0) {
      notifyAll();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.event.PrivilegedActionImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.event;

public class Queue
{
  protected Object[] queue;
  protected int first;
  protected int last = -1;
  protected int initial;
  protected int count;
  protected int increment;
  protected int decrement;
  
  public Queue(int size)
  {
    queue = new Object[initial = size];
    increment = (initial / 2);
    decrement = (increment + increment / 2);
  }
  
  public void put(Object element)
  {
    if (count == queue.length) {
      resize(true);
    }
    queue[(++last == queue.length ? (last = 0) : last)] = element;
    count += 1;
  }
  
  public void unget(Object element)
  {
    if (count == queue.length) {
      resize(true);
    }
    queue[(--first == -1 ? (first = queue.length - 1) : first)] = element;
    count += 1;
  }
  
  public Object get()
  {
    if (count == 0) {
      return null;
    }
    if ((queue.length > initial) && (queue.length - count > decrement)) {
      resize(false);
    }
    Object element = queue[first];
    queue[(first++)] = null;
    if (first == queue.length) {
      first = 0;
    }
    count -= 1;
    return element;
  }
  
  public void clear()
  {
    if (queue.length > initial)
    {
      queue = new Object[initial];
      count = 0;
    }
    else
    {
      for (; count > 0; count -= 1)
      {
        queue[(first++)] = null;
        if (first == queue.length) {
          first = 0;
        }
      }
    }
    first = 0;
    last = -1;
  }
  
  public int size()
  {
    return count;
  }
  
  protected void resize(boolean up)
  {
    Object[] tmp = new Object[queue.length + (up ? increment : -increment)];
    if (first <= last)
    {
      System.arraycopy(queue, first, tmp, 0, count);
    }
    else
    {
      int count1 = queue.length - first;
      if (count1 > 0) {
        System.arraycopy(queue, first, tmp, 0, count1);
      }
      if (count > count1) {
        System.arraycopy(queue, 0, tmp, count1, count - count1);
      }
    }
    queue = tmp;
    first = 0;
    last = (count - 1);
    
    increment = (queue.length / 2);
    decrement = (increment + increment / 2);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.event.Queue
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.event;

public abstract interface SystemListener
{
  public abstract boolean timeoutOccured();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.event.SystemListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

public class HashIntObjNS
{
  static final float LOAD_FACTOR = 0.75F;
  private int count = 0;
  private int step = 499979;
  public int[] keys;
  public Object[] values;
  public int[] next;
  private int limit;
  private double loadFactor;
  
  public HashIntObjNS()
  {
    this(101, 0.75D);
  }
  
  public HashIntObjNS(int capacity)
  {
    this(capacity, 0.75D);
  }
  
  public HashIntObjNS(int capacity, double lf)
  {
    if (capacity < 0) {
      throw new IllegalArgumentException("Invalid hashtable capacity: " + capacity + ".");
    }
    if (capacity == 0) {
      capacity = 101;
    }
    if (lf < 0.0D) {
      throw new IllegalArgumentException("Invalid load factor: " + lf + ".");
    }
    if (lf > 1.0D) {
      lf = 1.0D;
    }
    loadFactor = lf;
    limit = ((int)(capacity * lf));
    count = 0;
    
    keys = new int[capacity];
    values = new Object[capacity];
    next = new int[capacity];
    for (int i = 0; i < capacity; i++)
    {
      keys[i] = 0;
      next[i] = -1;
    }
  }
  
  public void put(int key, Object value)
  {
    if (count >= limit) {
      rehash();
    }
    if (_put(key, value)) {
      count += 1;
    }
  }
  
  public Object get(int key)
  {
    int pos = find(key);
    return pos == -1 ? null : values[pos];
  }
  
  public Object remove(int key)
  {
    int pos = find(key);
    if (pos == -1) {
      return null;
    }
    next[pos] += next.length;
    count -= 1;
    Object tmp = values[pos];
    values[pos] = null;
    return tmp;
  }
  
  public void removeAll()
  {
    for (int i = 0; i < values.length; i++)
    {
      values[i] = null;
      keys[i] = 0;
      next[i] = -1;
    }
    count = 0;
  }
  
  public void rehash()
  {
    int[] tmpKeys = this.keys;
    Object[] tmpValues = this.values;
    int[] tmpNext = this.next;
    
    int capacity = this.keys.length * 2 + 1;
    
    int[] keys = new int[capacity];
    Object[] values = new Object[capacity];
    int[] next = new int[capacity];
    for (int i = 0; i < next.length; i++) {
      next[i] = -1;
    }
    this.keys = keys;
    this.values = values;
    this.next = next;
    for (int i = 0; i < tmpNext.length; i++) {
      if ((tmpNext[i] >= 0) && (tmpNext[i] < tmpNext.length)) {
        _put(tmpKeys[i], tmpValues[i]);
      }
    }
    limit = ((int)(capacity * loadFactor));
  }
  
  public int size()
  {
    return count;
  }
  
  private int find(int key)
  {
    int pos = (key & 0x7FFFFFFF) % keys.length;
    int i = 0;
    while (next[pos] >= 0)
    {
      if ((keys[pos] == key) && 
        (next[pos] < next.length)) {
        return pos;
      }
      if ((pos = next[pos]) >= next.length) {
        pos -= next.length;
      }
      i++;
      if (i > next.length) {
        return -1;
      }
    }
    return -1;
  }
  
  private boolean _put(int key, Object value)
  {
    int index = find(key);
    if (index != -1)
    {
      values[index] = value;
      return false;
    }
    int pos = (key & 0x7FFFFFFF) % keys.length;
    while ((next[pos] >= 0) && (next[pos] < next.length)) {
      pos = next[pos];
    }
    keys[pos] = key;
    values[pos] = value;
    if (next[pos] < 0) {
      next[pos] = ((pos + step) % next.length);
    } else {
      next[pos] -= next.length;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashIntObjNS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

public final class HashIntObjS
  extends HashIntObjNS
{
  public HashIntObjS()
  {
    super(101, 0.75D);
  }
  
  public HashIntObjS(int capacity)
  {
    super(capacity, 0.75D);
  }
  
  public HashIntObjS(int capacity, double lf)
  {
    super(capacity, lf);
  }
  
  public synchronized void put(int key, Object value)
  {
    super.put(key, value);
  }
  
  public synchronized Object get(int key)
  {
    return super.get(key);
  }
  
  public synchronized Object remove(int key)
  {
    return super.remove(key);
  }
  
  public synchronized int size()
  {
    return super.size();
  }
  
  public synchronized void removeAll()
  {
    super.removeAll();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashIntObjS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

public class HashLongObjNS
{
  static final float LOAD_FACTOR = 0.75F;
  private int count = 0;
  private int step = 499979;
  public long[] keys;
  public Object[] values;
  public int[] next;
  private int limit;
  private double loadFactor;
  
  public HashLongObjNS()
  {
    this(101, 0.75D);
  }
  
  public HashLongObjNS(int capacity)
  {
    this(capacity, 0.75D);
  }
  
  public HashLongObjNS(int capacity, double lf)
  {
    if (capacity < 0) {
      throw new IllegalArgumentException("Invalid hashtable capacity: " + capacity + ".");
    }
    if (capacity == 0) {
      capacity = 101;
    }
    if (lf < 0.0D) {
      throw new IllegalArgumentException("Invalid load factor: " + lf + ".");
    }
    if (lf > 1.0D) {
      lf = 1.0D;
    }
    loadFactor = lf;
    limit = ((int)(capacity * lf));
    count = 0;
    
    keys = new long[capacity];
    values = new Object[capacity];
    next = new int[capacity];
    for (int i = 0; i < capacity; i++)
    {
      keys[i] = 0L;
      next[i] = -1;
    }
  }
  
  public void put(long key, Object value)
  {
    if (count >= limit) {
      rehash();
    }
    if (_put(key, value)) {
      count += 1;
    }
  }
  
  public Object get(long key)
  {
    int pos = find(key);
    return pos == -1 ? null : values[pos];
  }
  
  public Object remove(long key)
  {
    int pos = find(key);
    if (pos == -1) {
      return null;
    }
    next[pos] += next.length;
    count -= 1;
    Object tmp = values[pos];
    values[pos] = null;
    return tmp;
  }
  
  public void removeAll()
  {
    for (int i = 0; i < values.length; i++)
    {
      values[i] = null;
      keys[i] = 0L;
      next[i] = -1;
    }
    count = 0;
  }
  
  public void rehash()
  {
    long[] tmpKeys = this.keys;
    Object[] tmpValues = this.values;
    int[] tmpNext = this.next;
    
    int capacity = this.keys.length * 2 + 1;
    
    long[] keys = new long[capacity];
    Object[] values = new Object[capacity];
    int[] next = new int[capacity];
    for (int i = 0; i < next.length; i++) {
      next[i] = -1;
    }
    this.keys = keys;
    this.values = values;
    this.next = next;
    for (int i = 0; i < tmpNext.length; i++) {
      if ((tmpNext[i] >= 0) && (tmpNext[i] < tmpNext.length)) {
        _put(tmpKeys[i], tmpValues[i]);
      }
    }
    limit = ((int)(capacity * loadFactor));
  }
  
  public int size()
  {
    return count;
  }
  
  private int find(long key)
  {
    int pos = (int)(key & 0x7FFFFFFF) % keys.length;
    int i = 0;
    while (next[pos] >= 0)
    {
      if ((keys[pos] == key) && 
        (next[pos] < next.length)) {
        return pos;
      }
      if ((pos = next[pos]) >= next.length) {
        pos -= next.length;
      }
      i++;
      if (i > next.length) {
        return -1;
      }
    }
    return -1;
  }
  
  private boolean _put(long key, Object value)
  {
    int index = find(key);
    if (index != -1)
    {
      values[index] = value;
      return false;
    }
    int pos = (int)(key & 0x7FFFFFFF) % keys.length;
    while ((next[pos] >= 0) && (next[pos] < next.length)) {
      pos = next[pos];
    }
    keys[pos] = key;
    values[pos] = value;
    if (next[pos] < 0) {
      next[pos] = ((pos + step) % next.length);
    } else {
      next[pos] -= next.length;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashLongObjNS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

public final class HashLongObjS
  extends HashLongObjNS
{
  public HashLongObjS()
  {
    super(101, 0.75D);
  }
  
  public HashLongObjS(int capacity)
  {
    super(capacity, 0.75D);
  }
  
  public HashLongObjS(int capacity, double lf)
  {
    super(capacity, lf);
  }
  
  public synchronized void put(long key, Object value)
  {
    super.put(key, value);
  }
  
  public synchronized Object get(long key)
  {
    return super.get(key);
  }
  
  public synchronized Object remove(long key)
  {
    return super.remove(key);
  }
  
  public synchronized int size()
  {
    return super.size();
  }
  
  public synchronized void removeAll()
  {
    super.removeAll();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashLongObjS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

import java.util.NoSuchElementException;

public class HashObjIntNS
{
  static final float LOAD_FACTOR = 0.75F;
  private int count = 0;
  private int step = 499979;
  public Object[] keys;
  public int[] values;
  public int[] next;
  private int limit;
  private double loadFactor;
  
  public HashObjIntNS()
  {
    this(101, 0.75D);
  }
  
  public HashObjIntNS(int capacity)
  {
    this(capacity, 0.75D);
  }
  
  public HashObjIntNS(int capacity, double lf)
  {
    if (capacity < 0) {
      throw new IllegalArgumentException("Invalid hashtable capacity: " + capacity + ".");
    }
    if (capacity == 0) {
      capacity = 101;
    }
    if (lf < 0.0D) {
      throw new IllegalArgumentException("Invalid load factor: " + lf + ".");
    }
    if (lf > 1.0D) {
      lf = 1.0D;
    }
    loadFactor = lf;
    limit = ((int)(capacity * lf));
    count = 0;
    
    keys = new Object[capacity];
    values = new int[capacity];
    next = new int[capacity];
    for (int i = 0; i < capacity; i++) {
      next[i] = -1;
    }
  }
  
  public void put(Object key, int value)
  {
    if (count >= limit) {
      rehash();
    }
    if (_put(key, value)) {
      count += 1;
    }
  }
  
  public int get(Object key)
  {
    int pos = find(key);
    if (pos == -1) {
      throw new NoSuchElementException();
    }
    return values[pos];
  }
  
  public int remove(Object key)
  {
    int pos = find(key);
    if (pos == -1) {
      throw new NoSuchElementException();
    }
    next[pos] += next.length;
    count -= 1;
    keys[pos] = null;
    return values[pos];
  }
  
  public void removeAll()
  {
    for (int i = 0; i < values.length; i++)
    {
      keys[i] = null;
      next[i] = -1;
    }
  }
  
  public void rehash()
  {
    Object[] tmpKeys = this.keys;
    int[] tmpValues = this.values;
    int[] tmpNext = this.next;
    
    int capacity = this.keys.length * 2 + 1;
    
    Object[] keys = new Object[capacity];
    int[] values = new int[capacity];
    int[] next = new int[capacity];
    for (int i = 0; i < next.length; i++) {
      next[i] = -1;
    }
    this.keys = keys;
    this.values = values;
    this.next = next;
    for (int i = 0; i < tmpNext.length; i++) {
      if ((tmpNext[i] >= 0) && (tmpNext[i] < tmpNext.length)) {
        _put(tmpKeys[i], tmpValues[i]);
      }
    }
    limit = ((int)(capacity * loadFactor));
  }
  
  public int size()
  {
    return count;
  }
  
  public Object[] getKeys()
  {
    return keys;
  }
  
  private int find(Object key)
  {
    return find(key, (key.hashCode() & 0x7FFFFFFF) % keys.length);
  }
  
  private int find(Object key, int pos)
  {
    int i = 0;
    while (next[pos] >= 0)
    {
      if (keys[pos] != null) {
        if ((key.equals(keys[pos])) && 
          (next[pos] < next.length)) {
          return pos;
        }
      }
      if ((pos = next[pos]) >= next.length) {
        pos -= next.length;
      }
      i++;
      if (i > next.length) {
        return -1;
      }
    }
    return -1;
  }
  
  private boolean _put(Object key, int value)
  {
    int pos = (key.hashCode() & 0x7FFFFFFF) % keys.length;
    int index = find(key, pos);
    if (index != -1)
    {
      values[index] = value;
      return false;
    }
    while ((next[pos] >= 0) && (next[pos] < next.length)) {
      pos = next[pos];
    }
    keys[pos] = key;
    values[pos] = value;
    if (next[pos] < 0) {
      next[pos] = ((pos + step) % next.length);
    } else {
      next[pos] -= next.length;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashObjIntNS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

public final class HashObjIntS
  extends HashObjIntNS
{
  public HashObjIntS()
  {
    super(101, 0.75D);
  }
  
  public HashObjIntS(int capacity)
  {
    super(capacity, 0.75D);
  }
  
  public HashObjIntS(int capacity, double lf)
  {
    super(capacity, lf);
  }
  
  public synchronized void put(Object key, int value)
  {
    super.put(key, value);
  }
  
  public synchronized int get(Object key)
  {
    return super.get(key);
  }
  
  public synchronized int remove(Object key)
  {
    return super.remove(key);
  }
  
  public synchronized int size()
  {
    return super.size();
  }
  
  public synchronized void removeAll()
  {
    super.removeAll();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashObjIntS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

import java.util.NoSuchElementException;

public class HashObjLongNS
{
  static final float LOAD_FACTOR = 0.75F;
  private int count = 0;
  private int step = 499979;
  public Object[] keys;
  public long[] values;
  public int[] next;
  private int limit;
  private double loadFactor;
  
  public HashObjLongNS()
  {
    this(101, 0.75D);
  }
  
  public HashObjLongNS(int capacity)
  {
    this(capacity, 0.75D);
  }
  
  public HashObjLongNS(int capacity, double lf)
  {
    if (capacity < 0) {
      throw new IllegalArgumentException("Invalid hashtable capacity: " + capacity + ".");
    }
    if (capacity == 0) {
      capacity = 101;
    }
    if (lf < 0.0D) {
      throw new IllegalArgumentException("Invalid load factor: " + lf + ".");
    }
    if (lf > 1.0D) {
      lf = 1.0D;
    }
    loadFactor = lf;
    limit = ((int)(capacity * lf));
    count = 0;
    
    keys = new Object[capacity];
    values = new long[capacity];
    next = new int[capacity];
    for (int i = 0; i < capacity; i++) {
      next[i] = -1;
    }
  }
  
  public void put(Object key, long value)
  {
    if (count >= limit) {
      rehash();
    }
    if (_put(key, value)) {
      count += 1;
    }
  }
  
  public long get(Object key)
  {
    int pos = find(key);
    if (pos == -1) {
      throw new NoSuchElementException();
    }
    return values[pos];
  }
  
  public long remove(Object key)
  {
    int pos = find(key);
    if (pos == -1) {
      throw new NoSuchElementException();
    }
    next[pos] += next.length;
    keys[pos] = null;
    count -= 1;
    return values[pos];
  }
  
  public void removeAll()
  {
    for (int i = 0; i < values.length; i++)
    {
      keys[i] = null;
      next[i] = -1;
    }
  }
  
  public void rehash()
  {
    Object[] tmpKeys = this.keys;
    long[] tmpValues = this.values;
    int[] tmpNext = this.next;
    
    int capacity = this.keys.length * 2 + 1;
    
    Object[] keys = new Object[capacity];
    long[] values = new long[capacity];
    int[] next = new int[capacity];
    for (int i = 0; i < next.length; i++) {
      next[i] = -1;
    }
    this.keys = keys;
    this.values = values;
    this.next = next;
    for (int i = 0; i < tmpNext.length; i++) {
      if ((tmpNext[i] >= 0) && (tmpNext[i] < tmpNext.length)) {
        _put(tmpKeys[i], tmpValues[i]);
      }
    }
    limit = ((int)(capacity * loadFactor));
  }
  
  public int size()
  {
    return count;
  }
  
  private int find(Object key)
  {
    return find(key, (key.hashCode() & 0x7FFFFFFF) % keys.length);
  }
  
  private int find(Object key, int pos)
  {
    int i = 0;
    while (next[pos] >= 0)
    {
      if ((key.equals(keys[pos])) && 
        (next[pos] < next.length)) {
        return pos;
      }
      if ((pos = next[pos]) >= next.length) {
        pos -= next.length;
      }
      i++;
      if (i > next.length) {
        return -1;
      }
    }
    return -1;
  }
  
  private boolean _put(Object key, long value)
  {
    int pos = (key.hashCode() & 0x7FFFFFFF) % keys.length;
    int index = find(key, pos);
    if (index != -1)
    {
      values[index] = value;
      return false;
    }
    while ((next[pos] >= 0) && (next[pos] < next.length)) {
      pos = next[pos];
    }
    keys[pos] = key;
    values[pos] = value;
    if (next[pos] < 0) {
      next[pos] = ((pos + step) % next.length);
    } else {
      next[pos] -= next.length;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashObjLongNS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.hash;

public final class HashObjLongS
  extends HashObjLongNS
{
  public HashObjLongS()
  {
    super(101, 0.75D);
  }
  
  public HashObjLongS(int capacity)
  {
    super(capacity, 0.75D);
  }
  
  public HashObjLongS(int capacity, double lf)
  {
    super(capacity, lf);
  }
  
  public synchronized void put(Object key, long value)
  {
    super.put(key, value);
  }
  
  public synchronized long get(Object key)
  {
    return super.get(key);
  }
  
  public synchronized long remove(Object key)
  {
    return super.remove(key);
  }
  
  public synchronized int size()
  {
    return super.size();
  }
  
  public synchronized void removeAll()
  {
    super.removeAll();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.hash.HashObjLongS
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.impl.tpt;

import org.eclipse.equinox.internal.util.UtilActivator;
import org.eclipse.equinox.internal.util.ref.Log;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;

public abstract class ServiceFactoryImpl
  implements ServiceFactory
{
  public String bundleName;
  public static Log log;
  private static Bundle systemBundle = null;
  static boolean emptyStorage;
  
  static
  {
    try
    {
      systemBundle = UtilActivator.bc.getBundle(0L);
    }
    catch (Exception localException) {}
  }
  
  private static boolean security = Log.security();
  
  public static boolean privileged()
  {
    emptyStorage = UtilActivator.bc.getProperty("equinox.storage.empty") != null;
    return ((systemBundle.getState() != 8) || (emptyStorage)) && (security);
  }
  
  public static boolean useNames = true;
  static String suseNames;
  
  public ServiceFactoryImpl(String bundleName, Log log)
  {
    this.bundleName = bundleName;
    log = log;
    
    String tmp = UtilActivator.bc.getProperty("equinox.util.threadpool.useNames");
    if (suseNames != tmp) {
      useNames = (tmp == null) || (!tmp.equals("false"));
    }
  }
  
  public ServiceFactoryImpl(String bundleName)
  {
    this.bundleName = bundleName;
  }
  
  public Object getService(Bundle caller, ServiceRegistration sReg)
  {
    return getInstance(useNames ? getName(caller) : null);
  }
  
  public static String getName(Bundle caller)
  {
    StringBuffer bf = new StringBuffer(13);
    bf.append(" (Bundle ");
    bf.append(caller.getBundleId());
    bf.append(')');
    return bf.toString();
  }
  
  public void ungetService(Bundle caller, ServiceRegistration sReg, Object service) {}
  
  public abstract Object getInstance(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.util.impl.tpt.ServiceFactoryImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.util.impl.tpt.threadpool;

import java.security.AccessControlContext;
import org.eclipse.equinox.internal.util.impl.tpt.ServiceFactoryImpl;
import org.eclipse.equinox.internal.util.threadpool.ThreadContext;

public class Executor
  extends Thread
  implements ThreadContext
{
  public static final String iname = "[ThreadPool Manager] - Idle Thread";
  public static final String nullname = "[ThreadPool Manager] - Occupied Thread ";
  public static final String xname = "ThreadPool Manager Thread";
  ThreadPoolFactoryImpl factory;
  boolean accessed = false;
  private Runnable job = null;
  private boolean terminated = false;
  AccessControlContext acc;
  PEA pea;
  static ClassLoader defaultTCCL = Thread.currentThread().getContextClassLoader();
  
  public synchronized void setRunnable(Runnable job, String name, ThreadPoolFactoryImpl factory, AccessControlContext acc)
  {
    this.job = job;
    this.factory = factory;
    if (ServiceFactoryImpl.useNames) {
      setName(name == null ? "[ThreadPool Manager] - Occupied Thread " : name);
    }
    this.acc = acc;
    
    notify();
  }
  
  /* Error */
  public void run()
  {
    // Byte code:
    //   0: goto +343 -> 343
    //   3: aload_0
    //   4: getfield 156	org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor:job	Ljava/lang/Runnable;
    //   7: ifnull +287 -> 294
    //   10: getstatic 148	org/eclipse/equinox/internal/util/UtilActivator:debugLevel	I
    //   13: iconst_2
    //   14: if_icmpne +27 -> 41
    //   17: getstatic 149	org/eclipse/equinox/internal/util/UtilActivator:LOG_DEBUG	Z
    //   20: ifeq +21 -> 41
    //   23: getstatic 150	org/eclipse/equinox/internal/util/UtilActivator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   26: sipush 256
    //   29: sipush 10003
    //   32: aload_0
    //   33: invokevirtual 179	org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor:getName	()Ljava/lang/String;
    //   36: aconst_null
    //   37: iconst_0
    //   38: invokevirtual 183	org/eclipse/equinox/internal/util/ref/Log:debug	(IILjava/lang/String;Ljava/lang/Throwable;Z)V
    //   41: aload_0
    //   42: iconst_1
    //   43: putfield 153	org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor:accessed	Z
    //   46: aload_0
    //   47: getfield 157	org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor:acc	Ljava/security/AccessControlContext;
    //   50: ifnull +47 -> 97
    //   53: aload_0
    //   54: getfield 158	org/eclipse/equinox/internal/util/impl/tpt/threadpool/Executor:pea	Lorg/eclipse/equinox/internal/util/impl/tpt/threadpool/PEA;
    //   57: ifnonn
1 2 3 4

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