Changeset 11e00ba


Ignore:
Timestamp:
Jul 4, 2018 4:09:11 PM (2 years ago)
Author:
zab2 <zab2@…>
Branches:
master
Children:
40b3097
Parents:
d42a467
Message:

move TryCache? to core

Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/TryCache.java

    rd42a467 r11e00ba  
    1 package net.i2p.router.util;
     1package net.i2p.util;
    22
    33import java.util.ArrayList;
     
    4242     * @return a cached or newly created item from this cache
    4343     */
    44     public T tryAcquire() {
     44    public T acquire() {
    4545        T rv = null;
    4646        if (lock.tryLock()) {
     
    6565     * another thread.
    6666     */
    67     public void tryRelease(T item) {
     67    public void release(T item) {
    6868        if (lock.tryLock()) {
    6969            try {
  • router/java/src/net/i2p/router/transport/ntcp/EventPumper.java

    rd42a467 r11e00ba  
    2929import net.i2p.router.RouterContext;
    3030import net.i2p.router.transport.FIFOBandwidthLimiter;
    31 import net.i2p.router.util.TryCache;
     31import net.i2p.util.TryCache;
    3232import net.i2p.util.Addresses;
    3333import net.i2p.util.ConcurrentHashSet;
     
    463463     */
    464464    private ByteBuffer acquireBuf() {
    465         return _bufferCache.tryAcquire();
     465        return _bufferCache.acquire();
    466466    }
    467467   
     
    472472     */
    473473    public static void releaseBuf(ByteBuffer buf) {
    474         _bufferCache.tryRelease(buf);
     474        _bufferCache.release(buf);
    475475    }
    476476   
  • router/java/src/net/i2p/router/transport/udp/UDPPacket.java

    rd42a467 r11e00ba  
    1313import net.i2p.router.transport.FIFOBandwidthLimiter;
    1414import net.i2p.router.util.CDQEntry;
    15 import net.i2p.router.util.TryCache;
     15import net.i2p.util.TryCache;
    1616import net.i2p.util.Addresses;
    1717import net.i2p.util.Log;
     
    408408        if (CACHE) {
    409409            PacketFactory.context = ctx;
    410             rv = _packetCache.tryAcquire();
     410            rv = _packetCache.acquire();
    411411            rv.init(ctx);
    412412        }
     
    440440        if (!CACHE)
    441441            return;
    442         _packetCache.tryRelease(this);
     442        _packetCache.release(this);
    443443    }
    444444   
Note: See TracChangeset for help on using the changeset viewer.