DB Size
This commit is contained in:
parent
0aa196339b
commit
c47ab96996
|
@ -316,6 +316,7 @@ public class Crawler implements Runnable {
|
||||||
out += "\nRandomBuffer: " + db.getRandomCount();
|
out += "\nRandomBuffer: " + db.getRandomCount();
|
||||||
out += "\nRuntime: " + runtimem + "min and " + crawlcount + " videos crawled. ( " + vidps + " v/s )";
|
out += "\nRuntime: " + runtimem + "min and " + crawlcount + " videos crawled. ( " + vidps + " v/s )";
|
||||||
out += "\nState: " + currentstate;
|
out += "\nState: " + currentstate;
|
||||||
|
out += "\nDBSize: " + db.getDBSize();
|
||||||
out += "\nThread Nr, todo size, requested, crawledsize, foundsize";
|
out += "\nThread Nr, todo size, requested, crawledsize, foundsize";
|
||||||
for (int i = 0; i < threads.size(); i++) {
|
for (int i = 0; i < threads.size(); i++) {
|
||||||
CrawlerThread thre = threads.get(i);
|
CrawlerThread thre = threads.get(i);
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class DB implements Runnable {
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
private Server serv = new Server(this);
|
private Server serv = new Server(this);
|
||||||
private Thread randomrefill = null;
|
private Thread randomrefill = null;
|
||||||
|
private int dbsize = 0;
|
||||||
|
|
||||||
public DB() {
|
public DB() {
|
||||||
try {
|
try {
|
||||||
|
@ -54,10 +55,31 @@ public class DB implements Runnable {
|
||||||
|
|
||||||
serv.start();
|
serv.start();
|
||||||
refillbuffer();
|
refillbuffer();
|
||||||
|
|
||||||
|
//get db size
|
||||||
|
dbsize();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Error while connecting to the database! ", e);
|
log.error("Error while connecting to the database! ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dbsize() {
|
||||||
|
try {
|
||||||
|
ResultSet set = query("SELECT count(*) as count FROM `videos`;");
|
||||||
|
if(set != null) {
|
||||||
|
if(set.next()) {
|
||||||
|
dbsize = set.getInt(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDBSize() {
|
||||||
|
return dbsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void connect(boolean selectdb) {
|
private void connect(boolean selectdb) {
|
||||||
try {
|
try {
|
||||||
|
@ -100,6 +122,7 @@ public class DB implements Runnable {
|
||||||
public void addVideos(List<Video> input) {
|
public void addVideos(List<Video> input) {
|
||||||
//log.info("add " + input.size() + " videos");
|
//log.info("add " + input.size() + " videos");
|
||||||
if(input.size() > 0) {
|
if(input.size() > 0) {
|
||||||
|
dbsize += input.size();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(int i = 0; i< input.size(); i++) {
|
for(int i = 0; i< input.size(); i++) {
|
||||||
if(i > 0)
|
if(i > 0)
|
||||||
|
|
Loading…
Reference in New Issue