Timer Problems.

Hi all,

I’m having a little problem… I’m trying to write
a client server relationship.

I have a timer operation right now on the Server
Something like this at the moment:

public class GameManager extends TimerTask
{
public GameManager()
{
}

  long time;

  public void run()
  {
        System.out.println(System.currentTimeMillis() - time);
        time = System.currentTimeMillis();
  }

}

I run the TimerTask with something like this:
Timer timer = new Timer();
timer.schedule(gameManager , 0 , 100);

For testing purposes, I’m trying to run the server application and the client application on the same box.

Now, when I start of the server, the timer is fine.
I get values of 100 and some times 101.

Now, when I start the client code, the values the
server is printing out jumps to about 130-150

But if I click on the server application, the numbers
being printed out goes back to around 100…

This is really puzzling to me… What I’m guessing is
that the JVM is some how putting the server application
on a lessor priority when its not in focus.

And it swaps some stuff out when the server application
loses focus.

Or something about running the other java application
is screwing up the scheduling of my TimerTask.

Is there some way to specify to the JVM when I
run the server application to give it top priority?

Has anyone ran into something similar.
Thanks in advance.
Much appriciated.