Coverage Report - org.mule.providers.multicast.MulticastConnector
 
Classes in this File Line Coverage Branch Coverage Complexity
MulticastConnector
80%
12/15
N/A
1
 
 1  
 /*
 2  
  * $Id: MulticastConnector.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.providers.multicast;
 12  
 
 13  
 import org.mule.providers.udp.UdpConnector;
 14  
 import org.mule.umo.UMOComponent;
 15  
 import org.mule.umo.endpoint.UMOEndpoint;
 16  
 import org.mule.umo.lifecycle.InitialisationException;
 17  
 
 18  
 /**
 19  
  * <code>MulticastConnector</code> can dispatch mule events using ip multicasting
 20  
  */
 21  24
 public class MulticastConnector extends UdpConnector
 22  
 {
 23  24
     private boolean loopback = false;
 24  24
     private int timeToLive = INT_VALUE_NOT_SET;
 25  
 
 26  
     public String getProtocol()
 27  
     {
 28  74
         return "multicast";
 29  
     }
 30  
 
 31  
 
 32  
     //@java.lang.Override
 33  
     protected void doInitialise() throws InitialisationException
 34  
     {
 35  22
         dispatcherSocketsPool.setFactory(new MulticastSocketFactory());
 36  22
         dispatcherSocketsPool.setTestOnBorrow(false);
 37  22
         dispatcherSocketsPool.setTestOnReturn(true);
 38  
         //For clarity, note that the max active value does not need to be 1 since you can have multiple
 39  
         //Multicast sockets bound to a single port
 40  
         //dispatcherSocketsPool.setMaxActive(1);
 41  22
     }
 42  
 
 43  
     public boolean isLoopback()
 44  
     {
 45  2
         return loopback;
 46  
     }
 47  
 
 48  
     public void setLoopback(boolean loopback)
 49  
     {
 50  2
         this.loopback = loopback;
 51  2
     }
 52  
 
 53  
 
 54  
     public int getTimeToLive()
 55  
     {
 56  0
         return timeToLive;
 57  
     }
 58  
 
 59  
     public void setTimeToLive(int timeToLive)
 60  
     {
 61  0
         this.timeToLive = timeToLive;
 62  0
     }
 63  
 
 64  
 
 65  
     //@java.lang.Override
 66  
     protected Object getReceiverKey(UMOComponent component, UMOEndpoint endpoint)
 67  
     {
 68  
         //you can have multiple Multicast sockets bound to a single port,
 69  
         // so store listeners with the component name too
 70  12
         return endpoint.getEndpointURI().getAddress() + "/" + component.getDescriptor().getName();
 71  
     }
 72  
 }