adding isReady()

This commit is contained in:
Dave
2015-01-05 23:10:48 +02:00
parent 54ca67d27a
commit 329cfb4d97
2 changed files with 8 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ import nodash.models.NoUser;
public final class NoHashSphereDefault implements NoHashSphereInterface { public final class NoHashSphereDefault implements NoHashSphereInterface {
private Set<String> database = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); private Set<String> database = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
private String fileName; private String fileName;
private boolean ready = false;
public NoHashSphereDefault(String fileName) { public NoHashSphereDefault(String fileName) {
this.fileName = fileName; this.fileName = fileName;
@@ -68,6 +69,7 @@ public final class NoHashSphereDefault implements NoHashSphereInterface {
} }
} }
} }
this.ready = true;
} }
public synchronized void saveToFile() throws IOException { public synchronized void saveToFile() throws IOException {
@@ -104,4 +106,9 @@ public final class NoHashSphereDefault implements NoHashSphereInterface {
public synchronized long size() { public synchronized long size() {
return this.database.size(); return this.database.size();
} }
@Override
public boolean isReady() {
return this.ready;
}
} }

View File

@@ -12,4 +12,5 @@ public interface NoHashSphereInterface {
public void removeHash(String hash) throws IOException; public void removeHash(String hash) throws IOException;
public boolean checkHash(String hash); public boolean checkHash(String hash);
public long size(); public long size();
public boolean isReady();
} }