/** * Similar to configure(...) but this avoid adding in the MutexTransport and * ResponseCorrelator transport layers so that the resulting transport can * more efficiently be used as part of a composite transport. * * @param transport * @param format * @param options * @return */ @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { if (options.containsKey(WRITE_TIMEOUT_FILTER)) { transport = new WriteTimeoutFilter(transport); String soWriteTimeout = (String)options.remove(WRITE_TIMEOUT_FILTER); if (soWriteTimeout!=null) { ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); } } IntrospectionSupport.setProperties(transport, options); return transport; }
while (run && filters.hasNext()) { WriteTimeoutFilter filter = filters.next(); if (filter.getWriteTimeout()<=0) continue; //no timeout set long writeStart = filter.getWriter().getWriteTimestamp(); long delta = (filter.getWriter().isWriting() && writeStart>0)?System.currentTimeMillis() - writeStart:-1; if (delta>filter.getWriteTimeout()) { WriteTimeoutFilter.deRegisterWrite(filter, true,null); Thread.sleep(getSleep()); error = false; } catch (InterruptedException x) {
protected static boolean deRegisterWrite(WriteTimeoutFilter filter, boolean fail, IOException iox) { boolean result = writers.remove(filter); if (result) { if (fail) { String message = "Forced write timeout for:"+filter.getNext().getRemoteAddress(); LOG.warn(message); Socket sock = filter.getSocket(); if (sock==null) { LOG.error("Destination socket is null, unable to close socket.("+message+")"); } else { try { sock.close(); }catch (IOException ignore) { } } } } return result; }
@Override public void oneway(Object command) throws IOException { try { registerWrite(this); super.oneway(command); } catch (IOException x) { throw x; } finally { deRegisterWrite(this,false,null); } }
@Override public void oneway(Object command) throws IOException { try { registerWrite(this); super.oneway(command); } catch (IOException x) { throw x; } finally { deRegisterWrite(this,false,null); } }
while (run && filters.hasNext()) { WriteTimeoutFilter filter = filters.next(); if (filter.getWriteTimeout()<=0) continue; //no timeout set long writeStart = filter.getWriter().getWriteTimestamp(); long delta = (filter.getWriter().isWriting() && writeStart>0)?System.currentTimeMillis() - writeStart:-1; if (delta>filter.getWriteTimeout()) { WriteTimeoutFilter.deRegisterWrite(filter, true,null); Thread.sleep(getSleep()); error = false; } catch (InterruptedException x) {
@Override public void oneway(Object command) throws IOException { try { registerWrite(this); super.oneway(command); } catch (IOException x) { throw x; } finally { deRegisterWrite(this,false,null); } }
protected static boolean deRegisterWrite(WriteTimeoutFilter filter, boolean fail, IOException iox) { boolean result = writers.remove(filter); if (result) { if (fail) { String message = "Forced write timeout for:"+filter.getNext().getRemoteAddress(); LOG.warn(message); Socket sock = filter.getSocket(); if (sock==null) { LOG.error("Destination socket is null, unable to close socket.("+message+")"); } else { try { sock.close(); }catch (IOException ignore) { } } } } return result; }
/** * Similar to configure(...) but this avoid adding in the MutexTransport and * ResponseCorrelator transport layers so that the resulting transport can * more efficiently be used as part of a composite transport. * * @param transport * @param format * @param options * @return */ @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { if (options.containsKey(WRITE_TIMEOUT_FILTER)) { transport = new WriteTimeoutFilter(transport); String soWriteTimeout = (String)options.remove(WRITE_TIMEOUT_FILTER); if (soWriteTimeout!=null) { ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); } } IntrospectionSupport.setProperties(transport, options); return transport; }
while (run && filters.hasNext()) { WriteTimeoutFilter filter = filters.next(); if (filter.getWriteTimeout()<=0) continue; //no timeout set long writeStart = filter.getWriter().getWriteTimestamp(); long delta = (filter.getWriter().isWriting() && writeStart>0)?System.currentTimeMillis() - writeStart:-1; if (delta>filter.getWriteTimeout()) { WriteTimeoutFilter.deRegisterWrite(filter, true,null); Thread.sleep(getSleep()); error = false; } catch (InterruptedException x) {
@Override public void oneway(Object command) throws IOException { try { registerWrite(this); super.oneway(command); } catch (IOException x) { throw x; } finally { deRegisterWrite(this,false,null); } }
protected static boolean deRegisterWrite(WriteTimeoutFilter filter, boolean fail, IOException iox) { boolean result = writers.remove(filter); if (result) { if (fail) { String message = "Forced write timeout for:"+filter.getNext().getRemoteAddress(); LOG.warn(message); Socket sock = filter.getSocket(); if (sock==null) { LOG.error("Destination socket is null, unable to close socket.("+message+")"); } else { try { sock.close(); }catch (IOException ignore) { } } } } return result; }
/** * Similar to configure(...) but this avoid adding in the MutexTransport and * ResponseCorrelator transport layers so that the resulting transport can * more efficiently be used as part of a composite transport. * * @param transport * @param format * @param options * @return */ public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { if (options.containsKey(WRITE_TIMEOUT_FILTER)) { transport = new WriteTimeoutFilter(transport); String soWriteTimeout = (String)options.remove(WRITE_TIMEOUT_FILTER); if (soWriteTimeout!=null) { ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); } } IntrospectionSupport.setProperties(transport, options); return transport; }
while (run && filters.hasNext()) { WriteTimeoutFilter filter = filters.next(); if (filter.getWriteTimeout()<=0) continue; //no timeout set long writeStart = filter.getWriter().getWriteTimestamp(); long delta = (filter.getWriter().isWriting() && writeStart>0)?System.currentTimeMillis() - writeStart:-1; if (delta>filter.getWriteTimeout()) { WriteTimeoutFilter.deRegisterWrite(filter, true,null); Thread.sleep(getSleep()); error = false; } catch (InterruptedException x) {
@Override public void oneway(Object command) throws IOException { try { registerWrite(this); super.oneway(command); } catch (IOException x) { throw x; } finally { deRegisterWrite(this,false,null); } }
protected static boolean deRegisterWrite(WriteTimeoutFilter filter, boolean fail, IOException iox) { boolean result = writers.remove(filter); if (result) { if (fail) { String message = "Forced write timeout for:"+filter.getNext().getRemoteAddress(); LOG.warn(message); Socket sock = filter.getSocket(); if (sock==null) { LOG.error("Destination socket is null, unable to close socket.("+message+")"); } else { try { sock.close(); }catch (IOException ignore) { } } } } return result; }
/** * Similar to configure(...) but this avoid adding in the MutexTransport and * ResponseCorrelator transport layers so that the resulting transport can * more efficiently be used as part of a composite transport. * * @param transport * @param format * @param options * @return */ @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { if (options.containsKey(WRITE_TIMEOUT_FILTER)) { transport = new WriteTimeoutFilter(transport); String soWriteTimeout = (String)options.remove(WRITE_TIMEOUT_FILTER); if (soWriteTimeout!=null) { ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); } } IntrospectionSupport.setProperties(transport, options); return transport; }
while (run && filters.hasNext()) { WriteTimeoutFilter filter = filters.next(); if (filter.getWriteTimeout()<=0) continue; //no timeout set long writeStart = filter.getWriter().getWriteTimestamp(); long delta = (filter.getWriter().isWriting() && writeStart>0)?System.currentTimeMillis() - writeStart:-1; if (delta>filter.getWriteTimeout()) { WriteTimeoutFilter.deRegisterWrite(filter, true,null); Thread.sleep(getSleep()); error = false; } catch (InterruptedException x) {
protected static boolean deRegisterWrite(WriteTimeoutFilter filter, boolean fail, IOException iox) { boolean result = writers.remove(filter); if (result) { if (fail) { String message = "Forced write timeout for:"+filter.getNext().getRemoteAddress(); LOG.warn(message); Socket sock = filter.getSocket(); if (sock==null) { LOG.error("Destination socket is null, unable to close socket.("+message+")"); } else { try { sock.close(); }catch (IOException ignore) { } } } } return result; }
/** * Similar to configure(...) but this avoid adding in the MutexTransport and * ResponseCorrelator transport layers so that the resulting transport can * more efficiently be used as part of a composite transport. * * @param transport * @param format * @param options * @return */ @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { if (options.containsKey(WRITE_TIMEOUT_FILTER)) { transport = new WriteTimeoutFilter(transport); String soWriteTimeout = (String)options.remove(WRITE_TIMEOUT_FILTER); if (soWriteTimeout!=null) { ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); } } IntrospectionSupport.setProperties(transport, options); return transport; }