/**
* TODO
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
* @version $Id$
*/
/**
* Creates a new FCP collector.
- *
+ *
* @param clientName
* The name of the FCP client
* @param directory
/**
* Adds the given listener to the list of listeners.
- *
+ *
* @param nodeListener
* The listener to add
*/
/**
* Removes the given listener from the list of listeners.
- *
+ *
* @param nodeListener
* The listener to remove
*/
/**
* Notifies all listeners that the given node was connected.
- *
+ *
* @param node
* The node that is now connected
*/
/**
* Notifies all listeners that the given node was disconnected.
- *
+ *
* @param node
* The node that is now disconnected
* @param throwable
/**
* Returns the directory in which the nodes are stored.
- *
+ *
* @return The directory the nodes are stored in
*/
public String getDirectory() {
/**
* Checks whether the given node is already connected.
- *
+ *
* @param node
* The node to check
* @return <code>true</code> if the node is already connected,
/**
* Loads nodes.
- *
+ *
* @throws IOException
* if an I/O error occurs loading the nodes
*/
/**
* Saves all configured nodes.
- *
+ *
* @throws IOException
* if an I/O error occurs saving the nodes
*/
/**
* Adds the given node to this manager.
- *
+ *
* @see #connect(Node)
* @param node
* The node to connect to
/**
* Removes the given node from the node manager, disconnecting it if it is
* currently connected.
- *
+ *
* @param node
* The node to remove
*/
/**
* Tries to establish a connection with the given node.
- *
+ *
* @param node
* The node to connect to
*/
/**
* Disconnects the given node without removing it.
- *
+ *
* @param node
* The node to disconnect
*/
/**
* Returns a list of all nodes.
- *
+ *
* @return A list of all nodes
*/
public List<Node> getNodes() {
/**
* Finds a currently unused high-level client, optionally waiting until a
* client is free and marking it used.
- *
+ *
* @param wait
* <code>true</code> to wait for a free connection,
* <code>false</code> to return <code>null</code>
if (!wait) {
return null;
}
+ try {
+ syncObject.wait();
+ } catch (InterruptedException e) {
+ /* ignore, just re-check. */
+ }
}
/* we never get here, but the compiler doesn't realize. */
return null;
* {@inheritDoc}
*/
public void clientDisconnected(HighLevelClient highLevelClient, Throwable throwable) {
- logger.log(Level.FINER, "clientDisconnected(c=" + highLevelClient + ",t=" + throwable +")");
+ logger.log(Level.FINER, "clientDisconnected(c=" + highLevelClient + ",t=" + throwable + ")");
synchronized (syncObject) {
Node node = clientNodes.remove(highLevelClient);
if (node == null) {
return;
}
nodeClients.remove(node);
+ usedConnections.remove(highLevelClient);
fireNodeDisconnected(node, throwable);
}
}