347898 Close channel on JVM exceptions
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3374 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
71ce6291d2
commit
e55c21ca5c
|
@ -1,6 +1,7 @@
|
||||||
jetty-7.4.3-SNAPSHOT
|
jetty-7.4.3-SNAPSHOT
|
||||||
+ 347617 Dynamically install/update/remove OSGi bundles discovered in the contexts folder
|
+ 347617 Dynamically install/update/remove OSGi bundles discovered in the contexts folder
|
||||||
+ 347717 start.jar destroys dependent child of --exec
|
+ 347717 start.jar destroys dependent child of --exec
|
||||||
|
+ 347898 Close channel on JVM exceptions
|
||||||
+ JETTY-1342 Recreate selector in change task
|
+ JETTY-1342 Recreate selector in change task
|
||||||
+ 347889 OSGi should follow directive visibility:=reexport for META-INF/web-fragments and resources
|
+ 347889 OSGi should follow directive visibility:=reexport for META-INF/web-fragments and resources
|
||||||
|
|
||||||
|
|
|
@ -445,6 +445,10 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
else
|
else
|
||||||
throw new IllegalArgumentException(change.toString());
|
throw new IllegalArgumentException(change.toString());
|
||||||
}
|
}
|
||||||
|
catch (CancelledKeyException e)
|
||||||
|
{
|
||||||
|
Log.ignore(e);
|
||||||
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
if (e instanceof ThreadDeath)
|
if (e instanceof ThreadDeath)
|
||||||
|
@ -454,17 +458,14 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
Log.warn(e);
|
Log.warn(e);
|
||||||
else
|
else
|
||||||
Log.debug(e);
|
Log.debug(e);
|
||||||
|
|
||||||
if(ch!=null && key==null)
|
try
|
||||||
{
|
{
|
||||||
try
|
ch.close();
|
||||||
{
|
}
|
||||||
ch.close();
|
catch(IOException e2)
|
||||||
}
|
{
|
||||||
catch(IOException e2)
|
Log.debug(e2);
|
||||||
{
|
|
||||||
Log.debug(e2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,6 +523,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
// Look for things to do
|
// Look for things to do
|
||||||
for (SelectionKey key: selector.selectedKeys())
|
for (SelectionKey key: selector.selectedKeys())
|
||||||
{
|
{
|
||||||
|
SocketChannel channel=null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!key.isValid())
|
if (!key.isValid())
|
||||||
|
@ -542,7 +545,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
else if (key.isConnectable())
|
else if (key.isConnectable())
|
||||||
{
|
{
|
||||||
// Complete a connection of a registered channel
|
// Complete a connection of a registered channel
|
||||||
SocketChannel channel = (SocketChannel)key.channel();
|
channel = (SocketChannel)key.channel();
|
||||||
boolean connected=false;
|
boolean connected=false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -570,7 +573,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Wrap readable registered channel in an endpoint
|
// Wrap readable registered channel in an endpoint
|
||||||
SocketChannel channel = (SocketChannel)key.channel();
|
channel = (SocketChannel)key.channel();
|
||||||
SelectChannelEndPoint endpoint = createEndPoint(channel,key);
|
SelectChannelEndPoint endpoint = createEndPoint(channel,key);
|
||||||
key.attach(endpoint);
|
key.attach(endpoint);
|
||||||
if (key.isReadable())
|
if (key.isReadable())
|
||||||
|
@ -589,6 +592,16 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||||
else
|
else
|
||||||
Log.ignore(e);
|
Log.ignore(e);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (channel!=null)
|
||||||
|
channel.close();
|
||||||
|
}
|
||||||
|
catch(IOException e2)
|
||||||
|
{
|
||||||
|
Log.debug(e2);
|
||||||
|
}
|
||||||
|
|
||||||
if (key != null && !(key.channel() instanceof ServerSocketChannel) && key.isValid())
|
if (key != null && !(key.channel() instanceof ServerSocketChannel) && key.isValid())
|
||||||
key.cancel();
|
key.cancel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,28 +564,19 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements
|
||||||
*/
|
*/
|
||||||
protected SSLEngine createSSLEngine(SocketChannel channel) throws IOException
|
protected SSLEngine createSSLEngine(SocketChannel channel) throws IOException
|
||||||
{
|
{
|
||||||
try
|
SSLEngine engine;
|
||||||
|
if (channel != null && _sslContextFactory.isSessionCachingEnabled())
|
||||||
{
|
{
|
||||||
SSLEngine engine;
|
String peerHost = channel.socket().getInetAddress().getHostAddress();
|
||||||
if (channel != null && _sslContextFactory.isSessionCachingEnabled())
|
int peerPort = channel.socket().getPort();
|
||||||
{
|
engine = _sslContextFactory.getSslContext().createSSLEngine(peerHost, peerPort);
|
||||||
String peerHost = channel.socket().getInetAddress().getHostAddress();
|
|
||||||
int peerPort = channel.socket().getPort();
|
|
||||||
engine = _sslContextFactory.getSslContext().createSSLEngine(peerHost, peerPort);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
engine = _sslContextFactory.getSslContext().createSSLEngine();
|
|
||||||
}
|
|
||||||
customizeEngine(engine);
|
|
||||||
return engine;
|
|
||||||
}
|
}
|
||||||
catch (Exception x)
|
else
|
||||||
{
|
{
|
||||||
Log.warn("Error creating SSLEngine -- closing this connector", x);
|
engine = _sslContextFactory.getSslContext().createSSLEngine();
|
||||||
close();
|
|
||||||
throw new IllegalStateException(x);
|
|
||||||
}
|
}
|
||||||
|
customizeEngine(engine);
|
||||||
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
Loading…
Reference in New Issue