jsky.util
Class ConnectionUtil

java.lang.Object
  extended by jsky.util.ConnectionUtil

public class ConnectionUtil
extends Object

A utility class for getting a URL connection in a background thread without hanging. Used to solve the problem of a background thread hanging (even after calling Thread.interrupt()) while waiting for URL.openConnection() to return.

Version:
$Revision: 1.5 $
Author:
Allan Brighton

Constructor Summary
ConnectionUtil(URL url)
          Initialize with the given URL
 
Method Summary
 void interrupt()
          Interrupt the connection
 URLConnection openConnection()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionUtil

public ConnectionUtil(URL url)
Initialize with the given URL

Method Detail

openConnection

public URLConnection openConnection()
                             throws IOException
Throws:
IOException

interrupt

public void interrupt()
Interrupt the connection



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.