用线程实现,继承Thread或者实现Runnable
将flag=true;
在public void run()方法中利用
while(flag)
{
  读取数据
}