*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import net.pterodactylus.sone.core.FreenetInterface.InsertToken;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.TemporaryImage;
import net.pterodactylus.sone.core.FreenetInterface.InsertToken;
import net.pterodactylus.sone.data.Image;
import net.pterodactylus.sone.data.TemporaryImage;
/** The tokens of running inserts. */
private final Map<String, InsertToken> insertTokens = Collections.synchronizedMap(new HashMap<String, InsertToken>());
/** The tokens of running inserts. */
private final Map<String, InsertToken> insertTokens = Collections.synchronizedMap(new HashMap<String, InsertToken>());
public void insertImage(TemporaryImage temporaryImage, Image image) {
checkNotNull(temporaryImage, "temporaryImage must not be null");
checkNotNull(image, "image must not be null");
public void insertImage(TemporaryImage temporaryImage, Image image) {
checkNotNull(temporaryImage, "temporaryImage must not be null");
checkNotNull(image, "image must not be null");
insertTokens.put(image.getId(), insertToken);
freenetInterface.insertImage(temporaryImage, image, insertToken);
} catch (SoneException se1) {
insertTokens.put(image.getId(), insertToken);
freenetInterface.insertImage(temporaryImage, image, insertToken);
} catch (SoneException se1) {