adding isReady()
This commit is contained in:
@@ -40,6 +40,7 @@ import nodash.models.NoUser;
|
||||
public final class NoHashSphereDefault implements NoHashSphereInterface {
|
||||
private Set<String> database = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
|
||||
private String fileName;
|
||||
private boolean ready = false;
|
||||
|
||||
public NoHashSphereDefault(String fileName) {
|
||||
this.fileName = fileName;
|
||||
@@ -68,6 +69,7 @@ public final class NoHashSphereDefault implements NoHashSphereInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ready = true;
|
||||
}
|
||||
|
||||
public synchronized void saveToFile() throws IOException {
|
||||
@@ -104,4 +106,9 @@ public final class NoHashSphereDefault implements NoHashSphereInterface {
|
||||
public synchronized long size() {
|
||||
return this.database.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return this.ready;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,5 @@ public interface NoHashSphereInterface {
|
||||
public void removeHash(String hash) throws IOException;
|
||||
public boolean checkHash(String hash);
|
||||
public long size();
|
||||
public boolean isReady();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user