public static DiscoveryException errorReceivingAnnouncement(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_RECEIVING_ANNOUNCEMENT, args)); ex.setErrorCode(ERROR_RECEIVING_ANNOUNCEMENT); ex.setInternalException(internalEx); return ex; } }
/** * INTERNAL: * Create the multicast socket and join the multicast group. */ public void createCommunicationSocket() { Object[] args = { multicastGroupAddress, "" + multicastPort }; rcm.logDebug("initializing_discovery_resources", args); if (communicationSocket == null) { try { communicationSocket = new MulticastSocket(multicastPort); communicationSocket.setTimeToLive(getPacketTimeToLive()); communicationSocket.joinGroup(InetAddress.getByName(multicastGroupAddress)); } catch (IOException ex) { // Either we couldn't create the socket or we couldn't join the group DiscoveryException discoveryEx = DiscoveryException.errorJoiningMulticastGroup(ex); rcm.handleException(discoveryEx); } } }
/** * INTERNAL: * Send out an announcement that we are here. */ public void announceSession() { rcm.logDebug("sending_announcement", (Object[])null); ServiceAnnouncement outMsg = new ServiceAnnouncement(rcm.getServiceId()); byte[] outBytes = outMsg.toBytes(); try { // Create a packet to send and send it out to everyone listening DatagramPacket sendPacket = new DatagramPacket(outBytes, outBytes.length, InetAddress.getByName(multicastGroupAddress), multicastPort); getCommunicationSocket().send(sendPacket); Object[] args = null; rcm.logInfo("announcement_sent", args); } catch (Exception ex) { // We got an exception. Map it to an RCM exception and call the handler DiscoveryException discoveryEx = DiscoveryException.errorSendingAnnouncement(ex); rcm.handleException(discoveryEx); } }
} else { rcm.handleException(DiscoveryException.errorReceivingAnnouncement(exception));
/** * INTERNAL: * Create the multicast socket and join the multicast group. */ public void createCommunicationSocket() { Object[] args = { multicastGroupAddress, "" + multicastPort }; rcm.logDebug("initializing_discovery_resources", args); if (communicationSocket == null) { try { communicationSocket = new MulticastSocket(multicastPort); communicationSocket.setTimeToLive(getPacketTimeToLive()); communicationSocket.joinGroup(InetAddress.getByName(multicastGroupAddress)); } catch (IOException ex) { // Either we couldn't create the socket or we couldn't join the group DiscoveryException discoveryEx = DiscoveryException.errorJoiningMulticastGroup(ex); rcm.handleException(discoveryEx); } } }
/** * INTERNAL: * Send out an announcement that we are here. */ public void announceSession() { rcm.logDebug("sending_announcement", (Object[])null); ServiceAnnouncement outMsg = new ServiceAnnouncement(rcm.getServiceId()); byte[] outBytes = outMsg.toBytes(); try { // Create a packet to send and send it out to everyone listening DatagramPacket sendPacket = new DatagramPacket(outBytes, outBytes.length, InetAddress.getByName(multicastGroupAddress), multicastPort); getCommunicationSocket().send(sendPacket); Object[] args = null; rcm.logInfo("announcement_sent", args); } catch (Exception ex) { // We got an exception. Map it to an RCM exception and call the handler DiscoveryException discoveryEx = DiscoveryException.errorSendingAnnouncement(ex); rcm.handleException(discoveryEx); } }
} else { rcm.handleException(DiscoveryException.errorReceivingAnnouncement(exception));
public static DiscoveryException errorJoiningMulticastGroup(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_JOINING_MULTICAST_GROUP, args)); ex.setErrorCode(ERROR_JOINING_MULTICAST_GROUP); ex.setInternalException(internalEx); return ex; }
/** * INTERNAL: * Create the multicast socket and join the multicast group. */ public void createCommunicationSocket() { Object[] args = { multicastGroupAddress, "" + multicastPort }; rcm.logDebug("initializing_discovery_resources", args); if (communicationSocket == null) { try { communicationSocket = new MulticastSocket(multicastPort); communicationSocket.setTimeToLive(getPacketTimeToLive()); communicationSocket.joinGroup(InetAddress.getByName(multicastGroupAddress)); } catch (IOException ex) { // Either we couldn't create the socket or we couldn't join the group DiscoveryException discoveryEx = DiscoveryException.errorJoiningMulticastGroup(ex); rcm.handleException(discoveryEx); } } }
/** * INTERNAL: * Send out an announcement that we are here. */ public void announceSession() { rcm.logDebug("sending_announcement", (Object[])null); ServiceAnnouncement outMsg = new ServiceAnnouncement(rcm.getServiceId()); byte[] outBytes = outMsg.toBytes(); try { // Create a packet to send and send it out to everyone listening DatagramPacket sendPacket = new DatagramPacket(outBytes, outBytes.length, InetAddress.getByName(multicastGroupAddress), multicastPort); getCommunicationSocket().send(sendPacket); Object[] args = null; rcm.logInfo("announcement_sent", args); } catch (Exception ex) { // We got an exception. Map it to an RCM exception and call the handler DiscoveryException discoveryEx = DiscoveryException.errorSendingAnnouncement(ex); rcm.handleException(discoveryEx); } }
} else { rcm.handleException(DiscoveryException.errorReceivingAnnouncement(exception));
public static DiscoveryException errorLookingUpLocalHost(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_LOOKING_UP_LOCAL_HOST, args)); ex.setErrorCode(ERROR_LOOKING_UP_LOCAL_HOST); ex.setInternalException(internalEx); return ex; }
public static DiscoveryException errorSendingAnnouncement(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_SENDING_ANNOUNCEMENT, args)); ex.setErrorCode(ERROR_SENDING_ANNOUNCEMENT); ex.setInternalException(internalEx); return ex; }
public static DiscoveryException errorJoiningMulticastGroup(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_JOINING_MULTICAST_GROUP, args)); ex.setErrorCode(ERROR_JOINING_MULTICAST_GROUP); ex.setInternalException(internalEx); return ex; }
public static DiscoveryException errorSendingAnnouncement(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_SENDING_ANNOUNCEMENT, args)); ex.setErrorCode(ERROR_SENDING_ANNOUNCEMENT); ex.setInternalException(internalEx); return ex; }
public static DiscoveryException errorLookingUpLocalHost(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_LOOKING_UP_LOCAL_HOST, args)); ex.setErrorCode(ERROR_LOOKING_UP_LOCAL_HOST); ex.setInternalException(internalEx); return ex; }
public static DiscoveryException errorReceivingAnnouncement(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_RECEIVING_ANNOUNCEMENT, args)); ex.setErrorCode(ERROR_RECEIVING_ANNOUNCEMENT); ex.setInternalException(internalEx); return ex; } }
public static DiscoveryException errorReceivingAnnouncement(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_RECEIVING_ANNOUNCEMENT, args)); ex.setErrorCode(ERROR_RECEIVING_ANNOUNCEMENT); ex.setInternalException(internalEx); return ex; } }
public static DiscoveryException errorJoiningMulticastGroup(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_JOINING_MULTICAST_GROUP, args)); ex.setErrorCode(ERROR_JOINING_MULTICAST_GROUP); ex.setInternalException(internalEx); return ex; }
public static DiscoveryException errorSendingAnnouncement(Exception internalEx) { Object[] args = { }; DiscoveryException ex = new DiscoveryException(ExceptionMessageGenerator.buildMessage(DiscoveryException.class, ERROR_SENDING_ANNOUNCEMENT, args)); ex.setErrorCode(ERROR_SENDING_ANNOUNCEMENT); ex.setInternalException(internalEx); return ex; }