*/
public class ProjectInserter implements FileScannerListener, Runnable {
+ /** Random number for FCP instances. */
+ private static final int random = (int) (Math.random() * Integer.MAX_VALUE);
+
/** Counter for FCP connection identifier. */
private static int counter = 0;
List<String> files = fileScanner.getFiles();
/* create connection to node */
- Connection connection = freenetInterface.getConnection("project-insert-" + counter++);
+ Connection connection = freenetInterface.getConnection("project-insert-" + random + counter++);
boolean connected = false;
Throwable cause = null;
try {
System.out.println(message);
}
if (!finished) {
+ @SuppressWarnings("null")
String messageName = message.getName();
if ("URIGenerated".equals(messageName)) {
finalURI = message.get("URI");
/* post-insert work */
fireProjectInsertFinished(success, disconnected ? new IOException("Connection terminated") : null);
if (success) {
+ @SuppressWarnings("null")
String editionPart = finalURI.substring(finalURI.lastIndexOf('/') + 1);
int newEdition = Integer.parseInt(editionPart);
project.setEdition(newEdition);
+ project.setLastInsertionTime(System.currentTimeMillis());
}
}