/** * disconnect and close socket * * @see org.apache.catalina.tribes.transport.DataSender#disconnect() */ @Override public void disconnect() { boolean connect = isConnected(); closeSocket(); if (connect) { if (log.isDebugEnabled()) log.debug(sm.getString("IDataSender.disconnect", getAddress().getHostAddress(), new Integer(getPort()), new Long(0))); } }
/** * disconnect and close socket * * @see IDataSender#disconnect() */ public void disconnect() { boolean connect = isConnected(); closeSocket(); if (connect) { if (log.isDebugEnabled()) log.debug(sm.getString("IDataSender.disconnect", getAddress().getHostAddress(), new Integer(getPort()), new Long(0))); } }
/** * disconnect and close socket * * @see org.apache.catalina.tribes.transport.DataSender#disconnect() */ @Override public void disconnect() { boolean connect = isConnected(); closeSocket(); if (connect) { if (log.isDebugEnabled()) log.debug(sm.getString("IDataSender.disconnect", getAddress().getHostAddress(), new Integer(getPort()), new Long(0))); } }
/** * disconnect and close socket * * @see org.apache.catalina.tribes.transport.DataSender#disconnect() */ @Override public void disconnect() { boolean connect = isConnected(); closeSocket(); if (connect) { if (log.isDebugEnabled()) log.debug(sm.getString("bioSender.disconnect", getAddress().getHostAddress(), Integer.valueOf(getPort()), Long.valueOf(0))); } }
/** * 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 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 * @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(); }
/** * Send message. */ public void sendMessage(byte[] data, boolean waitForAck) throws IOException { IOException exception = null; setAttempt(0); try { // first try with existing connection pushMessage(data,false,waitForAck); } catch (IOException x) { SenderState.getSenderState(getDestination()).setSuspect(); exception = x; if (log.isTraceEnabled()) log.trace(sm.getString("IDataSender.send.again", getAddress().getHostAddress(),new Integer(getPort())),x); while ( getAttempt()<getMaxRetryAttempts() ) { try { setAttempt(getAttempt()+1); // second try with fresh connection pushMessage(data, true,waitForAck); exception = null; } catch (IOException xx) { exception = xx; closeSocket(); } } } finally { setRequestCount(getRequestCount()+1); keepalive(); if ( exception != null ) throw exception; } }
} catch (IOException xx) { exception = xx; closeSocket();
/** * Send message. */ public void sendMessage(byte[] data, boolean waitForAck) throws IOException { IOException exception = null; setAttempt(0); try { // first try with existing connection pushMessage(data,false,waitForAck); } catch (IOException x) { SenderState.getSenderState(getDestination()).setSuspect(); exception = x; if (log.isTraceEnabled()) log.trace(sm.getString("IDataSender.send.again", getAddress().getHostAddress(),new Integer(getPort())),x); while ( getAttempt()<getMaxRetryAttempts() ) { try { setAttempt(getAttempt()+1); // second try with fresh connection pushMessage(data, true,waitForAck); exception = null; } catch (IOException xx) { exception = xx; closeSocket(); } } } finally { setRequestCount(getRequestCount()+1); keepalive(); if ( exception != null ) throw exception; } }
} catch (IOException xx) { exception = xx; closeSocket();