public static void fileWatcher(String binPath) throws IOException, InterruptedException {
        BinLogReader br = new BinLogReader(binPath);
        final ArrayBlockingQueue queue = new ArrayBlockingQueue(1000);
        new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    QueryEvent e = null;
                    try {
                        e = (QueryEvent) queue.take();
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                    System.out.println(e.sql);
                }
            }
        }).start();
        if (br.isBinLogFile()) {
            while (true) {
                Thread.sleep(1000);
                while (br.is.hasMore()) {
                    CommonHeader header = br.parseHeader();
                    if (header.type == 2) {
                        QueryEvent event = br.parseEvent();
                        queue.put(event);
                    } else {
                        br.is.skip(header.nextPosition - br.is.getHead());
                        br.is.setReadLimit(0);
                    }
                }
            }
        }
    }