Search Results

Search found 1 results on 1 pages for 'senrulz'.

Page 1/1 | 1 

  • how to get http responses continuously to a java application?

    - by senrulz
    I have the coding shown below where I have sheduled to get a http response from a php web server page. public static void stopPHPDataChecker() { canStop=true; } public static void main (String args[]) { // http request to the php page and get the response PHPDataChecker pdc = new PHPDataChecker(); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); final ScheduledFuture<?> pdcHandle = scheduler.scheduleAtFixedRate(pdc, 0L, 10L, TimeUnit.MILLISECONDS);// Start schedule scheduler.schedule(new Runnable() { public void run() { System.out.println(">> TRY TO STOP!!!"); pdcHandle.cancel(true); Sheduler.stopPHPDataChecker(); System.out.println("DONE"); } }, 1L, TimeUnit.MILLISECONDS); do { if (canStop) { scheduler.shutdown(); } } while (!canStop); System.out.println("END"); } this coding only returns one response but I want it to get responses continuously so i can do different tasks according to the returned value. how can i do it? Thank you in advance :)

    Read the article

1