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; }
protected BioSender[] setupForSend(Member[] destination) throws ChannelException { ChannelException cx = null; BioSender[] result = new BioSender[destination.length]; for ( int i=0; i<destination.length; i++ ) { try { BioSender sender = bioSenders.get(destination[i]); if (sender == null) { sender = new BioSender(); AbstractSender.transferProperties(this,sender); sender.setDestination(destination[i]); bioSenders.put(destination[i], sender); } result[i] = sender; if (!result[i].isConnected() ) result[i].connect(); result[i].keepalive(); }catch (Exception x ) { if ( cx== null ) cx = new ChannelException(x); cx.addFaultyMember(destination[i],x); } } if ( cx!=null ) throw cx; else return result; }
@Override public DataSender getNewDataSender() { try { ParallelNioSender sender = new ParallelNioSender(); AbstractSender.transferProperties(this,sender); return sender; } catch ( IOException x ) { throw new RuntimeException("Unable to open NIO selector.",x); } }
@Test public void testSingleDataSendNO_ACK() throws Exception { AbstractSender s1 =(AbstractSender) ((ReplicationTransmitter)channel1.getChannelSender()).getTransport(); AbstractSender s2 =(AbstractSender) ((ReplicationTransmitter)channel2.getChannelSender()).getTransport(); s1.setTimeout(Long.MAX_VALUE); //for debugging s2.setTimeout(Long.MAX_VALUE); //for debugging System.err.println("Starting Single package NO_ACK"); channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(1024),Channel.SEND_OPTIONS_MULTICAST); Thread.sleep(500); System.err.println("Finished Single package NO_ACK ["+listener1.count+"]"); assertEquals("Checking success messages.",1,listener1.count.get()); }
@Test public void testSingleDataSendNO_ACK() throws Exception { AbstractSender s1 =(AbstractSender) ((ReplicationTransmitter)channel1.getChannelSender()).getTransport(); AbstractSender s2 =(AbstractSender) ((ReplicationTransmitter)channel2.getChannelSender()).getTransport(); s1.setTimeout(Long.MAX_VALUE); //for debugging s2.setTimeout(Long.MAX_VALUE); //for debugging System.err.println("Starting Single package NO_ACK"); channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(1024),Channel.SEND_OPTIONS_UDP); Thread.sleep(500); System.err.println("Finished Single package NO_ACK ["+listener1.count+"]"); assertEquals("Checking success messages.",1,listener1.count.get()); }
@Override public DataSender getNewDataSender() { try { ParallelNioSender sender = new ParallelNioSender(); AbstractSender.transferProperties(this, sender); return sender; } catch (IOException x) { throw new RuntimeException("Unable to open NIO selector.", x); } }
/** * getNewDataSender * * @return DataSender TODO Implement this * org.apache.catalina.tribes.transport.PooledSender method */ @Override public DataSender getNewDataSender() { MultipointBioSender sender = new MultipointBioSender(); AbstractSender.transferProperties(this, sender); return sender; }
/** * getNewDataSender * * @return DataSender * TODO Implement this org.apache.catalina.tribes.transport.PooledSender * method */ @Override public DataSender getNewDataSender() { MultipointBioSender sender = new MultipointBioSender(); AbstractSender.transferProperties(this,sender); return sender; }