Class HeartbeatingHttpStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class HeartbeatingHttpStream
    extends PersistentHttpStream
    An extension of PersistentHttpStream that allows for sending heartbeats to a secondary URL.
    • Constructor Detail

      • HeartbeatingHttpStream

        public HeartbeatingHttpStream​(HttpInterface httpInterface,
                                      java.net.URI contentUrl,
                                      java.lang.Long contentLength,
                                      java.lang.String heartbeatUrl,
                                      int heartbeatInterval,
                                      java.lang.String heartbeatPayload)
        Creates a new heartbeating http stream.
        Parameters:
        httpInterface - The HTTP interface to use for requests.
        contentUrl - The URL to play from.
        contentLength - The length of the content. Null if unknown.
        heartbeatUrl - The URL to send heartbeat requests to.
        heartbeatInterval - The interval at which to heartbeat, in milliseconds.
        heartbeatPayload - The initial heartbeat payload.
    • Method Detail

      • setupHeartbeat

        protected void setupHeartbeat()
      • sendHeartbeat

        protected void sendHeartbeat()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class PersistentHttpStream
        Throws:
        java.io.IOException