Question: I would really like to get if the file is Windows-1256 or not. Is there a way to recognize if text file is Windows-1256 in Java?

Answer: 
You could use a [`ScheduledExecutorService`, which is part of the standard JDK since 1.5](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html):

```
    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
    Runnable r = new Runnable() {

        @Override
        public void run() {
            invokeWebService();
        }
    };

    scheduler.scheduleAtFixedRate(r, 0, 30, TimeUnit.SECONDS);

```
From what I am getting, waiting sort of implies hanging, which I do not really think is a good idea. I would recommend you use something such as [Quartz](http://quartz-scheduler.org/) and run your method at whatever interval you wish.

> 
> Quartz is a full-featured, open source job scheduling service that can
>  be integrated with, or used along side virtually any Java EE or Java
>  SE application
> 
> 
> 

Tutorials can be accessed [here](http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/).

As stated in [here](https://stackoverflow.com/questions/2676295/quartz-preventing-concurrent-instances-of-a-job-in-jobs-xml) you can do something like so:

```
JobDetail existingJobDetail = sched.getJobDetail(jobName, jobGroup);
    if (existingJobDetail != null) {
        List<JobExecutionContext> currentlyExecutingJobs = (List<JobExecutionContext>) sched.getCurrentlyExecutingJobs();
        for (JobExecutionContext jec : currentlyExecutingJobs) {
            if(existingJobDetail.equals(jec.getJobDetail())) {
                //String message = jobName + " is already running.";
                //log.info(message);
                //throw new JobExecutionException(message,false);
            }
        }
        //sched.deleteJob(jobName, jobGroup); if you want to delete the scheduled but not-currently-running job
    }

```