sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.removeBroadcast( attributes.getServiceAddress(), attributes.getServicePort(), cacheNames ); sender.destroy();
/** * This sends a message broadcasting out that the host and port is available for connections. * <p> * It uses the vmid as the requesterDI * @param host * @param port * @param cacheNames * @throws IOException */ public void passiveBroadcast( String host, int port, ArrayList<String> cacheNames ) throws IOException { passiveBroadcast( host, port, cacheNames, CacheInfo.listenerId ); }
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.passiveBroadcast( attributes.getServiceAddress(), attributes.getServicePort(), cacheNames ); sender.destroy();
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.requestBroadcast(); sender.destroy();
UDPDiscoverySender sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes .getUdpDiscoveryPort() ); for ( ; cnt < max; cnt++ ) sender.passiveBroadcast( "localhost", 1111, cacheNames, 1 ); SleepUtil.sleepAtLeast( 20 );
/** * Just being careful about closing the socket. * <p> * @throws Throwable */ @Override protected void finalize() throws Throwable { super.finalize(); destroy(); }
/** * This sends a message broadcasting our that the host and port is no longer available. * <p> * It uses the vmid as the requesterID * <p> * @param host host * @param port port * @param cacheNames names of the cache regions * @throws IOException on error */ public void removeBroadcast( String host, int port, ArrayList<String> cacheNames ) throws IOException { removeBroadcast( host, port, cacheNames, CacheInfo.listenerId ); }
/** * Set up the receiver. Maybe better to just code sockets here? Set up the sender for sending * the message. * <p> * @throws Exception on error */ @Override protected void setUp() throws Exception { super.setUp(); receiver = new UDPDiscoveryReceiver( null, ADDRESS, PORT ); sender = new UDPDiscoverySender( ADDRESS, PORT ); }
/** * Test sending a request broadcast. * <p> * @throws Exception on error */ public void testRequestBroadcast() throws Exception { // DO WORK sender.requestBroadcast(); // VERIFY // grab the sent message Object obj = receiver.waitForMessage(); assertTrue( "unexpected crap received", obj instanceof UDPDiscoveryMessage ); UDPDiscoveryMessage msg = (UDPDiscoveryMessage) obj; assertEquals( "wrong message type", BroadcastType.REQUEST, msg.getMessageType() ); } }
/** * Ask other to broadcast their info the the multicast address. If a lateral is non receiving it * can use this. This is also called on startup so we can get info. * <p> * @throws IOException */ public void requestBroadcast() throws IOException { if ( log.isDebugEnabled() ) { log.debug( "sending requestBroadcast " ); } UDPDiscoveryMessage message = new UDPDiscoveryMessage(); message.setRequesterId( CacheInfo.listenerId ); message.setMessageType( BroadcastType.REQUEST ); send( message ); }
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.passiveBroadcast( attributes.getServiceAddress(), attributes.getServicePort(), cacheNames ); sender.destroy();
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.requestBroadcast(); sender.destroy();
UDPDiscoverySender sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes .getUdpDiscoveryPort() ); for ( ; cnt < max; cnt++ ) sender.passiveBroadcast( "localhost", 1111, cacheNames, 1 ); SleepUtil.sleepAtLeast( 20 );
/** * Just being careful about closing the socket. * <p> * @throws Throwable */ @Override protected void finalize() throws Throwable { super.finalize(); destroy(); }
/** * This sends a message broadcasting our that the host and port is no longer available. * <p> * It uses the vmid as the requesterID * <p> * @param host host * @param port port * @param cacheNames names of the cache regions * @throws IOException on error */ public void removeBroadcast( String host, int port, ArrayList<String> cacheNames ) throws IOException { removeBroadcast( host, port, cacheNames, CacheInfo.listenerId ); }
/** * Set up the receiver. Maybe better to just code sockets here? Set up the sender for sending * the message. * <p> * @throws Exception on error */ @Override protected void setUp() throws Exception { super.setUp(); receiver = new UDPDiscoveryReceiver( null, ADDRESS, PORT ); sender = new UDPDiscoverySender( ADDRESS, PORT ); }
/** * Test sending a request broadcast. * <p> * @throws Exception on error */ public void testRequestBroadcast() throws Exception { // DO WORK sender.requestBroadcast(); // VERIFY // grab the sent message Object obj = receiver.waitForMessage(); assertTrue( "unexpected crap received", obj instanceof UDPDiscoveryMessage ); UDPDiscoveryMessage msg = (UDPDiscoveryMessage) obj; assertEquals( "wrong message type", BroadcastType.REQUEST, msg.getMessageType() ); } }
/** * Ask other to broadcast their info the the multicast address. If a lateral is non receiving it * can use this. This is also called on startup so we can get info. * <p> * @throws IOException */ public void requestBroadcast() throws IOException { if ( log.isDebugEnabled() ) { log.debug( "sending requestBroadcast " ); } UDPDiscoveryMessage message = new UDPDiscoveryMessage(); message.setRequesterId( CacheInfo.listenerId ); message.setMessageType( BroadcastType.REQUEST ); send( message ); }
sender1 = new UDPDiscoverySender( getUdpDiscoveryAttributes().getUdpDiscoveryAddr(), getUdpDiscoveryAttributes().getUdpDiscoveryPort() ); sender1.passiveBroadcast( getUdpDiscoveryAttributes().getServiceAddress(), getUdpDiscoveryAttributes() .getServicePort(), this.getCacheNames() ); sender1.destroy();
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.removeBroadcast( attributes.getServiceAddress(), attributes.getServicePort(), cacheNames ); sender.destroy();