Skip to content

Commit

Permalink
Work In Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
gregw committed Aug 27, 2021
1 parent 7b78b90 commit c3a19a6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions jetty-util/src/main/java/org/eclipse/jetty/util/Pool.java
Expand Up @@ -68,7 +68,10 @@ public class Pool<T> implements AutoCloseable, Dumpable
private final ThreadLocal<Entry> cache;
private final AtomicInteger nextIndex;
private volatile boolean closed;

@Deprecated
private volatile int maxUsage = -1;
@Deprecated
private volatile int maxMultiplex = -1;

/**
Expand Down Expand Up @@ -175,6 +178,7 @@ public int getClosedCount()
* @return the maximum number of entries
*/
@ManagedAttribute("The maximum number of entries")
@Deprecated
public int getMaxEntries()
{
return maxEntries;
Expand All @@ -184,11 +188,13 @@ public int getMaxEntries()
* @return the default maximum in-use count of entries
*/
@ManagedAttribute("The default maximum multiplex count of entries")
@Deprecated
public int getMaxMultiplex()
{
return maxMultiplex == -1 ? 1 : maxMultiplex;
}

@Deprecated
protected int getMaxMultiplex(T item)
{
return getMaxMultiplex();
Expand All @@ -199,6 +205,7 @@ protected int getMaxMultiplex(T item)
*
* @param maxMultiplex the default maximum multiplex count of entries
*/
@Deprecated
public final void setMaxMultiplex(int maxMultiplex)
{
if (maxMultiplex < 1)
Expand All @@ -222,11 +229,13 @@ public final void setMaxMultiplex(int maxMultiplex)
* @return the default maximum usage count of entries
*/
@ManagedAttribute("The default maximum usage count of entries")
@Deprecated
public int getMaxUsageCount()
{
return maxUsage;
}

@Deprecated
protected int getMaxUsageCount(T item)
{
return getMaxUsageCount();
Expand All @@ -239,6 +248,7 @@ protected int getMaxUsageCount(T item)
*
* @param maxUsageCount the default maximum usage count of entries
*/
@Deprecated
public final void setMaxUsageCount(int maxUsageCount)
{
if (maxUsageCount == 0)
Expand Down Expand Up @@ -648,16 +658,17 @@ boolean isIdleAndOverUsed()
return false;
}

@Deprecated
public int getUsageCount()
{
return isIdle() ? 0 : 1;
}
}

/**
* <p>A Pool entry that holds metadata and a pooled object.</p>
* <p>A Pool entry that holds metadata and a pooled object, that can only be used one at a time</p>
*/
public class SingleUseEntry extends Entry
private class SingleUseEntry extends Entry
{
// MIN_VALUE == pending; -1 == closed; 0 == idle; 1 == inuse ;
private final AtomicInteger state;
Expand Down Expand Up @@ -778,6 +789,7 @@ public String toString()
}
}

@Deprecated
class MultiUseEntry extends Entry
{

Expand Down Expand Up @@ -934,7 +946,9 @@ public String toString()
int usageCount = AtomicBiInteger.getHi(encoded);
int inUseCount = AtomicBiInteger.getLo(encoded);

String state = usageCount < 0 ? "CLOSED" : inUseCount == 0 ? "IDLE" : "INUSE";
String state = usageCount < 0
? (usageCount == Integer.MIN_VALUE ? "PENDING" : "CLOSED")
: (inUseCount == 0 ? "IDLE" : "INUSE");

return String.format("%s@%x{%s, used=%d, inUse=%d, pooled=%s}",
getClass().getSimpleName(),
Expand Down

0 comments on commit c3a19a6

Please sign in to comment.