if ( SenderState.getSenderState(getDestination()).isReady() ) { SenderState.getSenderState(getDestination()).setSuspect(); if ( log.isWarnEnabled() ) log.warn(errmsg, x); } else {
if ( SenderState.getSenderState(getDestination()).isReady() ) { SenderState.getSenderState(getDestination()).setSuspect(); if ( log.isWarnEnabled() ) log.warn(errmsg, x); } else {
log.debug(sm.getString("IDataSender.openSocket", getAddress().getHostAddress(), new Integer(getPort()), new Long(0))); } catch (IOException ex1) { SenderState.getSenderState(getDestination()).setSuspect(); if (log.isDebugEnabled()) log.debug(sm.getString("IDataSender.openSocket.failure",getAddress().getHostAddress(), new Integer(getPort()),new Long(0)), ex1);
/** * 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(); }
log.debug(sm.getString("IDataSender.openSocket", getAddress().getHostAddress(), new Integer(getPort()), new Long(0))); } catch (IOException ex1) { SenderState.getSenderState(getDestination()).setSuspect(); if (log.isDebugEnabled()) log.debug(sm.getString("IDataSender.openSocket.failure",getAddress().getHostAddress(), new Integer(getPort()),new Long(0)), ex1);
if ( SenderState.getSenderState(getDestination()).isReady() ) { SenderState.getSenderState(getDestination()).setSuspect(); if ( log.isWarnEnabled() ) log.warn(errmsg, x); } else {
log.debug(sm.getString("bioSender.openSocket", getAddress().getHostAddress(), Integer.valueOf(getPort()), Long.valueOf(0))); } catch (IOException ex1) { SenderState.getSenderState(getDestination()).setSuspect(); if (log.isDebugEnabled()) log.debug(sm.getString("bioSender.openSocket.failure",getAddress().getHostAddress(), Integer.valueOf(getPort()), Long.valueOf(0)), ex1);
/** * 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(); }
if ( SenderState.getSenderState(getDestination()).isReady() ) { SenderState.getSenderState(getDestination()).setSuspect(); if ( log.isWarnEnabled() ) log.warn(errmsg, x); } else {
log.debug(sm.getString("IDataSender.openSocket", getAddress().getHostAddress(), new Integer(getPort()), new Long(0))); } catch (IOException ex1) { SenderState.getSenderState(getDestination()).setSuspect(); if (log.isDebugEnabled()) log.debug(sm.getString("IDataSender.openSocket.failure",getAddress().getHostAddress(), new Integer(getPort()),new Long(0)), ex1);
/** * 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; } }
SenderState.getSenderState(getDestination()).setSuspect(); exception = x; if (log.isTraceEnabled()) log.trace(sm.getString("bioSender.send.again", getAddress().getHostAddress(),Integer.valueOf(getPort())),x);
/** * 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; } }
SenderState.getSenderState(getDestination()).setSuspect(); exception = x; if (log.isTraceEnabled()) log.trace(sm.getString("IDataSender.send.again", getAddress().getHostAddress(),new Integer(getPort())),x);