@Override public boolean keepalive() { boolean result = false; for (Iterator<Entry<Member,NioSender>> i = nioSenders.entrySet().iterator(); i.hasNext();) { Map.Entry<Member, NioSender> entry = i.next(); NioSender sender = entry.getValue(); if ( sender.keepalive() ) { //nioSenders.remove(entry.getKey()); i.remove(); result = true; } else { try { sender.read(); }catch ( IOException x ) { sender.disconnect(); sender.reset(); //nioSenders.remove(entry.getKey()); i.remove(); result = true; }catch ( Exception x ) { log.warn("Error during keepalive test for sender:"+sender,x); } } } //clean up any cancelled keys if ( result ) try { selector.selectNow(); }catch (Exception e){/*Ignore*/} return result; } }
public boolean keepalive() { boolean result = false; for ( Iterator i = nioSenders.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry)i.next(); NioSender sender = (NioSender)entry.getValue(); if ( sender.keepalive() ) { //nioSenders.remove(entry.getKey()); i.remove(); result = true; } else { try { sender.read(null); }catch ( IOException x ) { sender.disconnect(); sender.reset(); //nioSenders.remove(entry.getKey()); i.remove(); result = true; }catch ( Exception x ) { log.warn("Error during keepalive test for sender:"+sender,x); } } } //clean up any cancelled keys if ( result ) try { selector.selectNow(); }catch (Exception ignore){} return result; }
@Override public boolean keepalive() { boolean result = false; for ( Iterator<Entry<Member, NioSender>> i = nioSenders.entrySet().iterator(); i.hasNext();) { Map.Entry<Member, NioSender> entry = i.next(); NioSender sender = entry.getValue(); if ( sender.keepalive() ) { //nioSenders.remove(entry.getKey()); i.remove(); result = true; } else { try { sender.read(null); }catch ( IOException x ) { sender.disconnect(); sender.reset(); //nioSenders.remove(entry.getKey()); i.remove(); result = true; }catch ( Exception x ) { log.warn("Error during keepalive test for sender:"+sender,x); } } } //clean up any cancelled keys if ( result ) try { selector.selectNow(); }catch (Exception e){/*Ignore*/} return result; }
@Override public boolean keepalive() { boolean result = false; for (Iterator<Entry<Member,NioSender>> i = nioSenders.entrySet().iterator(); i.hasNext();) { Map.Entry<Member, NioSender> entry = i.next(); NioSender sender = entry.getValue(); if ( sender.keepalive() ) { //nioSenders.remove(entry.getKey()); i.remove(); result = true; } else { try { sender.read(); }catch ( IOException x ) { sender.disconnect(); sender.reset(); //nioSenders.remove(entry.getKey()); i.remove(); result = true; }catch ( Exception x ) { log.warn(sm.getString("parallelNioSender.error.keepalive", sender),x); } } } //clean up any cancelled keys if ( result ) try { selector.selectNow(); }catch (Exception e){/*Ignore*/} return result; } }
private NioSender[] setupForSend(Member[] destination) throws ChannelException { ChannelException cx = null; NioSender[] result = new NioSender[destination.length]; for ( int i=0; i<destination.length; i++ ) { NioSender sender = (NioSender)nioSenders.get(destination[i]); try { if (sender == null) { sender = new NioSender(); sender.transferProperties(this, sender); nioSenders.put(destination[i], sender); } if (sender != null) { sender.reset(); sender.setDestination(destination[i]); sender.setSelector(selector); result[i] = sender; } }catch ( UnknownHostException x ) { if (cx == null) cx = new ChannelException("Unable to setup NioSender.", x); cx.addFaultyMember(destination[i], x); } } if ( cx != null ) throw cx; else return result; }
private NioSender[] setupForSend(Member[] destination) throws ChannelException { ChannelException cx = null; NioSender[] result = new NioSender[destination.length]; for ( int i=0; i<destination.length; i++ ) { NioSender sender = nioSenders.get(destination[i]); try { if (sender == null) { sender = new NioSender(); AbstractSender.transferProperties(this, sender); nioSenders.put(destination[i], sender); } sender.reset(); sender.setDestination(destination[i]); sender.setSelector(selector); sender.setUdpBased(isUdpBased()); result[i] = sender; }catch ( UnknownHostException x ) { if (cx == null) cx = new ChannelException("Unable to setup NioSender.", x); cx.addFaultyMember(destination[i], x); } } if ( cx != null ) throw cx; else return result; }
private NioSender[] setupForSend(Member[] destination) throws ChannelException { ChannelException cx = null; NioSender[] result = new NioSender[destination.length]; for ( int i=0; i<destination.length; i++ ) { NioSender sender = nioSenders.get(destination[i]); try { if (sender == null) { sender = new NioSender(); AbstractSender.transferProperties(this, sender); nioSenders.put(destination[i], sender); } sender.reset(); sender.setDestination(destination[i]); sender.setSelector(selector); sender.setUdpBased(isUdpBased()); result[i] = sender; }catch ( UnknownHostException x ) { if (cx == null) cx = new ChannelException("Unable to setup NioSender.", x); cx.addFaultyMember(destination[i], x); } } if ( cx != null ) throw cx; else return result; }
private NioSender[] setupForSend(Member[] destination) throws ChannelException { ChannelException cx = null; NioSender[] result = new NioSender[destination.length]; for ( int i=0; i<destination.length; i++ ) { NioSender sender = nioSenders.get(destination[i]); try { if (sender == null) { sender = new NioSender(); AbstractSender.transferProperties(this, sender); nioSenders.put(destination[i], sender); } sender.reset(); sender.setDestination(destination[i]); sender.setSelector(selector); sender.setUdpBased(isUdpBased()); result[i] = sender; }catch ( UnknownHostException x ) { if (cx == null) cx = new ChannelException(sm.getString("parallelNioSender.unable.setup.NioSender"), x); cx.addFaultyMember(destination[i], x); } } if ( cx != null ) throw cx; else return result; }