Results 1 to 5 of 5

Thread: Execute timer service in java

  1. #1
    Join Date
    Mar 2010
    Posts
    338

    Execute timer service in java

    Hello,
    I have a little problem with my running timer in java (the util). In fact, it seems that a timer is supposed to create a thread in parallel, so that the rest of the code then runs at the same time as the timer runs. I am calling a webservice with XMLRPC, which does not set the timeout, so before using the service, I swing timer, which after a certain time, for me an instant message if I don ' I had no response from the web service, or the timer starts, but later (use the web service) is done only after the allotted time timer. So do you have more advice or suggestions on this? Thank you.

  2. #2
    Join Date
    Dec 2009
    Posts
    213

    Re: Execute timer service in java

    See, if the following code can help you

    Code:
    public static void hand(String[] args) (
    		System.out.System.out.println("starting HAND "); Timer t = new Timer(); cshu(new TimerTask() (
    			int i = 0;
     
    			public void run() (
    				System.out.System.out.println("No timer exec:" + i + +);
    			)
    		), 0, 3000); callMyService(); System.out.System.out.println("end MAIN"); tcn();
    	)
     
    	private static void callMyService() (
    		System.out.System.out.println("START blocking call");
    		try (
    			Thread.currentThread().Sleep(7000); System.out.System.out.println("END blocking call");
    		) Catch (InterruptedException e) (
    			System.out.System.out.println("blocking call interrupted");
    		)
    	)
    )

  3. #3
    Join Date
    Nov 2009
    Posts
    356

    Re: Execute timer service in java

    My idea: You will create a class where you put your hand, then you will create a timer by Timer timer = new Timer (1000, displayed) then you start the timer for timer.start () and you make an active waiting while (true ) and then implements a listener with his action Performed. and here

  4. #4
    Join Date
    Aug 2009
    Posts
    155

    Re: Execute timer service in java

    I want to make a scheduling algorithm spots in a given stream. I want a bloke running tache2 during the execution time of a task for an order between Task 1 and tache2. I do not really know how to use the timer class so I'd like that you help me. any help regarding this topic is appreciated. thanks for your replies.

  5. #5
    Join Date
    Mar 2010
    Posts
    197

    Re: Execute timer service in java

    I think the best thing you can do is to use the class Timer. it is easy to use and enables you to make you a little method calls, for example timer. You'll then calibrate a second and then you can call when you will be on the inside of his hand. Though I am not sure that this is the idea solution for this. You can at-least have a try to it. Thank you.

Similar Threads

  1. Sharepoint (MOSS) timer jobs and the timer service
    By MahaGuru in forum Office Setup
    Replies: 2
    Last Post: 01-03-2011, 09:08 AM
  2. Help for Timer examples in Java
    By Feng in forum Software Development
    Replies: 5
    Last Post: 24-07-2010, 03:36 AM
  3. Timer and alarm in C / Java
    By Izek in forum Software Development
    Replies: 4
    Last Post: 20-07-2010, 03:24 PM
  4. Java - System Tray with timer
    By Anthony12 in forum Software Development
    Replies: 4
    Last Post: 20-07-2010, 11:58 AM
  5. Problem in java timer Class
    By Gunner 1 in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 12:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,828,122.27969 seconds with 17 queries