import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
private static final int random = (int) (Math.random() * Integer.MAX_VALUE);
/** Counter for FCP connection identifier. */
- private static int counter = 0;
+ private static final AtomicInteger counter = new AtomicInteger();
private final ProjectInsertListeners projectInsertListeners = new ProjectInsertListeners();
/* create connection to node */
synchronized (lockObject) {
- connection = freenetInterface.getConnection("project-insert-" + random + counter++);
+ connection = freenetInterface.getConnection("project-insert-" + random + counter.getAndIncrement());
}
connection.setTempDirectory(tempDirectory);
boolean connected = false;
/* collect files */
int edition = project.getEdition();
String dirURI = "USK@" + project.getInsertURI() + "/" + project.getPath() + "/" + edition + "/";
- ClientPutComplexDir putDir = new ClientPutComplexDir("dir-" + counter++, dirURI, tempDirectory);
+ ClientPutComplexDir putDir = new ClientPutComplexDir("dir-" + counter.getAndIncrement(), dirURI, tempDirectory);
if ((project.getIndexFile() != null) && (project.getIndexFile().length() > 0)) {
FileOption indexFileOption = project.getFileOption(project.getIndexFile());
Optional<String> changedName = indexFileOption.getChangedName();