bugfix: must lock active connections before copying

This commit is contained in:
fros4943 2009-04-20 16:26:02 +00:00
parent eb3d501ca6
commit eccadb44f1

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: AbstractRadioMedium.java,v 1.8 2009/03/26 16:24:31 fros4943 Exp $ * $Id: AbstractRadioMedium.java,v 1.9 2009/04/20 16:26:02 fros4943 Exp $
*/ */
package se.sics.cooja.radiomediums; package se.sics.cooja.radiomediums;
@ -98,9 +98,8 @@ public abstract class AbstractRadioMedium extends RadioMedium {
* @return All active connections * @return All active connections
*/ */
public RadioConnection[] getActiveConnections() { public RadioConnection[] getActiveConnections() {
RadioConnection[] active = new RadioConnection[activeConnections.size()]; /* NOTE: toArray([0]) creates array and handles synchronization */
activeConnections.toArray(active); return activeConnections.toArray(new RadioConnection[0]);
return active;
} }
/** /**