@Override
		public void run() {
			while(true){
				while(queries.size() > 0){
					try {
						statement.execute("BEGIN IMMEDIATE TRANSACTION");
					} catch (SQLException e1) {
						continue;
					}
					for(int i=0; i<30 && queries.size()>0; i++) {
						String query = null;
						try {
							query = queries.remove();
							statement.execute(query);
						} catch (SQLException e) {
							System.err.println("Could not execute query - "+query);
							e.printStackTrace();
						}
					}
					try {
						statement.execute("COMMIT TRANSACTION");
					} catch (SQLException e1) {
						e1.printStackTrace();
					}
				}
				if(queries.size() <= 0) {
					try {
						Thread.sleep(10);
					} catch (InterruptedException e) {
						//insomniac thread
					}
				}
			}
		}