Skip to content

Commit

Permalink
Issue #1893 - Jetty HttpClient Connection TTL.
Browse files Browse the repository at this point in the history
Removed the functionality, not needed anymore.
  • Loading branch information
sbordet committed Oct 25, 2017
1 parent ce39d50 commit 6e8242d
Showing 1 changed file with 0 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.eclipse.jetty.client.api.Connection;
import org.eclipse.jetty.client.api.Destination;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.ContainerLifeCycle;

Expand All @@ -35,7 +33,6 @@ public class RoundRobinConnectionPool extends AbstractConnectionPool
{
private final List<Entry> entries;
private int index;
private long liveTimeout;

public RoundRobinConnectionPool(Destination destination, int maxConnections, Callback requester)
{
Expand All @@ -45,17 +42,6 @@ public RoundRobinConnectionPool(Destination destination, int maxConnections, Cal
entries.add(new Entry());
}

@ManagedAttribute("The timeout, in milliseconds, after which a live connection may be closed")
public long getLiveTimeout()
{
return liveTimeout;
}

public void setLiveTimeout(long liveTimeout)
{
this.liveTimeout = liveTimeout;
}

@Override
protected void onCreated(Connection connection)
{
Expand All @@ -66,7 +52,6 @@ protected void onCreated(Connection connection)
if (entry.connection == null)
{
entry.connection = connection;
entry.createdTime = System.nanoTime();
break;
}
}
Expand Down Expand Up @@ -128,7 +113,6 @@ public boolean isActive(Connection connection)
public boolean release(Connection connection)
{
boolean active = false;
boolean removed = false;
synchronized (this)
{
for (Entry entry : entries)
Expand All @@ -137,29 +121,12 @@ public boolean release(Connection connection)
{
entry.active = false;
active = true;
long timeout = getLiveTimeout();
if (timeout > 0)
{
long live = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - entry.createdTime);
if (live >= timeout)
{
entry.reset();
removed = true;
}
}
break;
}
}
}
if (active)
{
released(connection);
if (removed)
{
removed(connection);
return false;
}
}
return idle(connection, isClosed());
}

Expand Down Expand Up @@ -231,14 +198,12 @@ private static class Entry
private Connection connection;
private boolean active;
private long used;
private long createdTime;

private void reset()
{
connection = null;
active = false;
used = 0;
createdTime = 0;
}

@Override
Expand Down

0 comments on commit 6e8242d

Please sign in to comment.