public synchronized boolean containsKey(long key) { LongKeyEntry tab[] = table; int index = hash(key) % tab.length; for (LongKeyEntry e = tab[index]; e != null; e = e.next) { if (e.key == key) { return true; } } return false; }
public synchronized V put(long key, V value) { LongKeyEntry<V> tab[] = table; int index = hash(key) % tab.length; for (LongKeyEntry<V> e = tab[index]; e != null; e = e.next) { if (e.key == key) { V old = e.value; e.value = value; return old; } } if (count >= threshold) { rehash(); tab = table; index = hash(key) % tab.length; } LongKeyEntry e = new LongKeyEntry(key, value, tab[index]); tab[index] = e; count++; return null; }
public String toFormatString() { StringBuffer buf = new StringBuffer(); Enumeration it = entries(); buf.append("{\n"); while (it.hasMoreElements()) { LongKeyEntry e = (LongKeyEntry) it.nextElement(); buf.append("\t").append(e.getKey() + "=" + e.getValue()).append("\n"); } buf.append("}"); return buf.toString(); }
protected void add(SocketStep m) { if (sockets == null) sockets = new LongKeyMap<Step>(); long skid = m.getSocketId(); SocketSum sksum = (SocketSum) sockets.get(skid); if (sksum != null) { sksum.add(m.elapsed, sksum.error != 0); return; } if (totalCount >= BUFFER_SIZE) { process(); } sksum = new SocketSum(); sksum.ipaddr = m.ipaddr; sksum.port = m.port; sksum.add(m.elapsed, sksum.error != 0); sockets.put(skid, sksum); totalCount++; }
public static int size() { return entry.size(); }
public static void toDeferred(TraceContext o) { deferredEntry.put(o.txid, o); }
public static void completeDeferred(TraceContext o) { deferredEntry.remove(o.txid); } }
public static TraceContext getContext(long key) { return entry.get(key); }
public String toFormatString() { StringBuffer buf = new StringBuffer(); Enumeration it = entries(); buf.append("{\n"); while (it.hasMoreElements()) { LongKeyEntry e = (LongKeyEntry) it.nextElement(); buf.append("\t").append(e.getKey() + "=" + e.getValue()).append("\n"); } buf.append("}"); return buf.toString(); }
protected void add(SocketStep m) { if (sockets == null) sockets = new LongKeyMap<Step>(); long skid = m.getSocketId(); SocketSum sksum = (SocketSum) sockets.get(skid); if (sksum != null) { sksum.add(m.elapsed, sksum.error != 0); return; } if (totalCount >= BUFFER_SIZE) { process(); } sksum = new SocketSum(); sksum.ipaddr = m.ipaddr; sksum.port = m.port; sksum.add(m.elapsed, sksum.error != 0); sockets.put(skid, sksum); totalCount++; }
public static int size() { return entry.size(); }
public static void toDeferred(TraceContext o) { deferredEntry.put(o.txid, o); }
public static void completeDeferred(TraceContext o) { deferredEntry.remove(o.txid); } }
public static TraceContext getContext(long key) { return entry.get(key); }
public synchronized boolean containsKey(long key) { LongKeyEntry tab[] = table; int index = hash(key) % tab.length; for (LongKeyEntry e = tab[index]; e != null; e = e.next) { if (e.key == key) { return true; } } return false; }
public synchronized V put(long key, V value) { LongKeyEntry<V> tab[] = table; int index = hash(key) % tab.length; for (LongKeyEntry<V> e = tab[index]; e != null; e = e.next) { if (e.key == key) { V old = e.value; e.value = value; return old; } } if (count >= threshold) { rehash(); tab = table; index = hash(key) % tab.length; } LongKeyEntry e = new LongKeyEntry(key, value, tab[index]); tab[index] = e; count++; return null; }