/** * @return string for debugging purposes. */ @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append( "\n UDPDiscoveryAttributes" ); buf.append( "\n ServiceName = [" + getServiceName() + "]" ); buf.append( "\n ServiceAddress = [" + getServiceAddress() + "]" ); buf.append( "\n ServicePort = [" + getServicePort() + "]" ); buf.append( "\n UdpDiscoveryAddr = [" + getUdpDiscoveryAddr() + "]" ); buf.append( "\n UdpDiscoveryPort = [" + getUdpDiscoveryPort() + "]" ); buf.append( "\n SendDelaySec = [" + getSendDelaySec() + "]" ); buf.append( "\n MaxIdleTimeSec = [" + getMaxIdleTimeSec() + "]" ); buf.append( "\n IsDark = [" + isDark() + "]" ); return buf.toString(); } }
/** * @return string for debugging purposes. */ @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append( "\n UDPDiscoveryAttributes" ); buf.append( "\n ServiceName = [" + getServiceName() + "]" ); buf.append( "\n ServiceAddress = [" + getServiceAddress() + "]" ); buf.append( "\n ServicePort = [" + getServicePort() + "]" ); buf.append( "\n UdpDiscoveryAddr = [" + getUdpDiscoveryAddr() + "]" ); buf.append( "\n UdpDiscoveryPort = [" + getUdpDiscoveryPort() + "]" ); buf.append( "\n SendDelaySec = [" + getSendDelaySec() + "]" ); buf.append( "\n MaxIdleTimeSec = [" + getMaxIdleTimeSec() + "]" ); buf.append( "\n IsDark = [" + isDark() + "]" ); return buf.toString(); } }
log.debug( "Creating sender thread for discoveryAddress = [" + attributes.getUdpDiscoveryAddr() + "] and discoveryPort = [" + attributes.getUdpDiscoveryPort() + "] myHostName = [" + attributes.getServiceAddress() + "] and port = [" + attributes.getServicePort() + "]" ); sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.requestBroadcast();
log.debug( "Creating sender thread for discoveryAddress = [" + attributes.getUdpDiscoveryAddr() + "] and discoveryPort = [" + attributes.getUdpDiscoveryPort() + "] myHostName = [" + attributes.getServiceAddress() + "] and port = [" + attributes.getServicePort() + "]" ); sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); sender.requestBroadcast();
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); log.error( "Problem calling the UDP Discovery Sender [" + attributes.getUdpDiscoveryAddr() + ":" + attributes.getUdpDiscoveryPort() + "]", e );
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() ); log.error( "Problem calling the UDP Discovery Sender [" + attributes.getUdpDiscoveryAddr() + ":" + attributes.getUdpDiscoveryPort() + "]", e );
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() );
sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes.getUdpDiscoveryPort() );
receiver = new UDPDiscoveryReceiver( this, getUdpDiscoveryAttributes().getUdpDiscoveryAddr(), getUdpDiscoveryAttributes().getUdpDiscoveryPort() ); udpReceiverThread = new Thread( receiver ); + getUdpDiscoveryAttributes().getUdpDiscoveryAddr() + "] port [" + getUdpDiscoveryAttributes().getUdpDiscoveryPort() + "] we won't be able to find any other caches", e );
sender1 = new UDPDiscoverySender( getUdpDiscoveryAttributes().getUdpDiscoveryAddr(), getUdpDiscoveryAttributes().getUdpDiscoveryPort() ); + getUdpDiscoveryAttributes().getUdpDiscoveryAddr() + "] port [" + getUdpDiscoveryAttributes().getUdpDiscoveryPort() + "]", e );
sender1 = new UDPDiscoverySender( getUdpDiscoveryAttributes().getUdpDiscoveryAddr(), getUdpDiscoveryAttributes().getUdpDiscoveryPort() ); + getUdpDiscoveryAttributes().getUdpDiscoveryAddr() + "] port [" + getUdpDiscoveryAttributes().getUdpDiscoveryPort() + "]", e );
/** * @param attributes */ public UDPDiscoveryService( UDPDiscoveryAttributes attributes) { udpDiscoveryAttributes = (UDPDiscoveryAttributes) attributes.clone(); try { // todo, you should be able to set this udpDiscoveryAttributes.setServiceAddress( HostNameUtil.getLocalHostAddress() ); } catch ( UnknownHostException e ) { log.error( "Couldn't get localhost address", e ); } try { // todo need some kind of recovery here. receiver = new UDPDiscoveryReceiver( this, getUdpDiscoveryAttributes().getUdpDiscoveryAddr(), getUdpDiscoveryAttributes().getUdpDiscoveryPort() ); } catch ( IOException e ) { log.error( "Problem creating UDPDiscoveryReceiver, address [" + getUdpDiscoveryAttributes().getUdpDiscoveryAddr() + "] port [" + getUdpDiscoveryAttributes().getUdpDiscoveryPort() + "] we won't be able to find any other caches", e ); } // create a sender thread sender = new UDPDiscoverySenderThread( getUdpDiscoveryAttributes(), getCacheNames() ); }
/** @return a clone of this object */ @Override public UDPDiscoveryAttributes clone() { UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setSendDelaySec( this.getSendDelaySec() ); attributes.setMaxIdleTimeSec( this.getMaxIdleTimeSec() ); attributes.setServiceName( this.getServiceName() ); attributes.setServicePort( this.getServicePort() ); attributes.setUdpDiscoveryAddr( this.getUdpDiscoveryAddr() ); attributes.setUdpDiscoveryPort( this.getUdpDiscoveryPort() ); attributes.setDark( this.isDark() ); return attributes; }
/** @return a clone of this object */ @Override public Object clone() { UDPDiscoveryAttributes attributes = new UDPDiscoveryAttributes(); attributes.setSendDelaySec( this.getSendDelaySec() ); attributes.setMaxIdleTimeSec( this.getMaxIdleTimeSec() ); attributes.setServiceName( this.getServiceName() ); attributes.setServicePort( this.getServicePort() ); attributes.setUdpDiscoveryAddr( this.getUdpDiscoveryAddr() ); attributes.setUdpDiscoveryPort( this.getUdpDiscoveryPort() ); attributes.setDark( this.isDark() ); return attributes; }
UDPDiscoveryReceiver receiver = new UDPDiscoveryReceiver( service, attributes.getUdpDiscoveryAddr(), attributes .getUdpDiscoveryPort() ); Thread t = new Thread( receiver ); UDPDiscoverySender sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes .getUdpDiscoveryPort() );
UDPDiscoveryReceiver receiver = new UDPDiscoveryReceiver( service, attributes.getUdpDiscoveryAddr(), attributes .getUdpDiscoveryPort() ); Thread t = new Thread( receiver ); UDPDiscoverySender sender = new UDPDiscoverySender( attributes.getUdpDiscoveryAddr(), attributes .getUdpDiscoveryPort() );