*/
public class Core extends AbstractService {
+ /** The default Sones. */
+ private static final Set<String> defaultSones = new HashSet<String>();
+
+ static {
+ /* Sone of Sone. */
+ defaultSones.add("USK@eRHt0ceFsHjRZ11j6dd68RSdIvfd8f9YjJLZ9lnhEyo,iJWjIWh6TkMZm1NY8qBranKTIuwsCPkVPG6T6c6ft-I,AQACAAE/Sone/3");
+ /* Sone of Bombe. */
+ defaultSones.add("USK@RuW~uAO35Ipne896-1OmaVJNPuYE4ZIB5oZ5ziaU57A,7rV3uiyztXBDt03DCoRiNwiGjgFCJuznM9Okc1opURU,AQACAAE/Sone/24");
+ }
+
/**
* Enumeration for the possible states of a {@link Sone}.
*
private SoneDownloader soneDownloader;
/** The Sone blacklist. */
- private final Set<Sone> blacklistedSones = new HashSet<Sone>();
+ private final Set<Sone> blacklistedSones = Collections.synchronizedSet(new HashSet<Sone>());
/** The local Sones. */
- private final Set<Sone> localSones = new HashSet<Sone>();
+ private final Set<Sone> localSones = Collections.synchronizedSet(new HashSet<Sone>());
/** Sone inserters. */
- private final Map<Sone, SoneInserter> soneInserters = new HashMap<Sone, SoneInserter>();
+ private final Map<Sone, SoneInserter> soneInserters = Collections.synchronizedMap(new HashMap<Sone, SoneInserter>());
/** The Sones’ statuses. */
private final Map<Sone, SoneStatus> soneStatuses = Collections.synchronizedMap(new HashMap<Sone, SoneStatus>());
/* various caches follow here. */
/** Cache for all known Sones. */
- private final Map<String, Sone> soneCache = new HashMap<String, Sone>();
+ private final Map<String, Sone> soneCache = Collections.synchronizedMap(new HashMap<String, Sone>());
/** Cache for all known posts. */
- private final Map<String, Post> postCache = new HashMap<String, Post>();
+ private final Map<String, Post> postCache = Collections.synchronizedMap(new HashMap<String, Post>());
/** Cache for all known replies. */
- private final Map<String, Reply> replyCache = new HashMap<String, Reply>();
+ private final Map<String, Reply> replyCache = Collections.synchronizedMap(new HashMap<String, Reply>());
/**
* Creates a new core.
* Adds some default Sones.
*/
private void addDefaultSones() {
- /* Sone’s Sone. */
- loadSone("USK@eRHt0ceFsHjRZ11j6dd68RSdIvfd8f9YjJLZ9lnhEyo,iJWjIWh6TkMZm1NY8qBranKTIuwsCPkVPG6T6c6ft-I,AQACAAE/Sone/0");
- /* Bombe’s Sone. */
- loadSone("USK@RuW~uAO35Ipne896-1OmaVJNPuYE4ZIB5oZ5ziaU57A,7rV3uiyztXBDt03DCoRiNwiGjgFCJuznM9Okc1opURU,AQACAAE/Sone/15");
+ for (String soneUri : defaultSones) {
+ loadSone(soneUri);
+ }
}
/**