Package jadex.commons

Class HttpConnectionManager


  • public class HttpConnectionManager
    extends java.lang.Object
    The connection manager allows asynchronously terminating open connections to avoid hanging on e.g. platform shutdown.
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpConnectionManager()
      Create a new connection manager.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeConnection​(java.net.HttpURLConnection con)
      Close a connection
      void dispose()
      Dispose the connection manager and close all open connections.
      java.net.HttpURLConnection openConnection​(java.lang.String address)
      Open a receiving connection.
      void remove​(java.net.HttpURLConnection con)
      Remove a connection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HttpConnectionManager

        public HttpConnectionManager()
        Create a new connection manager.
    • Method Detail

      • dispose

        public void dispose()
        Dispose the connection manager and close all open connections.
      • openConnection

        public java.net.HttpURLConnection openConnection​(java.lang.String address)
                                                  throws java.io.IOException
        Open a receiving connection. The connection should be removed when it is closed to avoid memory leaks.
        Parameters:
        address - The address to connect to.
        Returns:
        The connection.
        Throws:
        java.io.IOException - on connection failures
      • remove

        public void remove​(java.net.HttpURLConnection con)
        Remove a connection.
        Parameters:
        con - The previously opened connection.
      • closeConnection

        public static void closeConnection​(java.net.HttpURLConnection con)
        Close a connection