Merge remote-tracking branch 'origin/master' into jetty-8

This commit is contained in:
Jan Bartel 2011-10-24 16:30:10 +11:00
commit fc497fe1e8
43 changed files with 281 additions and 218 deletions

View File

@ -593,7 +593,8 @@ public class HttpExchange
if (uri.isOpaque())
throw new IllegalArgumentException("Opaque URI: " + uri);
LOG.debug("URI = {}",uri.toASCIIString());
if (LOG.isDebugEnabled())
LOG.debug("URI = {}",uri.toASCIIString());
String scheme = uri.getScheme();
int port = uri.getPort();

View File

@ -168,7 +168,8 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector
Timeout.Task connectTimeout = _connectingChannels.remove(channel);
if (connectTimeout != null)
connectTimeout.cancel();
LOG.debug("Channels with connection pending: {}", _connectingChannels.size());
if (LOG.isDebugEnabled())
LOG.debug("Channels with connection pending: {}", _connectingChannels.size());
// key should have destination at this point (will be replaced by endpoint after this call)
HttpDestination dest=(HttpDestination)key.attachment();

View File

@ -481,7 +481,7 @@ public class DeploymentManager extends AggregateLifeCycle
while (it.hasNext())
{
Node node = it.next();
LOG.debug("Executing Node: " + node);
LOG.debug("Executing Node {}",node);
_lifecycle.runBindings(node,appentry.app,this);
appentry.setLifeCycleNode(node);
}

View File

@ -257,7 +257,7 @@ public class WebAppDeployer extends AbstractLifeCycle
if (path != null && path.equals(app.getFile().getCanonicalPath()))
{
LOG.debug("Already deployed:"+path);
LOG.debug("Already deployed: {}",path);
continue files;
}
}

View File

@ -51,13 +51,14 @@ public class StandardUndeployer implements AppLifeCycle.Binding
for (int i = 0, n = children.length; i < n; i++)
{
Handler child = children[i];
LOG.debug("Child handler: " + child);
LOG.debug("Child handler {}",child);
if (child.equals(context))
{
LOG.debug("Removing handler: " + child);
LOG.debug("Removing handler {}",child);
coll.removeHandler(child);
child.destroy();
LOG.debug(String.format("After removal: %d (originally %d)",coll.getHandlers().length,originalCount));
if (LOG.isDebugEnabled())
LOG.debug("After removal: {} (originally {})",coll.getHandlers().length,originalCount);
}
else if (child instanceof HandlerCollection)
{

View File

@ -99,7 +99,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
@Override
protected void doStart() throws Exception
{
if (LOG.isDebugEnabled()) LOG.debug(this.getClass().getSimpleName() + ".doStart()");
if (LOG.isDebugEnabled())
LOG.debug(this.getClass().getSimpleName() + ".doStart()");
if (_monitoredDir == null)
{
throw new IllegalStateException("No configuration dir specified");
@ -132,7 +133,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
/* ------------------------------------------------------------ */
protected void fileAdded(String filename) throws Exception
{
if (LOG.isDebugEnabled()) LOG.debug("added ",filename);
if (LOG.isDebugEnabled())
LOG.debug("added {}",filename);
App app = ScanningAppProvider.this.createApp(filename);
if (app != null)
{
@ -144,7 +146,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
/* ------------------------------------------------------------ */
protected void fileChanged(String filename) throws Exception
{
if (LOG.isDebugEnabled()) LOG.debug("changed ",filename);
if (LOG.isDebugEnabled())
LOG.debug("changed {}",filename);
App app = _appMap.remove(filename);
if (app != null)
{
@ -161,7 +164,8 @@ public abstract class ScanningAppProvider extends AbstractLifeCycle implements A
/* ------------------------------------------------------------ */
protected void fileRemoved(String filename) throws Exception
{
if (LOG.isDebugEnabled()) LOG.debug("removed ",filename);
if (LOG.isDebugEnabled())
LOG.debug("removed {}",filename);
App app = _appMap.remove(filename);
if (app != null)
_deploymentManager.removeApp(app);

View File

@ -157,7 +157,8 @@ public class HttpGenerator extends AbstractGenerator
if (_last || _state==STATE_END)
{
LOG.debug("Ignoring extra content {}",content);
if (LOG.isDebugEnabled())
LOG.debug("Ignoring extra content {}",content.toDetailString());
content.clear();
return;
}
@ -242,7 +243,8 @@ public class HttpGenerator extends AbstractGenerator
if (_last || _state==STATE_END)
{
LOG.debug("Ignoring extra content {}",Byte.valueOf(b));
if (LOG.isDebugEnabled())
LOG.debug("Ignoring extra content {}",Byte.valueOf(b));
return false;
}

View File

@ -299,8 +299,10 @@ public class SslContextFactory extends AbstractLifeCycle
_context.init(keyManagers,trustManagers,secureRandom);
SSLEngine engine=newSslEngine();
LOG.info("Enabled Protocols {} of {}",Arrays.asList(engine.getEnabledProtocols()),Arrays.asList(engine.getSupportedProtocols()));
LOG.debug("Enabled Ciphers {} of {}",Arrays.asList(engine.getEnabledCipherSuites()),Arrays.asList(engine.getSupportedCipherSuites()));
if (LOG.isDebugEnabled())
LOG.debug("Enabled Ciphers {} of {}",Arrays.asList(engine.getEnabledCipherSuites()),Arrays.asList(engine.getSupportedCipherSuites()));
}
}
}

View File

@ -72,7 +72,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
_engine=engine;
_session=engine.getSession();
if (_debug) LOG.debug(_session+" channel="+channel);
if (_debug)
LOG.debug(_session+" channel="+channel);
}
/* ------------------------------------------------------------ */
@ -86,7 +87,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
_engine=engine;
_session=engine.getSession();
if (_debug) LOG.debug(_session+" channel="+channel);
if (_debug)
LOG.debug(_session+" channel="+channel);
}
@ -503,7 +505,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
int total_filled=0;
boolean remoteClosed = false;
LOG.debug("{} unwrap space={} open={}",_session,_inNIOBuffer.space(),super.isOpen());
if (LOG.isDebugEnabled())
LOG.debug("{} unwrap space={} open={}",_session,_inNIOBuffer.space(),super.isOpen());
// loop filling as much encrypted data as we can into the buffer
while (_inNIOBuffer.space()>0 && super.isOpen())
@ -637,7 +640,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
out_buffer.position(_outNIOBuffer.putIndex());
out_buffer.limit(out_buffer.capacity());
_result=_engine.wrap(bbuf,out_buffer);
if (_debug) LOG.debug("{} wrap {}",_session,_result);
if (_debug)
LOG.debug("{} wrap {}",_session,_result);
if (!_handshook && _result.getHandshakeStatus()==SSLEngineResult.HandshakeStatus.FINISHED)
_handshook=true;
_outNIOBuffer.setPutIndex(out_buffer.position());

View File

@ -41,7 +41,7 @@ import org.eclipse.jetty.util.thread.ShutdownThread;
*/
public class MBeanContainer extends AbstractLifeCycle implements Container.Listener, Dumpable
{
private final static Logger __log = Log.getLogger(MBeanContainer.class.getName());
private final static Logger LOG = Log.getLogger(MBeanContainer.class.getName());
private final MBeanServer _server;
private final WeakHashMap<Object, ObjectName> _beans = new WeakHashMap<Object, ObjectName>();
@ -93,7 +93,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
}
catch (Exception e)
{
__log.ignore(e);
LOG.ignore(e);
}
}
@ -134,7 +134,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
*/
public synchronized void add(Relationship relationship)
{
__log.debug("add {}",relationship);
LOG.debug("add {}",relationship);
ObjectName parent = _beans.get(relationship.getParent());
if (parent == null)
{
@ -168,7 +168,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
*/
public synchronized void remove(Relationship relationship)
{
__log.debug("remove {}",relationship);
LOG.debug("remove {}",relationship);
ObjectName parent = _beans.get(relationship.getParent());
ObjectName child = _beans.get(relationship.getChild());
@ -194,7 +194,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
*/
public synchronized void removeBean(Object obj)
{
__log.debug("removeBean {}",obj);
LOG.debug("removeBean {}",obj);
ObjectName bean = _beans.remove(obj);
if (bean != null)
@ -202,7 +202,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
List<Container.Relationship> beanRelations= _relations.remove(bean);
if (beanRelations != null)
{
__log.debug("Unregister {}", beanRelations);
LOG.debug("Unregister {}", beanRelations);
List<?> removeList = new ArrayList<Object>(beanRelations);
for (Object r : removeList)
{
@ -214,15 +214,15 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
try
{
_server.unregisterMBean(bean);
__log.debug("Unregistered {}", bean);
LOG.debug("Unregistered {}", bean);
}
catch (javax.management.InstanceNotFoundException e)
{
__log.ignore(e);
LOG.ignore(e);
}
catch (Exception e)
{
__log.warn(e);
LOG.warn(e);
}
}
}
@ -234,7 +234,7 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
*/
public synchronized void addBean(Object obj)
{
__log.debug("addBean {}",obj);
LOG.debug("addBean {}",obj);
try
{
if (obj == null || _beans.containsKey(obj))
@ -298,13 +298,13 @@ public class MBeanContainer extends AbstractLifeCycle implements Container.Liste
}
ObjectInstance oinstance = _server.registerMBean(mbean, oname);
__log.debug("Registered {}", oinstance.getObjectName());
LOG.debug("Registered {}", oinstance.getObjectName());
_beans.put(obj, oinstance.getObjectName());
}
catch (Exception e)
{
__log.warn("bean: " + obj, e);
LOG.warn("bean: " + obj, e);
}
}

View File

@ -280,7 +280,7 @@ public class ProxyRule extends PatternRule
if (debug != 0)
{
_log.debug(debug + " " + request.getMethod() + " " + url + " " + request.getProtocol());
_log.debug("{} {} {} {}", debug ,request.getMethod(), url, request.getProtocol());
}
boolean hasContent = createHeaders(request,debug,exchange);
@ -393,7 +393,7 @@ public class ProxyRule extends PatternRule
if (val != null)
{
if (debug != 0)
_log.debug(debug + " " + hdr + ": " + val);
_log.debug("{} {} {}",debug,hdr,val);
exchange.setRequestHeader(hdr,val);
}

View File

@ -135,9 +135,8 @@ public class HashLoginService extends MappedLoginService implements UserListener
if (_propertyUserStore == null)
{
if(LOG.isDebugEnabled())
{
LOG.debug("doStart: Starting new PropertyUserStore. PropertiesFile: " + _config + " refreshInterval: " + _refreshInterval);
}
_propertyUserStore = new PropertyUserStore();
_propertyUserStore.setRefreshInterval(_refreshInterval);
_propertyUserStore.setConfig(_config);

View File

@ -137,7 +137,7 @@ public class JDBCLoginService extends MappedLoginService
|| _password == null
|| _cacheTime < 0)
{
if (LOG.isDebugEnabled()) LOG.debug("UserRealm " + getName() + " has not been properly configured");
LOG.warn("UserRealm " + getName() + " has not been properly configured");
}
_cacheTime *= 1000;
_lastHashPurge = 0;

View File

@ -100,7 +100,7 @@ public class SpnegoLoginService extends AbstractLifeCycle implements LoginServic
_targetName = properties.getProperty("targetName");
LOG.debug("\n\nTarget Name\n\n" + _targetName);
LOG.debug("Target Name {}", _targetName);
super.doStart();
}

View File

@ -117,7 +117,8 @@ public class DigestAuthenticator extends LoginAuthenticator
boolean stale = false;
if (credentials != null)
{
if (LOG.isDebugEnabled()) LOG.debug("Credentials: " + credentials);
if (LOG.isDebugEnabled())
LOG.debug("Credentials: " + credentials);
QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(credentials, "=, ", true, false);
final Digest digest = new Digest(request.getMethod());
String last = null;

View File

@ -634,7 +634,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
public void setForwarded(boolean check)
{
if (check)
LOG.debug(this + " is forwarded");
LOG.debug("{} is forwarded",this);
_forwarded = check;
}
@ -1001,7 +1001,8 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
if (on && _statsStartedAt.get() != -1)
return;
LOG.debug("Statistics on = " + on + " for " + this);
if (LOG.isDebugEnabled())
LOG.debug("Statistics on = " + on + " for " + this);
statsReset();
_statsStartedAt.set(on?System.currentTimeMillis():-1);

View File

@ -968,7 +968,8 @@ public abstract class HttpConnection extends AbstractConnection
@Override
public void startResponse(Buffer version, int status, Buffer reason)
{
LOG.debug("Bad request!: "+version+" "+status+" "+reason);
if (LOG.isDebugEnabled())
LOG.debug("Bad request!: "+version+" "+status+" "+reason);
}
}

View File

@ -825,7 +825,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
@Override
public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
LOG.debug("scope {} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this);
if (LOG.isDebugEnabled())
LOG.debug("scope {}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),this);
Context old_context = null;
String old_context_path = null;
@ -897,7 +898,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
}
if (LOG.isDebugEnabled())
LOG.debug("context={} @ {}",baseRequest.getContextPath() + "|" + baseRequest.getServletPath() + "|" + baseRequest.getPathInfo(),this);
LOG.debug("context={}|{}|{} @ {}",baseRequest.getContextPath(),baseRequest.getServletPath(), baseRequest.getPathInfo(),this);
// start manual inline of nextScope(target,baseRequest,request,response);
if (never())

View File

@ -30,7 +30,7 @@ import org.eclipse.jetty.util.log.Logger;
@SuppressWarnings("deprecation")
public abstract class AbstractSession implements AbstractSessionManager.SessionIf
{
final static Logger __log = SessionHandler.__log;
final static Logger LOG = SessionHandler.LOG;
private final AbstractSessionManager _manager;
private final String _clusterId; // ID unique within cluster
@ -63,7 +63,8 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
_lastAccessed=_created;
_requests=1;
_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000:-1;
__log.debug("new session & id "+_nodeId+" "+_clusterId);
if (LOG.isDebugEnabled())
LOG.debug("new session & id "+_nodeId+" "+_clusterId);
}
/* ------------------------------------------------------------- */
@ -76,7 +77,8 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
_accessed=accessed;
_lastAccessed=accessed;
_requests=1;
__log.debug("new session "+_nodeId+" "+_clusterId);
if (LOG.isDebugEnabled())
LOG.debug("new session "+_nodeId+" "+_clusterId);
}
/* ------------------------------------------------------------- */
@ -300,7 +302,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
{
try
{
__log.debug("invalidate ",_clusterId);
LOG.debug("invalidate {}",_clusterId);
if (isValid())
clearAttributes();
}

View File

@ -61,7 +61,7 @@ import org.eclipse.jetty.util.statistic.SampleStatistic;
@SuppressWarnings("deprecation")
public abstract class AbstractSessionManager extends AbstractLifeCycle implements SessionManager
{
final static Logger __log = SessionHandler.__log;
final static Logger __log = SessionHandler.LOG;
public Set<SessionTrackingMode> __defaultSessionTrackingModes =
Collections.unmodifiableSet(
@ -292,6 +292,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
return _sessionIdManager;
}
/* ------------------------------------------------------------ */
/**
* @return seconds
@ -356,6 +357,22 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
return _refreshCookieAge;
}
/* ------------------------------------------------------------ */
/**
* @return Returns the secureCookies.
*/
public boolean getSecureCookies()
{
return _secureCookies;
}
/* ------------------------------------------------------------ */
public String getSessionCookie()
{
return _sessionCookie;
}
/* ------------------------------------------------------------ */
public HttpCookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)
{
@ -395,6 +412,11 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
return null;
}
public String getSessionDomain()
{
return _sessionDomain;
}
/* ------------------------------------------------------------ */
/**
* @return Returns the sessionHandler.
@ -414,6 +436,8 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
throw new UnsupportedOperationException();
}
/* ------------------------------------------------------------ */
public int getSessions()
{
@ -432,6 +456,15 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
return _sessionIdPathParameterNamePrefix;
}
/* ------------------------------------------------------------ */
/**
* @return Returns the usingCookies.
*/
public boolean isUsingCookies()
{
return _usingCookies;
}
/* ------------------------------------------------------------ */
public boolean isValid(HttpSession session)
{
@ -523,6 +556,8 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_sessionIdManager=metaManager;
}
/* ------------------------------------------------------------ */
/**
* @param seconds
@ -539,34 +574,14 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_refreshCookieAge=ageInSeconds;
}
/* ------------------------------------------------------------ */
/**
* Set if the session manager should use SecureCookies.
* A secure cookie will only be sent by a browser on a secure (https) connection to
* avoid the concern of cookies being intercepted on non secure channels.
* For the cookie to be issued as secure, the {@link ServletRequest#isSecure()} method must return true.
* If SSL offload is used, then the {@link AbstractConnector#customize(org.eclipse.jetty.io.EndPoint, Request)}
* method can be used to force the request to be https, or the {@link AbstractConnector#setForwarded(boolean)}
* can be set to true, so that the X-Forwarded-Proto header is respected.
* <p>
* If secure session cookies are used, then a session may not be shared between http and https requests.
*
* @param secureCookies If true, use secure cookies.
*/
public void setSecureCookies(boolean secureCookies)
{
_secureCookies=secureCookies;
}
public void setSessionCookie(String cookieName)
{
_sessionCookie=cookieName;
}
public void setSessionDomain(String domain)
{
_sessionDomain=domain;
}
/* ------------------------------------------------------------ */
/**
@ -578,21 +593,23 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_sessionHandler=sessionHandler;
}
/* ------------------------------------------------------------ */
/**
* @see org.eclipse.jetty.server.SessionManager#setSessionPath(java.lang.String)
*/
public void setSessionPath(String path)
{
_sessionPath=path;
}
/* ------------------------------------------------------------ */
public void setSessionIdPathParameterName(String param)
{
_sessionIdPathParameterName =(param==null||"none".equals(param))?null:param;
_sessionIdPathParameterNamePrefix =(param==null||"none".equals(param))?null:(";"+ _sessionIdPathParameterName +"=");
}
/* ------------------------------------------------------------ */
/**
* @param usingCookies
* The usingCookies to set.
*/
public void setUsingCookies(boolean usingCookies)
{
_usingCookies=usingCookies;
}
protected abstract void addSession(AbstractSession session);
@ -734,13 +751,6 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
_usingURLs=_sessionTrackingModes.contains(SessionTrackingMode.URL);
}
/* ------------------------------------------------------------ */
@Override
public boolean isUsingCookies()
{
return _usingCookies;
}
/* ------------------------------------------------------------ */
@Override
public boolean isUsingURLs()

View File

@ -47,7 +47,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class HashSessionManager extends AbstractSessionManager
{
final static Logger __log = SessionHandler.__log;
final static Logger __log = SessionHandler.LOG;
protected final ConcurrentMap<String,HashedSession> _sessions=new ConcurrentHashMap<String,HashedSession>();
private static int __id;

View File

@ -162,11 +162,8 @@ public class HashedSession extends AbstractSession
// Access now to prevent race with idling period
access(System.currentTimeMillis());
if (LOG.isDebugEnabled())
{
LOG.debug("Deidling " + super.getId());
}
FileInputStream fis = null;

View File

@ -53,7 +53,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class JDBCSessionIdManager extends AbstractSessionIdManager
{
final static Logger LOG = SessionHandler.__log;
final static Logger LOG = SessionHandler.LOG;
protected final HashSet<String> _sessionIds = new HashSet<String>();
protected Server _server;
@ -108,7 +108,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
throws SQLException
{
_dbName = dbMeta.getDatabaseProductName().toLowerCase();
LOG.debug ("Using database "+_dbName);
LOG.debug ("Using database {}",_dbName);
_isLower = dbMeta.storesLowerCaseIdentifiers();
_isUpper = dbMeta.storesUpperCaseIdentifiers();
}
@ -255,7 +255,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
if ((System.currentTimeMillis()%2) == 0)
_scavengeIntervalMs += tenPercent;
if (LOG.isDebugEnabled()) LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms");
if (LOG.isDebugEnabled())
LOG.debug("Scavenging every "+_scavengeIntervalMs+" ms");
if (_timer!=null && (period!=old_period || _task==null))
{
synchronized (this)
@ -434,7 +435,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
initializeDatabase();
prepareTables();
super.doStart();
if (LOG.isDebugEnabled()) LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec");
if (LOG.isDebugEnabled())
LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec");
_timer=new Timer("JDBCSessionScavenger", true);
setScavengeInterval(getScavengeInterval());
}
@ -684,7 +686,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
List<String> expiredSessionIds = new ArrayList<String>();
try
{
if (LOG.isDebugEnabled()) LOG.debug("Scavenge sweep started at "+System.currentTimeMillis());
if (LOG.isDebugEnabled())
LOG.debug("Scavenge sweep started at "+System.currentTimeMillis());
if (_lastScavengeTime > 0)
{
connection = getConnection();
@ -693,7 +696,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
PreparedStatement statement = connection.prepareStatement(_selectExpiredSessions);
long lowerBound = (_lastScavengeTime - _scavengeIntervalMs);
long upperBound = _lastScavengeTime;
if (LOG.isDebugEnabled()) LOG.debug (" Searching for sessions expired between "+lowerBound + " and "+upperBound);
if (LOG.isDebugEnabled())
LOG.debug (" Searching for sessions expired between "+lowerBound + " and "+upperBound);
statement.setLong(1, lowerBound);
statement.setLong(2, upperBound);

View File

@ -377,7 +377,8 @@ public class JDBCSessionManager extends AbstractSessionManager
@Override
protected void timeout() throws IllegalStateException
{
if (LOG.isDebugEnabled()) LOG.debug("Timing out session id="+getClusterId());
if (LOG.isDebugEnabled())
LOG.debug("Timing out session id="+getClusterId());
super.timeout();
}
}
@ -790,7 +791,8 @@ public class JDBCSessionManager extends AbstractSessionManager
while (itor.hasNext())
{
String sessionId = (String)itor.next();
if (LOG.isDebugEnabled()) LOG.debug("Expiring session id "+sessionId);
if (LOG.isDebugEnabled())
LOG.debug("Expiring session id "+sessionId);
Session session = (Session)_sessions.get(sessionId);
if (session != null)
@ -800,7 +802,8 @@ public class JDBCSessionManager extends AbstractSessionManager
}
else
{
if (LOG.isDebugEnabled()) LOG.debug("Unrecognized session id="+sessionId);
if (LOG.isDebugEnabled())
LOG.debug("Unrecognized session id="+sessionId);
}
}
}

View File

@ -38,7 +38,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class SessionHandler extends ScopedHandler
{
final static Logger __log = Log.getLogger("org.eclipse.jetty.server.session");
final static Logger LOG = Log.getLogger("org.eclipse.jetty.server.session");
public final static EnumSet<SessionTrackingMode> DEFAULT_TRACKING = EnumSet.of(SessionTrackingMode.COOKIE,SessionTrackingMode.URL);
@ -181,10 +181,10 @@ public class SessionHandler extends ScopedHandler
}
}
if(__log.isDebugEnabled())
if(LOG.isDebugEnabled())
{
__log.debug("sessionManager="+_sessionManager);
__log.debug("session="+session);
LOG.debug("sessionManager="+_sessionManager);
LOG.debug("session="+session);
}
// start manual inline of nextScope(target,baseRequest,request,response);
@ -271,7 +271,8 @@ public class SessionHandler extends ScopedHandler
{
requested_session_id=cookies[i].getValue();
requested_session_id_from_cookie = true;
if(__log.isDebugEnabled())__log.debug("Got Session ID "+requested_session_id+" from cookie");
if(LOG.isDebugEnabled())
LOG.debug("Got Session ID {} from cookie",requested_session_id);
session=sessionManager.getHttpSession(requested_session_id);
if (session!=null && sessionManager.isValid(session))
@ -304,8 +305,8 @@ public class SessionHandler extends ScopedHandler
requested_session_id = uri.substring(s,i);
requested_session_id_from_cookie = false;
session=sessionManager.getHttpSession(requested_session_id);
if(__log.isDebugEnabled())
__log.debug("Got Session ID "+requested_session_id+" from URL");
if(LOG.isDebugEnabled())
LOG.debug("Got Session ID {} from URL",requested_session_id);
}
}
}

View File

@ -280,7 +280,8 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
if (h.getServletInstance()==this)
_defaultHolder=h;
if (LOG.isDebugEnabled()) LOG.debug("resource base = "+_resourceBase);
if (LOG.isDebugEnabled())
LOG.debug("resource base = "+_resourceBase);
}
/**

View File

@ -90,7 +90,8 @@ public class Holder<T> extends AbstractLifeCycle implements Dumpable
try
{
_class=Loader.loadClass(Holder.class, _className);
if(LOG.isDebugEnabled())LOG.debug("Holding {}",_class);
if(LOG.isDebugEnabled())
LOG.debug("Holding {}",_class);
}
catch (Exception e)
{

View File

@ -140,7 +140,8 @@ public class Invoker extends HttpServlet
{
// Found a named servlet (from a user's web.xml file) so
// now we add a mapping for it
LOG.debug("Adding servlet mapping for named servlet:"+servlet+":"+URIUtil.addPaths(servlet_path,servlet)+"/*");
if (LOG.isDebugEnabled())
LOG.debug("Adding servlet mapping for named servlet:"+servlet+":"+URIUtil.addPaths(servlet_path,servlet)+"/*");
ServletMapping mapping = new ServletMapping();
mapping.setServletName(servlet);
mapping.setPathSpec(URIUtil.addPaths(servlet_path,servlet)+"/*");
@ -174,7 +175,8 @@ public class Invoker extends HttpServlet
else
{
// Make a holder
LOG.debug("Making new servlet="+servlet+" with path="+path+"/*");
if (LOG.isDebugEnabled())
LOG.debug("Making new servlet="+servlet+" with path="+path+"/*");
holder=_servletHandler.addServletWithMapping(servlet, path+"/*");
if (_parameters!=null)
@ -211,7 +213,7 @@ public class Invoker extends HttpServlet
}
}
if (_verbose)
if (_verbose && LOG.isDebugEnabled())
LOG.debug("Dynamic load '"+servlet+"' at "+path);
}
}

View File

@ -395,7 +395,7 @@ public class ServletHandler extends ScopedHandler
}
if (LOG.isDebugEnabled())
LOG.debug("servlet {} -> {}",baseRequest.getContextPath()+"|"+baseRequest.getServletPath()+"|"+baseRequest.getPathInfo(),servlet_holder);
LOG.debug("servlet {}|{}|{} -> {}",baseRequest.getContextPath(),baseRequest.getServletPath(),baseRequest.getPathInfo(),servlet_holder);
try
{
@ -463,7 +463,7 @@ public class ServletHandler extends ScopedHandler
}
}
LOG.debug("chain=",chain);
LOG.debug("chain={}",chain);
try
{
@ -1239,7 +1239,8 @@ public class ServletHandler extends ScopedHandler
HttpServletResponse response)
throws IOException
{
if(LOG.isDebugEnabled())LOG.debug("Not Found "+request.getRequestURI());
if(LOG.isDebugEnabled())
LOG.debug("Not Found "+request.getRequestURI());
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
@ -1399,13 +1400,15 @@ public class ServletHandler extends ScopedHandler
public void doFilter(ServletRequest request, ServletResponse response)
throws IOException, ServletException
{
if (LOG.isDebugEnabled()) LOG.debug("doFilter " + _filter);
if (LOG.isDebugEnabled())
LOG.debug("doFilter " + _filter);
// pass to next filter
if (_filter < LazyList.size(_chain))
{
FilterHolder holder= (FilterHolder)LazyList.get(_chain, _filter++);
if (LOG.isDebugEnabled()) LOG.debug("call filter " + holder);
if (LOG.isDebugEnabled())
LOG.debug("call filter " + holder);
Filter filter= holder.getFilter();
if (holder.isAsyncSupported() || !_baseRequest.isAsyncSupported())
@ -1431,7 +1434,8 @@ public class ServletHandler extends ScopedHandler
// Call servlet
if (_servletHolder != null)
{
if (LOG.isDebugEnabled()) LOG.debug("call servlet " + _servletHolder);
if (LOG.isDebugEnabled())
LOG.debug("call servlet " + _servletHolder);
_servletHolder.handle(_baseRequest,request, response);
}
else // Not found

View File

@ -74,7 +74,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class CrossOriginFilter implements Filter
{
private static final Logger logger = Log.getLogger(CrossOriginFilter.class);
private static final Logger LOG = Log.getLogger(CrossOriginFilter.class);
// Request headers
private static final String ORIGIN_HEADER = "Origin";
@ -145,7 +145,7 @@ public class CrossOriginFilter implements Filter
}
catch (NumberFormatException x)
{
logger.info("Cross-origin filter, could not parse '{}' parameter as integer: {}", PREFLIGHT_MAX_AGE_PARAM, preflightMaxAgeConfig);
LOG.info("Cross-origin filter, could not parse '{}' parameter as integer: {}", PREFLIGHT_MAX_AGE_PARAM, preflightMaxAgeConfig);
}
String allowedCredentialsConfig = config.getInitParameter(ALLOW_CREDENTIALS_PARAM);
@ -153,12 +153,15 @@ public class CrossOriginFilter implements Filter
allowedCredentialsConfig = "true";
allowCredentials = Boolean.parseBoolean(allowedCredentialsConfig);
logger.debug("Cross-origin filter configuration: " +
ALLOWED_ORIGINS_PARAM + " = " + allowedOriginsConfig + ", " +
ALLOWED_METHODS_PARAM + " = " + allowedMethodsConfig + ", " +
ALLOWED_HEADERS_PARAM + " = " + allowedHeadersConfig + ", " +
PREFLIGHT_MAX_AGE_PARAM + " = " + preflightMaxAgeConfig + ", " +
ALLOW_CREDENTIALS_PARAM + " = " + allowedCredentialsConfig);
if (LOG.isDebugEnabled())
{
LOG.debug("Cross-origin filter configuration: " +
ALLOWED_ORIGINS_PARAM + " = " + allowedOriginsConfig + ", " +
ALLOWED_METHODS_PARAM + " = " + allowedMethodsConfig + ", " +
ALLOWED_HEADERS_PARAM + " = " + allowedHeadersConfig + ", " +
PREFLIGHT_MAX_AGE_PARAM + " = " + preflightMaxAgeConfig + ", " +
ALLOW_CREDENTIALS_PARAM + " = " + allowedCredentialsConfig);
}
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
@ -176,23 +179,23 @@ public class CrossOriginFilter implements Filter
{
if (isSimpleRequest(request))
{
logger.debug("Cross-origin request to {} is a simple cross-origin request", request.getRequestURI());
LOG.debug("Cross-origin request to {} is a simple cross-origin request", request.getRequestURI());
handleSimpleResponse(request, response, origin);
}
else if (isPreflightRequest(request))
{
logger.debug("Cross-origin request to {} is a preflight cross-origin request", request.getRequestURI());
LOG.debug("Cross-origin request to {} is a preflight cross-origin request", request.getRequestURI());
handlePreflightResponse(request, response, origin);
}
else
{
logger.debug("Cross-origin request to {} is a non-simple cross-origin request", request.getRequestURI());
LOG.debug("Cross-origin request to {} is a non-simple cross-origin request", request.getRequestURI());
handleSimpleResponse(request, response, origin);
}
}
else
{
logger.debug("Cross-origin request to " + request.getRequestURI() + " with origin " + origin + " does not match allowed origins " + allowedOrigins);
LOG.debug("Cross-origin request to " + request.getRequestURI() + " with origin " + origin + " does not match allowed origins " + allowedOrigins);
}
}
@ -291,18 +294,18 @@ public class CrossOriginFilter implements Filter
private boolean isMethodAllowed(HttpServletRequest request)
{
String accessControlRequestMethod = request.getHeader(ACCESS_CONTROL_REQUEST_METHOD_HEADER);
logger.debug("{} is {}", ACCESS_CONTROL_REQUEST_METHOD_HEADER, accessControlRequestMethod);
LOG.debug("{} is {}", ACCESS_CONTROL_REQUEST_METHOD_HEADER, accessControlRequestMethod);
boolean result = false;
if (accessControlRequestMethod != null)
result = allowedMethods.contains(accessControlRequestMethod);
logger.debug("Method {} is" + (result ? "" : " not") + " among allowed methods {}", accessControlRequestMethod, allowedMethods);
LOG.debug("Method {} is" + (result ? "" : " not") + " among allowed methods {}", accessControlRequestMethod, allowedMethods);
return result;
}
private boolean areHeadersAllowed(HttpServletRequest request)
{
String accessControlRequestHeaders = request.getHeader(ACCESS_CONTROL_REQUEST_HEADERS_HEADER);
logger.debug("{} is {}", ACCESS_CONTROL_REQUEST_HEADERS_HEADER, accessControlRequestHeaders);
LOG.debug("{} is {}", ACCESS_CONTROL_REQUEST_HEADERS_HEADER, accessControlRequestHeaders);
boolean result = true;
if (accessControlRequestHeaders != null)
{
@ -325,7 +328,7 @@ public class CrossOriginFilter implements Filter
}
}
}
logger.debug("Headers [{}] are" + (result ? "" : " not") + " among allowed headers {}", accessControlRequestHeaders, allowedHeaders);
LOG.debug("Headers [{}] are" + (result ? "" : " not") + " among allowed headers {}", accessControlRequestHeaders, allowedHeaders);
return result;
}

View File

@ -188,7 +188,7 @@ public abstract class AbstractLifeCycle implements LifeCycle
private void setStopped()
{
_state = __STOPPED;
LOG.debug(STOPPED+" {}",this);
LOG.debug("{} {}",STOPPED,this);
for (Listener listener : _listeners)
listener.lifeCycleStopped(this);
}

View File

@ -144,7 +144,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
t=(T)o;
}
}
if (count>1)
if (count>1 && LOG.isDebugEnabled())
LOG.debug("getBean({}) 1 of {}",clazz.getName(),count);
return t;

View File

@ -56,28 +56,28 @@ public class Log
});
}
private static Logger __log;
private static Logger LOG;
private static boolean __initialized;
public static boolean initialized()
{
if (__log != null)
if (LOG != null)
return true;
synchronized (Log.class)
{
if (__initialized)
return __log != null;
return LOG != null;
__initialized = true;
}
try
{
Class<?> log_class = Loader.loadClass(Log.class, __logClass);
if (__log == null || !__log.getClass().equals(log_class))
if (LOG == null || !LOG.getClass().equals(log_class))
{
__log = (Logger)log_class.newInstance();
__log.debug("Logging to {} via {}", __log, log_class.getName());
LOG = (Logger)log_class.newInstance();
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
}
}
catch(Throwable e)
@ -88,7 +88,7 @@ public class Log
initStandardLogging(e);
}
return __log != null;
return LOG != null;
}
private static void initStandardLogging(Throwable e)
@ -96,17 +96,17 @@ public class Log
Class<?> log_class;
if(e != null && __ignored)
e.printStackTrace();
if (__log == null)
if (LOG == null)
{
log_class = StdErrLog.class;
__log = new StdErrLog();
__log.debug("Logging to {} via {}", __log, log_class.getName());
LOG = new StdErrLog();
LOG.debug("Logging to {} via {}", LOG, log_class.getName());
}
}
public static void setLog(Logger log)
{
Log.__log = log;
Log.LOG = log;
}
/**
@ -116,7 +116,7 @@ public class Log
public static Logger getLog()
{
initialized();
return __log;
return LOG;
}
/**
@ -125,7 +125,7 @@ public class Log
*/
public static Logger getRootLogger() {
initialized();
return __log;
return LOG;
}
static boolean isIgnored()
@ -179,7 +179,7 @@ public class Log
{
if (!isDebugEnabled())
return;
__log.debug(EXCEPTION, th);
LOG.debug(EXCEPTION, th);
}
/**
@ -190,7 +190,7 @@ public class Log
{
if (!initialized())
return;
__log.debug(msg);
LOG.debug(msg);
}
/**
@ -201,7 +201,7 @@ public class Log
{
if (!initialized())
return;
__log.debug(msg, arg);
LOG.debug(msg, arg);
}
/**
@ -212,7 +212,7 @@ public class Log
{
if (!initialized())
return;
__log.debug(msg, arg0, arg1);
LOG.debug(msg, arg0, arg1);
}
/**
@ -228,7 +228,7 @@ public class Log
{
if (!initialized())
return;
__log.ignore(thrown);
LOG.ignore(thrown);
}
/**
@ -239,7 +239,7 @@ public class Log
{
if (!initialized())
return;
__log.info(msg);
LOG.info(msg);
}
/**
@ -250,7 +250,7 @@ public class Log
{
if (!initialized())
return;
__log.info(msg, arg);
LOG.info(msg, arg);
}
/**
@ -261,7 +261,7 @@ public class Log
{
if (!initialized())
return;
__log.info(msg, arg0, arg1);
LOG.info(msg, arg0, arg1);
}
/**
@ -272,7 +272,7 @@ public class Log
{
if (!initialized())
return false;
return __log.isDebugEnabled();
return LOG.isDebugEnabled();
}
/**
@ -283,7 +283,7 @@ public class Log
{
if (!initialized())
return;
__log.warn(msg);
LOG.warn(msg);
}
/**
@ -294,7 +294,7 @@ public class Log
{
if (!initialized())
return;
__log.warn(msg, arg);
LOG.warn(msg, arg);
}
/**
@ -305,7 +305,7 @@ public class Log
{
if (!initialized())
return;
__log.warn(msg, arg0, arg1);
LOG.warn(msg, arg0, arg1);
}
/**
@ -316,7 +316,7 @@ public class Log
{
if (!initialized())
return;
__log.warn(msg, th);
LOG.warn(msg, th);
}
/**
@ -327,7 +327,7 @@ public class Log
{
if (!initialized())
return;
__log.warn(EXCEPTION, th);
LOG.warn(EXCEPTION, th);
}
/**
@ -352,6 +352,6 @@ public class Log
if (!initialized())
return null;
return name == null ? __log : __log.getLogger(name);
return name == null ? LOG : LOG.getLogger(name);
}
}

View File

@ -130,7 +130,8 @@ public class JarResource extends URLResource
if (!exists())
return;
if(LOG.isDebugEnabled())LOG.debug("Extract "+this+" to "+directory);
if(LOG.isDebugEnabled())
LOG.debug("Extract "+this+" to "+directory);
String urlString = this.getURL().toExternalForm().trim();
int endOfJarUrl = urlString.indexOf("!/");
@ -143,7 +144,8 @@ public class JarResource extends URLResource
String subEntryName = (endOfJarUrl+2 < urlString.length() ? urlString.substring(endOfJarUrl + 2) : null);
boolean subEntryIsDir = (subEntryName != null && subEntryName.endsWith("/")?true:false);
if (LOG.isDebugEnabled()) LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL);
if (LOG.isDebugEnabled())
LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL);
InputStream is = jarFileURL.openConnection().getInputStream();
JarInputStream jin = new JarInputStream(is);
@ -194,7 +196,8 @@ public class JarResource extends URLResource
if (!shouldExtract)
{
if (LOG.isDebugEnabled()) LOG.debug("Skipping entry: "+entryName);
if (LOG.isDebugEnabled())
LOG.debug("Skipping entry: "+entryName);
continue;
}
@ -202,7 +205,8 @@ public class JarResource extends URLResource
dotCheck = URIUtil.canonicalPath(dotCheck);
if (dotCheck == null)
{
if (LOG.isDebugEnabled()) LOG.debug("Invalid entry: "+entryName);
if (LOG.isDebugEnabled())
LOG.debug("Invalid entry: "+entryName);
continue;
}

View File

@ -4,11 +4,11 @@
// 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
// 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.
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.util.thread;
@ -28,9 +28,9 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/**
/**
* Jetty ThreadPool using java 5 ThreadPoolExecutor
* This class wraps a {@link ExecutorService} as a {@link ThreadPool} and
* This class wraps a {@link ExecutorService} as a {@link ThreadPool} and
* {@link LifeCycle} interfaces so that it may be used by the Jetty <code>org.eclipse.jetty.server.Server</code>
*/
public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool, LifeCycle
@ -41,67 +41,83 @@ public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool,
/* ------------------------------------------------------------ */
public ExecutorThreadPool(ExecutorService executor)
{
_executor=executor;
_executor = executor;
}
/* ------------------------------------------------------------ */
/** constructor.
/**
* Wraps an {@link ThreadPoolExecutor}.
* Core size is 32, max pool size is 256, pool thread timeout after 60 seconds and
* Max pool size is 256, pool thread timeout after 60 seconds and
* an unbounded {@link LinkedBlockingQueue} is used for the job queue;
*/
public ExecutorThreadPool()
{
this(new ThreadPoolExecutor(32,256,60,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>()));
// Using an unbounded queue makes the maxThreads parameter useless
// Refer to ThreadPoolExecutor javadocs for details
this(new ThreadPoolExecutor(256, 256, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()));
}
/* ------------------------------------------------------------ */
/** constructor.
/**
* Wraps an {@link ThreadPoolExecutor}.
* Core size is 32, max pool size is 256, pool thread timeout after 60 seconds
* @param queueSize if -1, an unbounded {@link LinkedBlockingQueue} is used, if 0 then a
* {@link SynchronousQueue} is used, other a {@link ArrayBlockingQueue} of the given size is used.
* Max pool size is 256, pool thread timeout after 60 seconds, and core pool size is 32 when queueSize >= 0.
* @param queueSize can be -1 for using an unbounded {@link LinkedBlockingQueue}, 0 for using a
* {@link SynchronousQueue}, greater than 0 for using a {@link ArrayBlockingQueue} of the given size.
*/
public ExecutorThreadPool(int queueSize)
{
this(new ThreadPoolExecutor(32,256,60,TimeUnit.SECONDS,
queueSize<0?new LinkedBlockingQueue<Runnable>()
: (queueSize==0?new SynchronousQueue<Runnable>()
:new ArrayBlockingQueue<Runnable>(queueSize))));
this(queueSize < 0 ? new ThreadPoolExecutor(256, 256, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()) :
queueSize == 0 ? new ThreadPoolExecutor(32, 256, 60, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()) :
new ThreadPoolExecutor(32, 256, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(queueSize)));
}
/* ------------------------------------------------------------ */
/** constructor.
/**
* Wraps an {@link ThreadPoolExecutor} using
* an unbounded {@link LinkedBlockingQueue} is used for the jobs queue;
* @param corePoolSize must be equal to maximumPoolSize
* @param maximumPoolSize the maximum number of threads to allow in the pool
* @param keepAliveTime the max time a thread can remain idle, in milliseconds
*/
public ExecutorThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime)
{
this(new ThreadPoolExecutor(corePoolSize,maximumPoolSize,keepAliveTime,TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>()));
this(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MILLISECONDS);
}
/* ------------------------------------------------------------ */
/** constructor.
/**
* Wraps an {@link ThreadPoolExecutor} using
* an unbounded {@link LinkedBlockingQueue} is used for the jobs queue;
* an unbounded {@link LinkedBlockingQueue} is used for the jobs queue.
* @param corePoolSize must be equal to maximumPoolSize
* @param maximumPoolSize the maximum number of threads to allow in the pool
* @param keepAliveTime the max time a thread can remain idle
* @param unit the unit for the keepAliveTime
*/
public ExecutorThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit)
{
this(new ThreadPoolExecutor(corePoolSize,maximumPoolSize,keepAliveTime,unit,new LinkedBlockingQueue<Runnable>()));
this(corePoolSize, maximumPoolSize, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>());
}
/* ------------------------------------------------------------ */
/**
* Wraps an {@link ThreadPoolExecutor}
* @param corePoolSize the number of threads to keep in the pool, even if they are idle
* @param maximumPoolSize the maximum number of threads to allow in the pool
* @param keepAliveTime the max time a thread can remain idle
* @param unit the unit for the keepAliveTime
* @param workQueue the queue to use for holding tasks before they are executed
*/
public ExecutorThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)
{
this(new ThreadPoolExecutor(corePoolSize,maximumPoolSize,keepAliveTime,unit,workQueue));
this(new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue));
}
/* ------------------------------------------------------------ */
public boolean dispatch(Runnable job)
{
try
{
{
_executor.execute(job);
return true;
}
@ -118,7 +134,7 @@ public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool,
if (_executor instanceof ThreadPoolExecutor)
{
final ThreadPoolExecutor tpe = (ThreadPoolExecutor)_executor;
return tpe.getPoolSize() -tpe.getActiveCount();
return tpe.getPoolSize() - tpe.getActiveCount();
}
return -1;
}
@ -139,8 +155,10 @@ public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool,
{
if (_executor instanceof ThreadPoolExecutor)
{
final ThreadPoolExecutor tpe = (ThreadPoolExecutor)_executor;
return tpe.getTaskCount()>=(tpe.getMaximumPoolSize());
final ThreadPoolExecutor tpe = (ThreadPoolExecutor)_executor;
// getActiveCount() locks the thread pool, so execute it last
return tpe.getPoolSize() == tpe.getMaximumPoolSize() &&
tpe.getQueue().size() >= tpe.getPoolSize() - tpe.getActiveCount();
}
return false;
}
@ -148,14 +166,7 @@ public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool,
/* ------------------------------------------------------------ */
public void join() throws InterruptedException
{
_executor.awaitTermination(Long.MAX_VALUE,TimeUnit.MILLISECONDS);
}
/* ------------------------------------------------------------ */
@Override
protected void doStart() throws Exception
{
super.doStart();
_executor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
/* ------------------------------------------------------------ */
@ -165,5 +176,4 @@ public class ExecutorThreadPool extends AbstractLifeCycle implements ThreadPool,
super.doStop();
_executor.shutdownNow();
}
}

View File

@ -122,7 +122,7 @@ public class ShutdownThread extends Thread
try
{
lifeCycle.stop();
LOG.debug("Stopped " + lifeCycle);
LOG.debug("Stopped {}",lifeCycle);
}
catch (Exception ex)
{

View File

@ -55,12 +55,11 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration
//cannot configure if the _context is already started
if (context.isStarted())
{
if (LOG.isDebugEnabled()){LOG.debug("Cannot configure webapp after it is started");}
LOG.debug("Cannot configure webapp after it is started");
return;
}
if(LOG.isDebugEnabled())
LOG.debug("Configuring web-jetty.xml");
LOG.debug("Configuring web-jetty.xml");
Resource web_inf = context.getWebInf();
// handle any WEB-INF descriptors
@ -80,9 +79,8 @@ public class JettyWebXmlConfiguration extends AbstractConfiguration
try
{
context.setServerClasses(null);
if(LOG.isDebugEnabled()) {
if(LOG.isDebugEnabled())
LOG.debug("Configure: "+jetty);
}
XmlConfiguration jetty_config = (XmlConfiguration)context.getAttribute(XML_CONFIGURATION);

View File

@ -153,7 +153,8 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
break;
}
}
if (LOG.isDebugEnabled()) LOG.debug("ContextParam: " + name + "=" + value);
if (LOG.isDebugEnabled())
LOG.debug("ContextParam: " + name + "=" + value);
}

View File

@ -437,7 +437,8 @@ public class TagLibConfiguration extends AbstractConfiguration
public void visitListener (WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
String className=node.getString("listener-class",false,true);
if (LOG.isDebugEnabled()) LOG.debug("listener="+className);
if (LOG.isDebugEnabled())
LOG.debug("listener="+className);
try
{

View File

@ -400,11 +400,11 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
if (LOG.isDebugEnabled())
{
ClassLoader loader = getClassLoader();
LOG.debug("Thread Context class loader is: " + loader);
LOG.debug("Thread Context classloader {}",loader);
loader=loader.getParent();
while(loader!=null)
{
LOG.debug("Parent class loader is: " + loader);
LOG.debug("Parent class loader: {} ",loader);
loader=loader.getParent();
}
}

View File

@ -198,7 +198,8 @@ public class WebDescriptor extends Descriptor
_metaDataComplete = Boolean.valueOf(s).booleanValue()?MetaDataComplete.True:MetaDataComplete.False;
}
LOG.debug(_xml.toString()+": Calculated metadatacomplete = " + _metaDataComplete + " with version=" + version);
if (LOG.isDebugEnabled())
LOG.debug(_xml.toString()+": Calculated metadatacomplete = " + _metaDataComplete + " with version=" + version);
}
public void processOrdering ()

View File

@ -125,7 +125,8 @@ public class WebInfConfiguration extends AbstractConfiguration
//cannot configure if the context is already started
if (context.isStarted())
{
if (LOG.isDebugEnabled()){LOG.debug("Cannot configure webapp "+context+" after it is started");}
if (LOG.isDebugEnabled())
LOG.debug("Cannot configure webapp "+context+" after it is started");
return;
}

View File

@ -81,7 +81,7 @@ public class WebXmlConfiguration extends AbstractConfiguration
// cannot configure if the context is already started
if (context.isStarted())
{
if (LOG.isDebugEnabled()) LOG.debug("Cannot configure webapp after it is started");
LOG.debug("Cannot configure webapp after it is started");
return;
}
@ -104,7 +104,8 @@ public class WebXmlConfiguration extends AbstractConfiguration
// do web.xml file
Resource web = web_inf.addPath("web.xml");
if (web.exists()) return web;
LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only");
if (LOG.isDebugEnabled())
LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only");
}
return null;
}