throw new AllLinksDown();
for(int i=0; i < links.size(); i++) { link=(Link)links.elementAt(i); if(link.established()) { if(link.send(buf)) { System.out.println("Send over link #" + link_used + ": " + link); return true; } } }  throw new AllLinksDown();
    public boolean send(byte[] buf) throws AllLinksDown, NoLinksAvailable {	Link    link;	int     link_used=0;	if(buf == null || buf.length == 0) {	    log.error("LogicalLink.send(): buf is null or empty");	    return false;	}	if(links.size() == 0)	    throw new NoLinksAvailable();			// current policy (make policies configurable later !): alternate between links.	// if failure, take first link that works	//  	link=(Link)links.elementAt(link_to_use);	//  	if(link.send(buf)) {	//  	    System.out.println("Send over link #" + link_to_use + ": " + link);	//  	    link_to_use=(link_to_use + 1) % links.size();	//  	    return true;	//  	}		//  	link_used=(link_to_use + 1) % links.size();	//  	while(link_used != link_to_use) {	//  	    link=(Link)links.elementAt(link_used);	//  	    if(link.send(buf)) {	//  		System.out.println("Send over link #" + link_used + ": " + link);	//  		link_to_use=(link_to_use + 1) % links.size();	//  		return true;	//  	    }	//  	    link_used=(link_used + 1) % links.size();	//  	}		// take first available link. use other links only if first is down. if we have smaller and bigger	// pipes, the bigger ones should be specified first (so we're using them first, and only when they	// are not available we use the smaller ones)	for(int i=0; i < links.size(); i++) {	    link=(Link)links.elementAt(i);	    if(link.established()) {		if(link.send(buf)) {		    System.out.println("Send over link #" + link_used + ": " + link);		    return true;		}	    }	}	throw new AllLinksDown();    }