What do you expect to happen?  A thread can only do one thing at a time, 
that's pretty much the definition of a thread.

   You've sent an interrupt to a thread which is awaiting data on a socket 
channel.  Because you sent an interrupt, it stopped waiting and threw an 
exception to tell you that it was interrupted, as documented.

   If you want to tell a thread to stop at the next point where it's convenient 
to stop, then you need to define what that means.  As Mike suggests, a flag 
that can be checked each time around a loop would be a less drastic approach.  
But beware the memory coherence issues in a multi-core JVM - always declare 
mutable variables shared by threads as "volatile".

--
Ron Hitchens, [email protected]/[email protected]

On Sep 11, 2013, at 4:06 PM, "Gary Larsen" <[email protected]> wrote:

> Hi,
>  
> In a Java application I’m using an interrupt to signal a long running thread 
> that it’s time to quit.  This interrupt immediately affects MarkLogic calls 
> in the thread:
> 
> com.marklogic.xcc.exceptions.ServerConnectionException
> [Session: user=Admin, cb=NetVisn-6.5-C1021 [ContentSource: user=Admin, 
> cb=NetVisn-6.5-C1021 [provider: address=neptune/192.168.1.91:8046, 
> pool=0/64]]]
> [Client: XCC/5.0-4]
> …
> Caused by: java.nio.channels.ClosedByInterruptException
>                 at 
> java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
>                 at 
> sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:511)
>                 at 
> java.nio.channels.SocketChannel.open(SocketChannel.java:146)
>                 at 
> com.marklogic.xcc.impl.SocketPoolProvider.obtainConnection(SocketPoolProvider.java:93)
>  
> Is it possible to turn off this feature?  Thanks,
>  
> Gary
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to