Merge branch 'jetty-9.3.x' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project into jetty-9.3.x
This commit is contained in:
commit
8eda037de0
|
@ -738,7 +738,7 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
|||
|
||||
loadingJarName = loadingJarName.substring(0,i+4);
|
||||
loadingJarName = (loadingJarName.startsWith("jar:")?loadingJarName.substring(4):loadingJarName);
|
||||
return Resource.newResource(loadingJarName, false);
|
||||
return Resource.newResource(loadingJarName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -977,7 +977,7 @@ public class AnnotationParser
|
|||
||
|
||||
(!resolver.isExcluded(shortName) && (!isParsed(shortName) || resolver.shouldOverride(shortName))))
|
||||
{
|
||||
Resource clazz = Resource.newResource("jar:"+jar.getURI()+"!/"+name,false);
|
||||
Resource clazz = Resource.newResource("jar:"+jar.getURI()+"!/"+name);
|
||||
if (LOG.isDebugEnabled()) {LOG.debug("Scanning class from jar {}", clazz);};
|
||||
try (InputStream is = clazz.getInputStream())
|
||||
{
|
||||
|
|
|
@ -18,425 +18,17 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.eclipse.jetty.client.api.Connection;
|
||||
import org.eclipse.jetty.client.api.Destination;
|
||||
import org.eclipse.jetty.util.BlockingArrayQueue;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Sweeper;
|
||||
|
||||
@ManagedObject("The connection pool")
|
||||
public class ConnectionPool implements Closeable, Dumpable, Sweeper.Sweepable
|
||||
/**
|
||||
* @deprecated use {@link DuplexConnectionPool} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class ConnectionPool extends DuplexConnectionPool
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(ConnectionPool.class);
|
||||
|
||||
private final AtomicInteger connectionCount = new AtomicInteger();
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final Destination destination;
|
||||
private final int maxConnections;
|
||||
private final Callback requester;
|
||||
private final Deque<Connection> idleConnections;
|
||||
private final Queue<Connection> activeConnections;
|
||||
|
||||
public ConnectionPool(Destination destination, int maxConnections, Callback requester)
|
||||
{
|
||||
this.destination = destination;
|
||||
this.maxConnections = maxConnections;
|
||||
this.requester = requester;
|
||||
this.idleConnections = new LinkedBlockingDeque<>(maxConnections);
|
||||
this.activeConnections = new BlockingArrayQueue<>(maxConnections);
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of connections", readonly = true)
|
||||
public int getConnectionCount()
|
||||
{
|
||||
return connectionCount.get();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of idle connections", readonly = true)
|
||||
public int getIdleConnectionCount()
|
||||
{
|
||||
return idleConnections.size();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of active connections", readonly = true)
|
||||
public int getActiveConnectionCount()
|
||||
{
|
||||
return activeConnections.size();
|
||||
}
|
||||
|
||||
public Queue<Connection> getIdleConnections()
|
||||
{
|
||||
return idleConnections;
|
||||
}
|
||||
|
||||
public Queue<Connection> getActiveConnections()
|
||||
{
|
||||
return activeConnections;
|
||||
}
|
||||
|
||||
public Connection acquire()
|
||||
{
|
||||
Connection connection = activateIdle();
|
||||
if (connection == null)
|
||||
connection = tryCreate();
|
||||
return connection;
|
||||
}
|
||||
|
||||
private Connection tryCreate()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
int current = getConnectionCount();
|
||||
final int next = current + 1;
|
||||
|
||||
if (next > maxConnections)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Max connections {}/{} reached", current, maxConnections);
|
||||
// Try again the idle connections
|
||||
return activateIdle();
|
||||
}
|
||||
|
||||
if (connectionCount.compareAndSet(current, next))
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection {}/{} creation", next, maxConnections);
|
||||
|
||||
destination.newConnection(new Promise<Connection>()
|
||||
{
|
||||
@Override
|
||||
public void succeeded(Connection connection)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection {}/{} creation succeeded {}", next, maxConnections, connection);
|
||||
|
||||
idleCreated(connection);
|
||||
|
||||
proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection " + next + "/" + maxConnections + " creation failed", x);
|
||||
|
||||
connectionCount.decrementAndGet();
|
||||
|
||||
requester.failed(x);
|
||||
}
|
||||
});
|
||||
|
||||
// Try again the idle connections
|
||||
return activateIdle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void proceed()
|
||||
{
|
||||
requester.succeeded();
|
||||
}
|
||||
|
||||
protected void idleCreated(Connection connection)
|
||||
{
|
||||
boolean idle;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
// Use "cold" new connections as last.
|
||||
idle = idleConnections.offerLast(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
idle(connection, idle);
|
||||
}
|
||||
|
||||
private Connection activateIdle()
|
||||
{
|
||||
boolean acquired;
|
||||
Connection connection;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
connection = idleConnections.pollFirst();
|
||||
if (connection == null)
|
||||
return null;
|
||||
acquired = activeConnections.offer(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
if (acquired)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection active {}", connection);
|
||||
acquired(connection);
|
||||
return connection;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection active overflow {}", connection);
|
||||
connection.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void acquired(Connection connection)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean release(Connection connection)
|
||||
{
|
||||
boolean idle;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
if (!activeConnections.remove(connection))
|
||||
return false;
|
||||
// Make sure we use "hot" connections first.
|
||||
idle = offerIdle(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
released(connection);
|
||||
return idle(connection, idle);
|
||||
}
|
||||
|
||||
protected boolean offerIdle(Connection connection)
|
||||
{
|
||||
return idleConnections.offerFirst(connection);
|
||||
}
|
||||
|
||||
protected boolean idle(Connection connection, boolean idle)
|
||||
{
|
||||
if (idle)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection idle {}", connection);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection idle overflow {}", connection);
|
||||
connection.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void released(Connection connection)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean remove(Connection connection)
|
||||
{
|
||||
return remove(connection, false);
|
||||
}
|
||||
|
||||
protected boolean remove(Connection connection, boolean force)
|
||||
{
|
||||
boolean activeRemoved;
|
||||
boolean idleRemoved;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
activeRemoved = activeConnections.remove(connection);
|
||||
idleRemoved = idleConnections.remove(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
if (activeRemoved)
|
||||
released(connection);
|
||||
boolean removed = activeRemoved || idleRemoved || force;
|
||||
if (removed)
|
||||
{
|
||||
int pooled = connectionCount.decrementAndGet();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection removed {} - pooled: {}", connection, pooled);
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
public boolean isActive(Connection connection)
|
||||
{
|
||||
lock();
|
||||
try
|
||||
{
|
||||
return activeConnections.contains(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isIdle(Connection connection)
|
||||
{
|
||||
lock();
|
||||
try
|
||||
{
|
||||
return idleConnections.contains(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return connectionCount.get() == 0;
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
List<Connection> idles = new ArrayList<>();
|
||||
List<Connection> actives = new ArrayList<>();
|
||||
lock();
|
||||
try
|
||||
{
|
||||
idles.addAll(idleConnections);
|
||||
idleConnections.clear();
|
||||
actives.addAll(activeConnections);
|
||||
activeConnections.clear();
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
connectionCount.set(0);
|
||||
|
||||
for (Connection connection : idles)
|
||||
connection.close();
|
||||
|
||||
// A bit drastic, but we cannot wait for all requests to complete
|
||||
for (Connection connection : actives)
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
List<Connection> actives = new ArrayList<>();
|
||||
List<Connection> idles = new ArrayList<>();
|
||||
lock();
|
||||
try
|
||||
{
|
||||
actives.addAll(activeConnections);
|
||||
idles.addAll(idleConnections);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, actives, idles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sweep()
|
||||
{
|
||||
List<Sweeper.Sweepable> toSweep = new ArrayList<>();
|
||||
lock();
|
||||
try
|
||||
{
|
||||
for (Connection connection : getActiveConnections())
|
||||
{
|
||||
if (connection instanceof Sweeper.Sweepable)
|
||||
toSweep.add(((Sweeper.Sweepable)connection));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
for (Sweeper.Sweepable candidate : toSweep)
|
||||
{
|
||||
if (candidate.sweep())
|
||||
{
|
||||
boolean removed = getActiveConnections().remove(candidate);
|
||||
LOG.warn("Connection swept: {}{}{} from active connections{}{}",
|
||||
candidate,
|
||||
System.lineSeparator(),
|
||||
removed ? "Removed" : "Not removed",
|
||||
System.lineSeparator(),
|
||||
dump());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void lock()
|
||||
{
|
||||
lock.lock();
|
||||
}
|
||||
|
||||
protected void unlock()
|
||||
{
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
int activeSize;
|
||||
int idleSize;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
activeSize = activeConnections.size();
|
||||
idleSize = idleConnections.size();
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
return String.format("%s[c=%d/%d,a=%d,i=%d]",
|
||||
getClass().getSimpleName(),
|
||||
connectionCount.get(),
|
||||
maxConnections,
|
||||
activeSize,
|
||||
idleSize);
|
||||
super(destination, maxConnections, requester);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,442 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.eclipse.jetty.client.api.Connection;
|
||||
import org.eclipse.jetty.client.api.Destination;
|
||||
import org.eclipse.jetty.util.BlockingArrayQueue;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Sweeper;
|
||||
|
||||
@ManagedObject("The connection pool")
|
||||
public class DuplexConnectionPool implements Closeable, Dumpable, Sweeper.Sweepable
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(DuplexConnectionPool.class);
|
||||
|
||||
private final AtomicInteger connectionCount = new AtomicInteger();
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
private final Destination destination;
|
||||
private final int maxConnections;
|
||||
private final Callback requester;
|
||||
private final Deque<Connection> idleConnections;
|
||||
private final Queue<Connection> activeConnections;
|
||||
|
||||
public DuplexConnectionPool(Destination destination, int maxConnections, Callback requester)
|
||||
{
|
||||
this.destination = destination;
|
||||
this.maxConnections = maxConnections;
|
||||
this.requester = requester;
|
||||
this.idleConnections = new LinkedBlockingDeque<>(maxConnections);
|
||||
this.activeConnections = new BlockingArrayQueue<>(maxConnections);
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of connections", readonly = true)
|
||||
public int getConnectionCount()
|
||||
{
|
||||
return connectionCount.get();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of idle connections", readonly = true)
|
||||
public int getIdleConnectionCount()
|
||||
{
|
||||
return idleConnections.size();
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of active connections", readonly = true)
|
||||
public int getActiveConnectionCount()
|
||||
{
|
||||
return activeConnections.size();
|
||||
}
|
||||
|
||||
public Queue<Connection> getIdleConnections()
|
||||
{
|
||||
return idleConnections;
|
||||
}
|
||||
|
||||
public Queue<Connection> getActiveConnections()
|
||||
{
|
||||
return activeConnections;
|
||||
}
|
||||
|
||||
public Connection acquire()
|
||||
{
|
||||
Connection connection = activateIdle();
|
||||
if (connection == null)
|
||||
connection = tryCreate();
|
||||
return connection;
|
||||
}
|
||||
|
||||
private Connection tryCreate()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
int current = getConnectionCount();
|
||||
final int next = current + 1;
|
||||
|
||||
if (next > maxConnections)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Max connections {}/{} reached", current, maxConnections);
|
||||
// Try again the idle connections
|
||||
return activateIdle();
|
||||
}
|
||||
|
||||
if (connectionCount.compareAndSet(current, next))
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection {}/{} creation", next, maxConnections);
|
||||
|
||||
destination.newConnection(new Promise<Connection>()
|
||||
{
|
||||
@Override
|
||||
public void succeeded(Connection connection)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection {}/{} creation succeeded {}", next, maxConnections, connection);
|
||||
|
||||
idleCreated(connection);
|
||||
|
||||
proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection " + next + "/" + maxConnections + " creation failed", x);
|
||||
|
||||
connectionCount.decrementAndGet();
|
||||
|
||||
requester.failed(x);
|
||||
}
|
||||
});
|
||||
|
||||
// Try again the idle connections
|
||||
return activateIdle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void proceed()
|
||||
{
|
||||
requester.succeeded();
|
||||
}
|
||||
|
||||
protected void idleCreated(Connection connection)
|
||||
{
|
||||
boolean idle;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
// Use "cold" new connections as last.
|
||||
idle = idleConnections.offerLast(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
idle(connection, idle);
|
||||
}
|
||||
|
||||
private Connection activateIdle()
|
||||
{
|
||||
boolean acquired;
|
||||
Connection connection;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
connection = idleConnections.pollFirst();
|
||||
if (connection == null)
|
||||
return null;
|
||||
acquired = activeConnections.offer(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
if (acquired)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection active {}", connection);
|
||||
acquired(connection);
|
||||
return connection;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection active overflow {}", connection);
|
||||
connection.close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void acquired(Connection connection)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean release(Connection connection)
|
||||
{
|
||||
boolean idle;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
if (!activeConnections.remove(connection))
|
||||
return false;
|
||||
// Make sure we use "hot" connections first.
|
||||
idle = offerIdle(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
released(connection);
|
||||
return idle(connection, idle);
|
||||
}
|
||||
|
||||
protected boolean offerIdle(Connection connection)
|
||||
{
|
||||
return idleConnections.offerFirst(connection);
|
||||
}
|
||||
|
||||
protected boolean idle(Connection connection, boolean idle)
|
||||
{
|
||||
if (idle)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection idle {}", connection);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection idle overflow {}", connection);
|
||||
connection.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void released(Connection connection)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean remove(Connection connection)
|
||||
{
|
||||
return remove(connection, false);
|
||||
}
|
||||
|
||||
protected boolean remove(Connection connection, boolean force)
|
||||
{
|
||||
boolean activeRemoved;
|
||||
boolean idleRemoved;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
activeRemoved = activeConnections.remove(connection);
|
||||
idleRemoved = idleConnections.remove(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
if (activeRemoved)
|
||||
released(connection);
|
||||
boolean removed = activeRemoved || idleRemoved || force;
|
||||
if (removed)
|
||||
{
|
||||
int pooled = connectionCount.decrementAndGet();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Connection removed {} - pooled: {}", connection, pooled);
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
public boolean isActive(Connection connection)
|
||||
{
|
||||
lock();
|
||||
try
|
||||
{
|
||||
return activeConnections.contains(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isIdle(Connection connection)
|
||||
{
|
||||
lock();
|
||||
try
|
||||
{
|
||||
return idleConnections.contains(connection);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return connectionCount.get() == 0;
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
List<Connection> idles = new ArrayList<>();
|
||||
List<Connection> actives = new ArrayList<>();
|
||||
lock();
|
||||
try
|
||||
{
|
||||
idles.addAll(idleConnections);
|
||||
idleConnections.clear();
|
||||
actives.addAll(activeConnections);
|
||||
activeConnections.clear();
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
connectionCount.set(0);
|
||||
|
||||
for (Connection connection : idles)
|
||||
connection.close();
|
||||
|
||||
// A bit drastic, but we cannot wait for all requests to complete
|
||||
for (Connection connection : actives)
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dump()
|
||||
{
|
||||
return ContainerLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
List<Connection> actives = new ArrayList<>();
|
||||
List<Connection> idles = new ArrayList<>();
|
||||
lock();
|
||||
try
|
||||
{
|
||||
actives.addAll(activeConnections);
|
||||
idles.addAll(idleConnections);
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
ContainerLifeCycle.dumpObject(out, this);
|
||||
ContainerLifeCycle.dump(out, indent, actives, idles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sweep()
|
||||
{
|
||||
List<Sweeper.Sweepable> toSweep = new ArrayList<>();
|
||||
lock();
|
||||
try
|
||||
{
|
||||
for (Connection connection : getActiveConnections())
|
||||
{
|
||||
if (connection instanceof Sweeper.Sweepable)
|
||||
toSweep.add(((Sweeper.Sweepable)connection));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
for (Sweeper.Sweepable candidate : toSweep)
|
||||
{
|
||||
if (candidate.sweep())
|
||||
{
|
||||
boolean removed = getActiveConnections().remove(candidate);
|
||||
LOG.warn("Connection swept: {}{}{} from active connections{}{}",
|
||||
candidate,
|
||||
System.lineSeparator(),
|
||||
removed ? "Removed" : "Not removed",
|
||||
System.lineSeparator(),
|
||||
dump());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void lock()
|
||||
{
|
||||
lock.lock();
|
||||
}
|
||||
|
||||
protected void unlock()
|
||||
{
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
int activeSize;
|
||||
int idleSize;
|
||||
lock();
|
||||
try
|
||||
{
|
||||
activeSize = activeConnections.size();
|
||||
idleSize = idleConnections.size();
|
||||
}
|
||||
finally
|
||||
{
|
||||
unlock();
|
||||
}
|
||||
|
||||
return String.format("%s[c=%d/%d,a=%d,i=%d]",
|
||||
getClass().getSimpleName(),
|
||||
connectionCount.get(),
|
||||
maxConnections,
|
||||
activeSize,
|
||||
idleSize);
|
||||
}
|
||||
}
|
|
@ -994,7 +994,7 @@ public class HttpClient extends ContainerLifeCycle
|
|||
* anymore and leave space for new destinations.
|
||||
*
|
||||
* @param removeIdleDestinations whether destinations that have no connections should be removed
|
||||
* @see org.eclipse.jetty.client.ConnectionPool
|
||||
* @see org.eclipse.jetty.client.DuplexConnectionPool
|
||||
*/
|
||||
public void setRemoveIdleDestinations(boolean removeIdleDestinations)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.jetty.util.thread.Sweeper;
|
|||
@ManagedObject
|
||||
public abstract class PoolingHttpDestination<C extends Connection> extends HttpDestination implements Callback
|
||||
{
|
||||
private final ConnectionPool connectionPool;
|
||||
private final DuplexConnectionPool connectionPool;
|
||||
|
||||
public PoolingHttpDestination(HttpClient client, Origin origin)
|
||||
{
|
||||
|
@ -44,13 +44,13 @@ public abstract class PoolingHttpDestination<C extends Connection> extends HttpD
|
|||
sweeper.offer(connectionPool);
|
||||
}
|
||||
|
||||
protected ConnectionPool newConnectionPool(HttpClient client)
|
||||
protected DuplexConnectionPool newConnectionPool(HttpClient client)
|
||||
{
|
||||
return new ConnectionPool(this, client.getMaxConnectionsPerDestination(), this);
|
||||
return new DuplexConnectionPool(this, client.getMaxConnectionsPerDestination(), this);
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The connection pool", readonly = true)
|
||||
public ConnectionPool getConnectionPool()
|
||||
public DuplexConnectionPool getConnectionPool()
|
||||
{
|
||||
return connectionPool;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
|
||||
/**
|
||||
* <p>A {@link ConnectionPool} that validates connections before
|
||||
* <p>A connection pool that validates connections before
|
||||
* making them available for use.</p>
|
||||
* <p>Connections that have just been opened are not validated.
|
||||
* Connections that are {@link #release(Connection) released} will
|
||||
|
|
|
@ -59,7 +59,7 @@ public class HttpClientExplicitConnectionTest extends AbstractHttpClientServerTe
|
|||
Assert.assertEquals(200, response.getStatus());
|
||||
|
||||
HttpDestinationOverHTTP httpDestination = (HttpDestinationOverHTTP)destination;
|
||||
ConnectionPool connectionPool = httpDestination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = httpDestination.getConnectionPool();
|
||||
Assert.assertTrue(connectionPool.getActiveConnections().isEmpty());
|
||||
Assert.assertTrue(connectionPool.getIdleConnections().isEmpty());
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class HttpClientExplicitConnectionTest extends AbstractHttpClientServerTe
|
|||
Assert.assertFalse(httpConnection.getEndPoint().isOpen());
|
||||
|
||||
HttpDestinationOverHTTP httpDestination = (HttpDestinationOverHTTP)destination;
|
||||
ConnectionPool connectionPool = httpDestination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = httpDestination.getConnectionPool();
|
||||
Assert.assertTrue(connectionPool.getActiveConnections().isEmpty());
|
||||
Assert.assertTrue(connectionPool.getIdleConnections().isEmpty());
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class HttpClientFailureTest
|
|||
// Expected.
|
||||
}
|
||||
|
||||
ConnectionPool connectionPool = connectionRef.get().getHttpDestination().getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = connectionRef.get().getHttpDestination().getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -170,7 +170,7 @@ public class HttpClientFailureTest
|
|||
Assert.assertTrue(contentLatch.await(5, TimeUnit.SECONDS));
|
||||
Assert.assertTrue(completeLatch.await(5, TimeUnit.SECONDS));
|
||||
|
||||
ConnectionPool connectionPool = connectionRef.get().getHttpDestination().getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = connectionRef.get().getHttpDestination().getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.client;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
|
@ -61,9 +58,12 @@ import org.eclipse.jetty.util.log.Log;
|
|||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class HttpClientLoadTest extends AbstractHttpClientServerTest
|
||||
{
|
||||
private final Logger logger = Log.getLogger(HttpClientLoadTest.class);
|
||||
|
@ -100,7 +100,7 @@ public class HttpClientLoadTest extends AbstractHttpClientServerTest
|
|||
return new HttpDestinationOverHTTP(getHttpClient(), origin)
|
||||
{
|
||||
@Override
|
||||
protected ConnectionPool newConnectionPool(HttpClient client)
|
||||
protected DuplexConnectionPool newConnectionPool(HttpClient client)
|
||||
{
|
||||
return new LeakTrackingConnectionPool(this, client.getMaxConnectionsPerDestination(), this)
|
||||
{
|
||||
|
@ -143,15 +143,15 @@ public class HttpClientLoadTest extends AbstractHttpClientServerTest
|
|||
|
||||
System.gc();
|
||||
|
||||
assertThat("Server BufferPool - leaked acquires", serverBufferPool.getLeakedAcquires(), is(0L));
|
||||
assertThat("Server BufferPool - leaked releases", serverBufferPool.getLeakedReleases(), is(0L));
|
||||
assertThat("Server BufferPool - unreleased", serverBufferPool.getLeakedResources(), is(0L));
|
||||
assertThat("Server BufferPool - leaked acquires", serverBufferPool.getLeakedAcquires(), Matchers.is(0L));
|
||||
assertThat("Server BufferPool - leaked releases", serverBufferPool.getLeakedReleases(), Matchers.is(0L));
|
||||
assertThat("Server BufferPool - unreleased", serverBufferPool.getLeakedResources(), Matchers.is(0L));
|
||||
|
||||
assertThat("Client BufferPool - leaked acquires", clientBufferPool.getLeakedAcquires(), is(0L));
|
||||
assertThat("Client BufferPool - leaked releases", clientBufferPool.getLeakedReleases(), is(0L));
|
||||
assertThat("Client BufferPool - unreleased", clientBufferPool.getLeakedResources(), is(0L));
|
||||
assertThat("Client BufferPool - leaked acquires", clientBufferPool.getLeakedAcquires(), Matchers.is(0L));
|
||||
assertThat("Client BufferPool - leaked releases", clientBufferPool.getLeakedReleases(), Matchers.is(0L));
|
||||
assertThat("Client BufferPool - unreleased", clientBufferPool.getLeakedResources(), Matchers.is(0L));
|
||||
|
||||
assertThat("Connection Leaks", connectionLeaks.get(), is(0L));
|
||||
assertThat("Connection Leaks", connectionLeaks.get(), Matchers.is(0L));
|
||||
}
|
||||
|
||||
private void run(Random random, int iterations) throws InterruptedException
|
||||
|
@ -173,7 +173,7 @@ public class HttpClientLoadTest extends AbstractHttpClientServerTest
|
|||
for (String host : Arrays.asList("localhost", "127.0.0.1"))
|
||||
{
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
for (Connection connection : new ArrayList<>(connectionPool.getActiveConnections()))
|
||||
{
|
||||
HttpConnectionOverHTTP active = (HttpConnectionOverHTTP)connection;
|
||||
|
|
|
@ -111,7 +111,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
|||
Assert.assertEquals(200, response.getStatus());
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
long start = System.nanoTime();
|
||||
HttpConnectionOverHTTP connection = null;
|
||||
|
|
|
@ -272,7 +272,7 @@ public class HttpClientUploadDuringServerShutdown
|
|||
Assert.assertTrue(completeLatch.await(5, TimeUnit.SECONDS));
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination("http", "localhost", connector.getLocalPort());
|
||||
ConnectionPool pool = destination.getConnectionPool();
|
||||
DuplexConnectionPool pool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, pool.getConnectionCount());
|
||||
Assert.assertEquals(0, pool.getIdleConnections().size());
|
||||
Assert.assertEquals(0, pool.getActiveConnections().size());
|
||||
|
|
|
@ -69,7 +69,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -130,7 +130,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -181,7 +181,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -241,7 +241,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -314,7 +314,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -367,7 +367,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -417,7 +417,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -467,7 +467,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
@ -499,7 +499,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, host, port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
|
||||
final Queue<Connection> idleConnections = connectionPool.getIdleConnections();
|
||||
Assert.assertEquals(0, idleConnections.size());
|
||||
|
|
|
@ -88,7 +88,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -135,7 +135,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -182,7 +182,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -225,7 +225,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -289,7 +289,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -344,7 +344,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
@ -454,7 +454,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
|||
}
|
||||
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination(scheme, "localhost", connector.getLocalPort());
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnections().size());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnections().size());
|
||||
|
|
|
@ -151,7 +151,7 @@ public class ServerConnectionCloseTest
|
|||
|
||||
// Connection should have been removed from pool.
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination("http", "localhost", port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnectionCount());
|
||||
|
|
|
@ -183,7 +183,7 @@ public class TLSServerConnectionCloseTest
|
|||
|
||||
// Connection should have been removed from pool.
|
||||
HttpDestinationOverHTTP destination = (HttpDestinationOverHTTP)client.getDestination("http", "localhost", port);
|
||||
ConnectionPool connectionPool = destination.getConnectionPool();
|
||||
DuplexConnectionPool connectionPool = destination.getConnectionPool();
|
||||
Assert.assertEquals(0, connectionPool.getConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getIdleConnectionCount());
|
||||
Assert.assertEquals(0, connectionPool.getActiveConnectionCount());
|
||||
|
|
|
@ -194,7 +194,7 @@ public class ValidatingConnectionPoolTest extends AbstractHttpClientServerTest
|
|||
return new HttpDestinationOverHTTP(getHttpClient(), origin)
|
||||
{
|
||||
@Override
|
||||
protected ConnectionPool newConnectionPool(HttpClient client)
|
||||
protected DuplexConnectionPool newConnectionPool(HttpClient client)
|
||||
{
|
||||
return new ValidatingConnectionPool(this, client.getMaxConnectionsPerDestination(), this, client.getScheduler(), timeout);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.concurrent.RejectedExecutionException;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.client.AbstractHttpClientServerTest;
|
||||
import org.eclipse.jetty.client.ConnectionPool;
|
||||
import org.eclipse.jetty.client.DuplexConnectionPool;
|
||||
import org.eclipse.jetty.client.EmptyServerHandler;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.Origin;
|
||||
|
@ -97,9 +97,9 @@ public class HttpDestinationOverHTTPTest extends AbstractHttpClientServerTest
|
|||
HttpDestinationOverHTTP destination = new HttpDestinationOverHTTP(client, new Origin("http", "localhost", connector.getLocalPort()))
|
||||
{
|
||||
@Override
|
||||
protected ConnectionPool newConnectionPool(HttpClient client)
|
||||
protected DuplexConnectionPool newConnectionPool(HttpClient client)
|
||||
{
|
||||
return new ConnectionPool(this, client.getMaxConnectionsPerDestination(), this)
|
||||
return new DuplexConnectionPool(this, client.getMaxConnectionsPerDestination(), this)
|
||||
{
|
||||
@Override
|
||||
protected void idleCreated(Connection connection)
|
||||
|
|
|
@ -18,12 +18,9 @@
|
|||
|
||||
package org.eclipse.jetty.fcgi.server;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.eclipse.jetty.client.ConnectionPool;
|
||||
import org.eclipse.jetty.client.DuplexConnectionPool;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.HttpDestination;
|
||||
import org.eclipse.jetty.client.LeakTrackingConnectionPool;
|
||||
|
@ -40,9 +37,12 @@ import org.eclipse.jetty.server.ServerConnector;
|
|||
import org.eclipse.jetty.toolchain.test.TestTracker;
|
||||
import org.eclipse.jetty.util.LeakDetector;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public abstract class AbstractHttpClientServerTest
|
||||
{
|
||||
@Rule
|
||||
|
@ -71,7 +71,7 @@ public abstract class AbstractHttpClientServerTest
|
|||
|
||||
QueuedThreadPool executor = new QueuedThreadPool();
|
||||
executor.setName(executor.getName() + "-client");
|
||||
|
||||
|
||||
client = new HttpClient(new HttpClientTransportOverFCGI(1, false, "")
|
||||
{
|
||||
@Override
|
||||
|
@ -80,7 +80,7 @@ public abstract class AbstractHttpClientServerTest
|
|||
return new HttpDestinationOverFCGI(client, origin)
|
||||
{
|
||||
@Override
|
||||
protected ConnectionPool newConnectionPool(HttpClient client)
|
||||
protected DuplexConnectionPool newConnectionPool(HttpClient client)
|
||||
{
|
||||
return new LeakTrackingConnectionPool(this, client.getMaxConnectionsPerDestination(), this)
|
||||
{
|
||||
|
@ -105,15 +105,15 @@ public abstract class AbstractHttpClientServerTest
|
|||
{
|
||||
System.gc();
|
||||
|
||||
assertThat("Server BufferPool - leaked acquires", serverBufferPool.getLeakedAcquires(), is(0L));
|
||||
assertThat("Server BufferPool - leaked releases", serverBufferPool.getLeakedReleases(), is(0L));
|
||||
assertThat("Server BufferPool - unreleased", serverBufferPool.getLeakedResources(), is(0L));
|
||||
|
||||
assertThat("Client BufferPool - leaked acquires", clientBufferPool.getLeakedAcquires(), is(0L));
|
||||
assertThat("Client BufferPool - leaked releases", clientBufferPool.getLeakedReleases(), is(0L));
|
||||
assertThat("Client BufferPool - unreleased", clientBufferPool.getLeakedResources(), is(0L));
|
||||
|
||||
assertThat("Connection Leaks", connectionLeaks.get(), is(0L));
|
||||
assertThat("Server BufferPool - leaked acquires", serverBufferPool.getLeakedAcquires(), Matchers.is(0L));
|
||||
assertThat("Server BufferPool - leaked releases", serverBufferPool.getLeakedReleases(), Matchers.is(0L));
|
||||
assertThat("Server BufferPool - unreleased", serverBufferPool.getLeakedResources(), Matchers.is(0L));
|
||||
|
||||
assertThat("Client BufferPool - leaked acquires", clientBufferPool.getLeakedAcquires(), Matchers.is(0L));
|
||||
assertThat("Client BufferPool - leaked releases", clientBufferPool.getLeakedReleases(), Matchers.is(0L));
|
||||
assertThat("Client BufferPool - unreleased", clientBufferPool.getLeakedResources(), Matchers.is(0L));
|
||||
|
||||
assertThat("Connection Leaks", connectionLeaks.get(), Matchers.is(0L));
|
||||
|
||||
if (client != null)
|
||||
client.stop();
|
||||
|
|
|
@ -4,27 +4,18 @@
|
|||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<!-- ============================================================================================== -->
|
||||
<!-- GCloud configuration from property file -->
|
||||
<!-- Note: passwords stored in the property file can use jetty obfuscation (see -->
|
||||
<!-- GCloud configuration. -->
|
||||
<!-- Note: passwords can use jetty obfuscation. See -->
|
||||
<!-- https://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html -->
|
||||
<!-- ============================================================================================== -->
|
||||
<Call id="gconf" class="org.eclipse.jetty.gcloud.session.GCloudConfiguration" name="fromFile">
|
||||
<Arg><Property name="jetty.base" default="."/>/<Property name="jetty.gcloudSession.configFile" default="etc/gcloud.props"/></Arg>
|
||||
</Call>
|
||||
|
||||
<!-- ============================================================================================== -->
|
||||
<!-- Alternate GCloud configuration from properties -->
|
||||
<!-- Note: passwords can use jetty obfuscation (see -->
|
||||
<!-- https://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html -->
|
||||
<!-- ============================================================================================== -->
|
||||
<!--
|
||||
<New id="gconf" class="org.eclipse.jetty.gcloud.session.GCloudConfiguration">
|
||||
<!-- To contact remote gclouddatastore set the following properties in start.ini -->
|
||||
<!-- Either set jetty.gcloudSession.projectId or use system property/env var DATASTORE_DATASET-->
|
||||
<Set name="projectId"><Property name="jetty.gcloudSession.projectId"/></Set>
|
||||
<Set name="p12File"><Property name="jetty.gcloudSession.p12File"/></Set>
|
||||
<Set name="serviceAccount"><Property name="jetty.gcloudSession.serviceAccount"/></Set>
|
||||
<Set name="password"><Property name="jetty.gcloudSession.password"/></Set>
|
||||
</New>
|
||||
-->
|
||||
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
|
|
@ -53,23 +53,39 @@ https://github.com/GoogleCloudPlatform/gcloud-java
|
|||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
[ini-template]
|
||||
## GCloudDatastore Session config
|
||||
|
||||
## Unique identifier for this node in the cluster
|
||||
# jetty.gcloudSession.workerName=node1
|
||||
|
||||
## Name of properties files containing gcloud config
|
||||
#jetty.gcloudSession.configFilet=etc/gcloud.props
|
||||
|
||||
##Alternative to properties file, individual properties
|
||||
## the gcloud projectId
|
||||
## GCloudDatastore Session config
|
||||
## If running inside Google cloud all configuration is provided by
|
||||
## environment variables and you do not need to set anything in this file.
|
||||
##
|
||||
## If running externally to Google:
|
||||
## To contact the remote gcloud datastore:
|
||||
## 1. set the DATASTORE_DATASET System property/environment variable to the name of your project
|
||||
## or alternatively set the jetty.gcloudSession.projectId property below.
|
||||
## 2. set the jetty.gcloudSession.p12File, jetty.gcloudSession.serviceAccount and
|
||||
## jetty.gcloudSession.password (supports obfuscation) below.
|
||||
##
|
||||
## To contact a local dev gcloud datastore server:
|
||||
## 1. set the DATASTORE_DATASET System property/environment variable to the name of your project.
|
||||
## 2. set the DATASTORE_HOST System property/environment variable to the url of the dev server
|
||||
## as described at https://cloud.google.com/datastore/docs/tools/devserver#setting_environment_variables
|
||||
|
||||
## The gcloud projectId
|
||||
## Set this property to connect to remote gcloud datastore.
|
||||
## Or, set the DATASTORE_DATASET System property/env variable instead.
|
||||
#jetty.gcloudSession.projectId=
|
||||
|
||||
## the p12 file associated with the project
|
||||
## The p12 file associated with the project.
|
||||
## Set this property to connect to remote gcloud datastore
|
||||
#jetty.gcloudSession.p12File=
|
||||
|
||||
## the serviceAccount for the Datastore
|
||||
## The serviceAccount for the Datastore.
|
||||
## Set this property to connect to to remote gcloud datastore
|
||||
#jetty.gcloudSession.serviceAccount=
|
||||
|
||||
## the password (can be obfuscated)
|
||||
## The password (can be obfuscated).
|
||||
## Set this property to connect to remote gcloud datastore
|
||||
#jetty.gcloudSession.password=
|
||||
|
|
|
@ -46,8 +46,10 @@ public class GCloudConfiguration
|
|||
public static final String SERVICE_ACCOUNT = "serviceAccount";
|
||||
|
||||
private String _projectId;
|
||||
private String _p12Filename;
|
||||
private File _p12File;
|
||||
private String _serviceAccount;
|
||||
private String _passwordSet;
|
||||
private String _password;
|
||||
private AuthCredentials _authCredentials;
|
||||
private DatastoreOptions _options;
|
||||
|
@ -109,7 +111,8 @@ public class GCloudConfiguration
|
|||
public void setP12File (String file)
|
||||
{
|
||||
checkForModification();
|
||||
_p12File = new File(file);
|
||||
_p12Filename = file;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,12 +122,12 @@ public class GCloudConfiguration
|
|||
_serviceAccount = serviceAccount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setPassword (String pwd)
|
||||
{
|
||||
checkForModification();
|
||||
Password p = new Password(pwd);
|
||||
_password = p.toString();
|
||||
_passwordSet = pwd;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,10 +136,29 @@ public class GCloudConfiguration
|
|||
{
|
||||
if (_options == null)
|
||||
{
|
||||
_options = DatastoreOptions.builder()
|
||||
.projectId(_projectId)
|
||||
.authCredentials(getAuthCredentials())
|
||||
.build();
|
||||
if (_passwordSet == null && _p12Filename == null && _serviceAccount == null)
|
||||
{
|
||||
//When no values are explicitly presented for auth info, we are either running
|
||||
//1. inside GCE environment, in which case all auth info is derived from the environment
|
||||
//2. outside the GCE environment, but using a local gce dev server, in which case you
|
||||
// need to set the following 2 environment/system properties
|
||||
// DATASTORE_HOST: eg http://localhost:9999 - this is the host and port of a local development server
|
||||
// DATASTORE_DATASET: eg myProj - this is the name of your project
|
||||
_options = DatastoreOptions.defaultInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
//When running externally to GCE, you need to provide
|
||||
//explicit auth info. You can either set the projectId explicitly, or you can set the
|
||||
//DATASTORE_DATASET env/system property
|
||||
_p12File = new File(_p12Filename);
|
||||
Password p = new Password(_passwordSet);
|
||||
_password = p.toString();
|
||||
_options = DatastoreOptions.builder()
|
||||
.projectId(_projectId)
|
||||
.authCredentials(getAuthCredentials())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
return _options;
|
||||
}
|
||||
|
@ -152,11 +174,6 @@ public class GCloudConfiguration
|
|||
{
|
||||
if (_password == null)
|
||||
throw new IllegalStateException("No password");
|
||||
if (_projectId == null)
|
||||
throw new IllegalStateException("No project id");
|
||||
|
||||
if (_projectId == null)
|
||||
throw new IllegalStateException("No project id");
|
||||
|
||||
if (_p12File == null || !_p12File.exists())
|
||||
throw new IllegalStateException("No p12 file: "+(_p12File==null?"null":_p12File.getAbsolutePath()));
|
||||
|
|
|
@ -26,13 +26,9 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory;
|
||||
import org.eclipse.jetty.http2.ErrorCode;
|
||||
import org.eclipse.jetty.http2.ISession;
|
||||
import org.eclipse.jetty.http2.api.Session;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.ClientConnectionFactory;
|
||||
|
@ -43,7 +39,6 @@ import org.eclipse.jetty.io.MappedByteBufferPool;
|
|||
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
||||
import org.eclipse.jetty.io.SelectorManager;
|
||||
import org.eclipse.jetty.io.ssl.SslClientConnectionFactory;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
@ -117,7 +112,6 @@ public class HTTP2Client extends ContainerLifeCycle
|
|||
private Scheduler scheduler;
|
||||
private ByteBufferPool bufferPool;
|
||||
private ClientConnectionFactory connectionFactory;
|
||||
private Queue<ISession> sessions;
|
||||
private SelectorManager selector;
|
||||
private int selectors = 1;
|
||||
private long idleTimeout = 30000;
|
||||
|
@ -150,12 +144,6 @@ public class HTTP2Client extends ContainerLifeCycle
|
|||
});
|
||||
}
|
||||
|
||||
if (sessions == null)
|
||||
{
|
||||
sessions = new ConcurrentLinkedQueue<>();
|
||||
addBean(sessions);
|
||||
}
|
||||
|
||||
if (selector == null)
|
||||
{
|
||||
selector = newSelectorManager();
|
||||
|
@ -171,13 +159,6 @@ public class HTTP2Client extends ContainerLifeCycle
|
|||
return new ClientSelectorManager(getExecutor(), getScheduler(), getSelectors());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
closeConnections();
|
||||
super.doStop();
|
||||
}
|
||||
|
||||
public Executor getExecutor()
|
||||
{
|
||||
return executor;
|
||||
|
@ -329,23 +310,6 @@ public class HTTP2Client extends ContainerLifeCycle
|
|||
channel.socket().setTcpNoDelay(true);
|
||||
}
|
||||
|
||||
private void closeConnections()
|
||||
{
|
||||
for (ISession session : sessions)
|
||||
session.close(ErrorCode.NO_ERROR.code, null, Callback.NOOP);
|
||||
sessions.clear();
|
||||
}
|
||||
|
||||
public boolean addSession(ISession session)
|
||||
{
|
||||
return sessions.offer(session);
|
||||
}
|
||||
|
||||
public boolean removeSession(ISession session)
|
||||
{
|
||||
return sessions.remove(session);
|
||||
}
|
||||
|
||||
private class ClientSelectorManager extends SelectorManager
|
||||
{
|
||||
private ClientSelectorManager(Executor executor, Scheduler scheduler, int selectors)
|
||||
|
|
|
@ -125,17 +125,9 @@ public class HTTP2ClientConnectionFactory implements ClientConnectionFactory
|
|||
super.onOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose()
|
||||
{
|
||||
super.onClose();
|
||||
client.removeSession(getSession());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void succeeded()
|
||||
{
|
||||
client.addSession(getSession());
|
||||
promise.succeeded(getSession());
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,9 @@ import org.eclipse.jetty.http.HttpVersion;
|
|||
import org.eclipse.jetty.http.MetaData;
|
||||
import org.eclipse.jetty.http2.api.Session;
|
||||
import org.eclipse.jetty.http2.api.Stream;
|
||||
import org.eclipse.jetty.http2.api.server.ServerSessionListener;
|
||||
import org.eclipse.jetty.http2.frames.DataFrame;
|
||||
import org.eclipse.jetty.http2.frames.GoAwayFrame;
|
||||
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Jetty;
|
||||
|
@ -239,4 +241,48 @@ public class HTTP2Test extends AbstractTest
|
|||
|
||||
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServerSendsGoAwayOnStop() throws Exception
|
||||
{
|
||||
start(new ServerSessionListener.Adapter());
|
||||
|
||||
CountDownLatch closeLatch = new CountDownLatch(1);
|
||||
newClient(new Session.Listener.Adapter()
|
||||
{
|
||||
@Override
|
||||
public void onClose(Session session, GoAwayFrame frame)
|
||||
{
|
||||
closeLatch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
server.stop();
|
||||
|
||||
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClientSendsGoAwayOnStop() throws Exception
|
||||
{
|
||||
CountDownLatch closeLatch = new CountDownLatch(1);
|
||||
start(new ServerSessionListener.Adapter()
|
||||
{
|
||||
@Override
|
||||
public void onClose(Session session, GoAwayFrame frame)
|
||||
{
|
||||
closeLatch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
newClient(new Session.Listener.Adapter());
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
client.stop();
|
||||
|
||||
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.jetty.io.AbstractConnection;
|
|||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.ConcurrentArrayQueue;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -129,6 +130,14 @@ public class HTTP2Connection extends AbstractConnection
|
|||
executionStrategy.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
// We don't call super from here, otherwise we close the
|
||||
// endPoint and we're not able to read or write anymore.
|
||||
session.close(ErrorCode.NO_ERROR.code, "close", Callback.NOOP);
|
||||
}
|
||||
|
||||
protected class HTTP2Producer implements ExecutionStrategy.Producer
|
||||
{
|
||||
private ByteBuffer buffer;
|
||||
|
|
|
@ -537,8 +537,6 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
|
|||
{
|
||||
byte[] payload = reason == null ? null : reason.getBytes(StandardCharsets.UTF_8);
|
||||
GoAwayFrame frame = new GoAwayFrame(lastStreamId.get(), error, payload);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Sending {}", frame);
|
||||
control(null, callback, frame);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
<url>http://www.eclipse.org/jetty</url>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
|
@ -36,33 +37,34 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins
|
||||
</groupId>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-manifest</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Main-Class>org.eclipse.jetty.runner.Runner</Main-Class>
|
||||
<Import-Package>!*</Import-Package>
|
||||
<Export-Package></Export-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.eclipse.jetty.runner.Runner</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<mode>development</mode>
|
||||
<url>http://eclipse.org/jetty</url>
|
||||
<Built-By>${user.name}</Built-By>
|
||||
<package>org.eclipse.jetty.runner</package>
|
||||
<Bundle-Name>Jetty Runner</Bundle-Name>
|
||||
<Bundle-Vendor>Mort Bay Consulting</Bundle-Vendor>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -212,7 +212,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
public void onFillable()
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} onFillable enter {}", this, _channel.getState());
|
||||
LOG.debug("{} onFillable enter {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
|
||||
|
||||
HttpConnection last=setCurrentConnection(this);
|
||||
try
|
||||
|
@ -259,7 +259,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
{
|
||||
setCurrentConnection(last);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} onFillable exit {}", this, _channel.getState());
|
||||
LOG.debug("{} onFillable exit {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,8 +272,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
boolean handled=false;
|
||||
while (_parser.inContentState())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} parseContent",this);
|
||||
int filled = fillRequestBuffer();
|
||||
boolean handle = parseRequestBuffer();
|
||||
handled|=handle;
|
||||
|
@ -300,7 +298,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
// No pretend we read -1
|
||||
_parser.atEOF();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} filled -1",this);
|
||||
LOG.debug("{} filled -1 {}",this,BufferUtil.toDetailString(_requestBuffer));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -321,7 +319,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
_parser.atEOF();
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} filled {}",this,filled);
|
||||
LOG.debug("{} filled {} {}",this,filled,BufferUtil.toDetailString(_requestBuffer));
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
@ -559,8 +557,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
super.toString(),
|
||||
_parser,
|
||||
_generator,
|
||||
_channel,
|
||||
BufferUtil.toDetailString(_requestBuffer));
|
||||
_channel);
|
||||
}
|
||||
|
||||
private class Content extends HttpInput.Content
|
||||
|
|
|
@ -114,7 +114,10 @@ Module Management:
|
|||
fully understand the configuration of their
|
||||
${jetty.base} and are willing to forego some of the
|
||||
safety checks built into the jetty-start mechanism.
|
||||
|
||||
|
||||
--approve-all-licenses
|
||||
Approve all license questions. Useful for enabling
|
||||
modules from a script that does not require user interaction.
|
||||
|
||||
Startup / Shutdown Command Line:
|
||||
--------------------------------
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
||||
|
||||
|
@ -1027,38 +1028,46 @@ public class BufferUtil
|
|||
|
||||
private static void appendDebugString(StringBuilder buf,ByteBuffer buffer)
|
||||
{
|
||||
for (int i = 0; i < buffer.position(); i++)
|
||||
try
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == 16 && buffer.position() > 32)
|
||||
for (int i = 0; i < buffer.position(); i++)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.position() - 16;
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == 16 && buffer.position() > 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.position() - 16;
|
||||
}
|
||||
}
|
||||
buf.append("<<<");
|
||||
for (int i = buffer.position(); i < buffer.limit(); i++)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == buffer.position() + 16 && buffer.limit() > buffer.position() + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.limit() - 16;
|
||||
}
|
||||
}
|
||||
buf.append(">>>");
|
||||
int limit = buffer.limit();
|
||||
buffer.limit(buffer.capacity());
|
||||
for (int i = limit; i < buffer.capacity(); i++)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == limit + 16 && buffer.capacity() > limit + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.capacity() - 16;
|
||||
}
|
||||
}
|
||||
buffer.limit(limit);
|
||||
}
|
||||
buf.append("<<<");
|
||||
for (int i = buffer.position(); i < buffer.limit(); i++)
|
||||
catch(Throwable x)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == buffer.position() + 16 && buffer.limit() > buffer.position() + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.limit() - 16;
|
||||
}
|
||||
Log.getRootLogger().ignore(x);
|
||||
buf.append("!!concurrent mod!!");
|
||||
}
|
||||
buf.append(">>>");
|
||||
int limit = buffer.limit();
|
||||
buffer.limit(buffer.capacity());
|
||||
for (int i = limit; i < buffer.capacity(); i++)
|
||||
{
|
||||
appendContentChar(buf,buffer.get(i));
|
||||
if (i == limit + 16 && buffer.capacity() > limit + 32)
|
||||
{
|
||||
buf.append("...");
|
||||
i = buffer.capacity() - 16;
|
||||
}
|
||||
}
|
||||
buffer.limit(limit);
|
||||
}
|
||||
|
||||
private static void appendContentChar(StringBuilder buf, byte b)
|
||||
|
|
|
@ -181,7 +181,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
|
|||
{
|
||||
//Resource represents a packed jar
|
||||
URI uri = target.getURI();
|
||||
resourcesDir = Resource.newResource("jar:"+uri+"!/META-INF/resources", false);
|
||||
resourcesDir = Resource.newResource("jar:"+uri+"!/META-INF/resources");
|
||||
}
|
||||
|
||||
if (!resourcesDir.exists() || !resourcesDir.isDirectory())
|
||||
|
@ -252,7 +252,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
|
|||
else
|
||||
{
|
||||
URI uri = jar.getURI();
|
||||
webFrag = Resource.newResource("jar:"+uri+"!/META-INF/web-fragment.xml", false);
|
||||
webFrag = Resource.newResource("jar:"+uri+"!/META-INF/web-fragment.xml");
|
||||
}
|
||||
if (!webFrag.exists() || webFrag.isDirectory())
|
||||
{
|
||||
|
@ -404,7 +404,7 @@ public class MetaInfConfiguration extends AbstractConfiguration
|
|||
|
||||
URL url = new URL("jar:"+uri+"!/");
|
||||
JarURLConnection jarConn = (JarURLConnection) url.openConnection();
|
||||
jarConn.setUseCaches(false);
|
||||
jarConn.setUseCaches(Resource.getDefaultUseCaches());
|
||||
JarFile jarFile = jarConn.getJarFile();
|
||||
Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements())
|
||||
|
|
|
@ -97,8 +97,8 @@
|
|||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
<systemPropertyVariables>
|
||||
<test.projectId>jetty9-work</test.projectId>
|
||||
<test.port>8088</test.port>
|
||||
<DATASTORE_DATASET>jetty9-work</DATASTORE_DATASET>
|
||||
<DATASTORE_HOST>http://localhost:8088</DATASTORE_HOST>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
@ -37,11 +37,7 @@ public class ClientCrossContextSessionTest extends AbstractClientCrossContextSes
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,11 +36,7 @@ public class ForwardedSessionTest extends AbstractForwardedSessionTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,18 +38,16 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.resource.JarResource;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
||||
import com.google.api.client.util.Strings;
|
||||
import com.google.gcloud.datastore.Key;
|
||||
import com.google.gcloud.datastore.Datastore;
|
||||
import com.google.gcloud.datastore.DatastoreFactory;
|
||||
import com.google.gcloud.datastore.DatastoreOptions;
|
||||
import com.google.gcloud.datastore.Entity;
|
||||
import com.google.gcloud.datastore.GqlQuery;
|
||||
import com.google.gcloud.datastore.Key;
|
||||
import com.google.gcloud.datastore.ProjectionEntity;
|
||||
import com.google.gcloud.datastore.Query;
|
||||
import com.google.gcloud.datastore.Query.ResultType;
|
||||
|
@ -65,34 +63,6 @@ import com.google.gcloud.datastore.StructuredQuery.Projection;
|
|||
public class GCloudSessionTestSupport
|
||||
{
|
||||
|
||||
/**
|
||||
* GCloudTestConfiguration
|
||||
*
|
||||
* Specialization of GCloudConfiguration for gcd test environment
|
||||
*
|
||||
*/
|
||||
public class GCloudTestConfiguration extends GCloudConfiguration
|
||||
{
|
||||
int _port;
|
||||
|
||||
public GCloudTestConfiguration(String projectId, int port)
|
||||
{
|
||||
setProjectId(projectId);
|
||||
_port = port;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DatastoreOptions getDatastoreOptions() throws Exception
|
||||
{
|
||||
return DatastoreOptions.builder()
|
||||
.projectId(_projectId)
|
||||
.host("http://localhost:" + _port)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ProcessOutputReader implements Runnable
|
||||
{
|
||||
private InputStream _is;
|
||||
|
@ -138,40 +108,55 @@ public class GCloudSessionTestSupport
|
|||
|
||||
|
||||
public static String DEFAULT_PROJECTID = "jetty9-work";
|
||||
public static int DEFAULT_PORT = 8088;
|
||||
public static String DEFAULT_PORT = "8088";
|
||||
public static String DEFAULT_HOST = "http://localhost:"+DEFAULT_PORT;
|
||||
public static String DEFAULT_GCD_ZIP = "gcd-v1beta2-rev1-2.1.2b.zip";
|
||||
public static String DEFAULT_GCD_UNPACKED = "gcd-v1beta2-rev1-2.1.2b";
|
||||
public static String DEFAULT_DOWNLOAD_URL = "http://storage.googleapis.com/gcd/tools/";
|
||||
|
||||
|
||||
String _projectId;
|
||||
int _port;
|
||||
String _testServerUrl;
|
||||
String _testPort;
|
||||
File _datastoreDir;
|
||||
File _gcdInstallDir;
|
||||
File _gcdUnpackedDir;
|
||||
Datastore _ds;
|
||||
|
||||
public GCloudSessionTestSupport (String projectId, int port, File gcdInstallDir)
|
||||
public GCloudSessionTestSupport (File gcdInstallDir)
|
||||
{
|
||||
_projectId = projectId;
|
||||
if (_projectId == null)
|
||||
_projectId = DEFAULT_PROJECTID;
|
||||
_port = port;
|
||||
if (_port <= 0)
|
||||
_port = DEFAULT_PORT;
|
||||
|
||||
_gcdInstallDir = gcdInstallDir;
|
||||
if (_gcdInstallDir == null)
|
||||
_gcdInstallDir = new File (System.getProperty("java.io.tmpdir"));
|
||||
|
||||
_projectId = System.getProperty("DATASTORE_DATASET", System.getenv("DATASTORE_DATASET"));
|
||||
if (_projectId == null)
|
||||
{
|
||||
_projectId = DEFAULT_PROJECTID;
|
||||
System.setProperty("DATASTORE_DATASET", _projectId);
|
||||
}
|
||||
_testServerUrl = System.getProperty("DATASTORE_HOST", System.getenv("DATASTORE_HOST"));
|
||||
if (_testServerUrl == null)
|
||||
{
|
||||
_testServerUrl = DEFAULT_HOST;
|
||||
_testPort = DEFAULT_PORT;
|
||||
System.setProperty("DATASTORE_HOST", _testServerUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = _testServerUrl.lastIndexOf(':');
|
||||
_testPort = _testServerUrl.substring(i+1);
|
||||
}
|
||||
}
|
||||
|
||||
public GCloudSessionTestSupport ()
|
||||
{
|
||||
this(null,0, null);
|
||||
this(null);
|
||||
}
|
||||
|
||||
public GCloudConfiguration getConfiguration ()
|
||||
{
|
||||
return new GCloudTestConfiguration(_projectId, _port);
|
||||
return new GCloudConfiguration();
|
||||
}
|
||||
|
||||
|
||||
|
@ -251,11 +236,11 @@ public class GCloudSessionTestSupport
|
|||
processBuilder.redirectErrorStream(true);
|
||||
if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"))
|
||||
{
|
||||
processBuilder.command("cmd", "/C", new File(_gcdUnpackedDir, "gcd.cmd").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown","--port="+String.valueOf(_port), _projectId);
|
||||
processBuilder.command("cmd", "/C", new File(_gcdUnpackedDir, "gcd.cmd").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown","--port="+_testPort, _projectId);
|
||||
}
|
||||
else
|
||||
{
|
||||
processBuilder.command("bash", new File(_gcdUnpackedDir, "gcd.sh").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown", "--port="+String.valueOf(_port), _projectId);
|
||||
processBuilder.command("bash", new File(_gcdUnpackedDir, "gcd.sh").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown", "--port="+_testPort, _projectId);
|
||||
}
|
||||
|
||||
System.err.println("Starting datastore");
|
||||
|
@ -270,7 +255,7 @@ public class GCloudSessionTestSupport
|
|||
throws Exception
|
||||
{
|
||||
//Send request to terminate test datastore
|
||||
URL url = new URL("http", "localhost", _port, "/_ah/admin/quit");
|
||||
URL url = new URL("http", "localhost", Integer.parseInt(_testPort.trim()), "/_ah/admin/quit");
|
||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||
con.setRequestMethod("POST");
|
||||
con.setDoOutput(true);
|
||||
|
|
|
@ -34,14 +34,13 @@ public class ImmortalSessionTest extends AbstractImmortalSessionTest
|
|||
{
|
||||
static GCloudSessionTestSupport _testSupport;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,11 +36,7 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class LastAccessTimeTest extends AbstractLastAccessTimeTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,7 @@ public class NewSessionTest extends AbstractNewSessionTest
|
|||
@Before
|
||||
public void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class ReentrantRequestSessionTest extends AbstractReentrantRequestSession
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,11 +39,7 @@ public class RemoveSessionTest extends AbstractRemoveSessionTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class SameNodeLoadTest extends AbstractSameNodeLoadTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,7 @@ public class ServerCrossContextSessionTest extends AbstractServerCrossContextSes
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,7 @@ public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAnd
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@ public class SessionRenewTest extends AbstractSessionRenewTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,11 +38,7 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,11 +39,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
|
|||
@BeforeClass
|
||||
public static void setup () throws Exception
|
||||
{
|
||||
String projectId = System.getProperty("test.projectId", null);
|
||||
String port = System.getProperty("test.port","0");
|
||||
_testSupport = new GCloudSessionTestSupport(projectId,
|
||||
Integer.parseInt(port),
|
||||
null);
|
||||
_testSupport = new GCloudSessionTestSupport();
|
||||
_testSupport.setUp();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue