Class Link

  • Direct Known Subclasses:
    LinkSsl, LinkTcp

    public abstract class Link
    extends java.lang.Object
    • Constructor Detail

      • Link

        public Link()
    • Method Detail

      • create

        public static Link create​(javax.jms.Connection connection,
                                  SSLInfo sslinfo)
                           throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • checkConnect

        public static void checkConnect​(BrokerURL url)
                                 throws javax.jms.JMSException
        Check if we should attempt to connect to the provided host. If no, then throw the error quickly, instead of blocking on a socket call for several seconds/minutes.
        Parameters:
        url - Broker URL which must at least have host name and port.
        Throws:
        javax.jms.JMSException
      • addFailingBrokerHost

        public static void addFailingBrokerHost​(BrokerURL url,
                                                long expireTime,
                                                javax.jms.JMSException exception)
        Update the failing brokers list with expire time and exception as values.
        Parameters:
        url - Broker URL which must at least have host name and port.
        Throws:
        javax.jms.JMSException
      • connect

        public abstract void connect​(BrokerURL url)
                              throws javax.jms.JMSException
        Create the physical connection to the Broker.
        Parameters:
        url - the URL of the Broker
        Throws:
        javax.jms.JMSException - if a connection could not be established
      • disconnect

        public abstract void disconnect()
                                 throws javax.jms.JMSException
        Close the physical connection to the Broker.
        Throws:
        javax.jms.JMSException - if errors occur closing the connection
      • destroy

        public abstract void destroy()
                              throws javax.jms.JMSException
        Cleanup any resources associated with the connection to the Broker.
        Throws:
        javax.jms.JMSException - if errors occur destroying the connection
      • recv

        public abstract int recv​(byte[] buf,
                                 int offset,
                                 int length)
                          throws javax.jms.JMSException,
                                 java.io.IOException
        Reads bytes from the link into the specified byte array, starting at the given offset.
        Parameters:
        buf - destination buffer.
        offset - offset at which to start storing bytes
        length - maximum number of bytes to read
        Returns:
        the number of bytes read, or -1 if the end of the stream has been reached.
        Throws:
        javax.jms.JMSException - if an error occurs reading from the link
        java.io.IOException
      • send

        public abstract void send​(byte[] data,
                                  int offset,
                                  int length)
                           throws javax.jms.JMSException,
                                  java.io.IOException
        Writes length bytes from the specified byte array starting at offset to the link.
        Parameters:
        data - the command data
        offset - the start offset in the data
        length - the number of bytes to write
        Throws:
        javax.jms.JMSException - if an error occurs writing data to the link
        java.io.IOException
      • flush

        public abstract void flush()
                            throws javax.jms.JMSException,
                                   java.io.IOException
        Flushes any data in the output buffer to the socket.
        Throws:
        javax.jms.JMSException - if an error occurs flushing data to the socket
        java.io.IOException
      • getEncryptionLevel

        public abstract int getEncryptionLevel()
                                        throws javax.jms.JMSException
        Returns the encryption level of the link.
        Returns:
        the encryption level
        Throws:
        javax.jms.JMSException - if an error occurs getting the encryption level
      • getServerCertificate

        public abstract java.util.Properties getServerCertificate()
                                                           throws javax.jms.JMSException
        Returns properties of the server certificate. The included property names are: "subjectDn", "issuerDn", "status" "serialNumber", "beginDate", "endDate".
        Returns:
        server certificate properties
        Throws:
        javax.jms.JMSException - if an error occurs getting the server certificate
      • applyJMSConfigParams

        protected void applyJMSConfigParams​(java.net.Socket socket)
                                     throws java.net.SocketException
        Throws:
        java.net.SocketException