/** * Push messages with only one socket at a time * Wait for ack is needed and make auto retry when write message is failed. * After sending error close and reopen socket again. * * After successfull sending update stats * * WARNING: Subclasses must be very carefull that only one thread call this pushMessage at once!!! * * @see #closeSocket() * @see #openSocket() * @see #writeData(ChannelMessage) * * @param data * data to send * @since 5.5.10 */ protected void pushMessage(byte[] data, boolean reconnect, boolean waitForAck) throws IOException { keepalive(); if ( reconnect ) closeSocket(); if (!isConnected()) openSocket(); soOut.write(data); soOut.flush(); if (waitForAck) waitForAck(); SenderState.getSenderState(getDestination()).setReady(); }
/** * Push messages with only one socket at a time * Wait for ack is needed and make auto retry when write message is failed. * After sending error close and reopen socket again. * * After successful sending update stats * * WARNING: Subclasses must be very careful that only one thread call this pushMessage at once!!! * * @see #closeSocket() * @see #openSocket() * @see #sendMessage(byte[], boolean) * * @param data * data to send * @since 5.5.10 */ protected void pushMessage(byte[] data, boolean reconnect, boolean waitForAck) throws IOException { keepalive(); if ( reconnect ) closeSocket(); if (!isConnected()) openSocket(); soOut.write(data); soOut.flush(); if (waitForAck) waitForAck(); SenderState.getSenderState(getDestination()).setReady(); }
/** * Push messages with only one socket at a time * Wait for ack is needed and make auto retry when write message is failed. * After sending error close and reopen socket again. * * After successful sending update stats * * WARNING: Subclasses must be very careful that only one thread call this pushMessage at once!!! * * @see #closeSocket() * @see #openSocket() * @see #sendMessage(byte[], boolean) * * @param data * data to send * @since 5.5.10 */ protected void pushMessage(byte[] data, boolean reconnect, boolean waitForAck) throws IOException { keepalive(); if ( reconnect ) closeSocket(); if (!isConnected()) openSocket(); soOut.write(data); soOut.flush(); if (waitForAck) waitForAck(); SenderState.getSenderState(getDestination()).setReady(); }
/** * Push messages with only one socket at a time * Wait for ack is needed and make auto retry when write message is failed. * After sending error close and reopen socket again. * * After successful sending update stats * * WARNING: Subclasses must be very careful that only one thread call this pushMessage at once!!! * * @see #closeSocket() * @see #openSocket() * @see #sendMessage(byte[], boolean) * * @param data Data to send * @param reconnect Do a reconnect (close socket then reopen) * @param waitForAck Wait for an acknowledgement * @throws IOException IO error writing data * @since 5.5.10 */ protected void pushMessage(byte[] data, boolean reconnect, boolean waitForAck) throws IOException { keepalive(); if ( reconnect ) closeSocket(); if (!isConnected()) openSocket(); soOut.write(data); soOut.flush(); if (waitForAck) waitForAck(); SenderState.getSenderState(getDestination()).setReady(); }