mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-26 09:34:56 +00:00
441475 org.eclipse.jetty.server.ResourceCache exceptions under high load
This commit is contained in:
parent
1a0eb64a1f
commit
8ce96cdd2e
@ -92,7 +92,7 @@ public class JarResource extends URLResource
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Returns true if the respresenetd resource exists.
|
||||
* Returns true if the represented resource exists.
|
||||
*/
|
||||
@Override
|
||||
public boolean exists()
|
||||
@ -118,7 +118,7 @@ public class JarResource extends URLResource
|
||||
{
|
||||
checkConnection();
|
||||
if (!_urlString.endsWith("!/"))
|
||||
return new FilterInputStream(super.getInputStream())
|
||||
return new FilterInputStream(getInputStream(false))
|
||||
{
|
||||
@Override
|
||||
public void close() throws IOException {this.in=IO.getClosedStream();}
|
||||
@ -129,6 +129,9 @@ public class JarResource extends URLResource
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void copyTo(File directory)
|
||||
|
@ -197,13 +197,33 @@ public class URLResource extends Resource
|
||||
return _url.toExternalForm();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Returns an input stream to the resource
|
||||
* Returns an input stream to the resource. The underlying
|
||||
* url connection will be nulled out to prevent re-use.
|
||||
*/
|
||||
@Override
|
||||
public synchronized InputStream getInputStream()
|
||||
throws java.io.IOException
|
||||
{
|
||||
return getInputStream (true); //backwards compatibility
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Returns an input stream to the resource, optionally nulling
|
||||
* out the underlying url connection. If the connection is not
|
||||
* nulled out, a subsequent call to getInputStream() may return
|
||||
* an existing and already in-use input stream - this depends on
|
||||
* the url protocol. Eg JarURLConnection does not reuse inputstreams.
|
||||
*
|
||||
* @param resetConnection if true the connection field is set to null
|
||||
*/
|
||||
protected synchronized InputStream getInputStream(boolean resetConnection)
|
||||
throws java.io.IOException
|
||||
{
|
||||
if (!checkConnection())
|
||||
throw new IOException( "Invalid resource");
|
||||
@ -220,7 +240,11 @@ public class URLResource extends Resource
|
||||
}
|
||||
finally
|
||||
{
|
||||
_connection=null;
|
||||
if (resetConnection)
|
||||
{
|
||||
_connection=null;
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Connection nulled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user