Java-Gaming.org
Java4K winners:
[
by our judges
|
by the community
]
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members
News
: Read the
Java Gaming Resources
, or peek at
the official Java tutorials
Home
Help
Search
Login
Register
Java-Gaming.org
>
Game Development
>
Performance Tuning
>
Timer Problems.
Pages: [
1
]
Print
Timer Problems.
(Read 757 times)
0 Members and 1 Guest are viewing this topic.
nech_neb
Jr. Member
Posts: 57
Java for LIFE !!!
Timer Problems.
«
on:
2003-06-28 18:21:21
»
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.
Pages: [
1
]
Print
Jump to:
Please select a destination:
-----------------------------
Games Center
-----------------------------
=> Featured Games
=> Showcase
=> Contests
===> LWJGL16k - 2011
===> 4K Game Competition - 2012
===> JGO Comp Petite
===> Finished Contests
=====> 4K Game Competition - 2011
=====> 4K Game Competition - 2010
=====> 4K Game Competition - 2009
=====> 4K Game Competition - 2008
=====> 4K Game Competition - 2007
=====> 4K Game Competition - 2006
=====> 4K Game Competition - 2005
=====> Tiny Game 2010
=====> JGO Comp 2009
=====> 16K LWJGL Competition - 2005
=====> Java Technology Game Development Contest - 2004
-----------------------------
Discussions
-----------------------------
=> General Discussions
===> Suggestions
=> Business and Project Discussions
===> Jobs and Resumes
===> Community & Volunteer Projects
=> Miscellaneous Topics
-----------------------------
Game Development
-----------------------------
=> Newbie & Debugging Questions
=> Articles & tutorials
=> Game Play & Game Design
=> Game Mechanics
===> Artificial Intelligence
=> Networking & Multiplayer
=> Performance Tuning
=> Shared Code
-----------------------------
Java Game APIs & Engines
-----------------------------
=> Engines, Libraries and Tools
===> Java 3D
===> JInput
===> jMonkeyEngine
===> Xith3D Forums
===> Tools Discussion
=> Java 2D
===> JavaFX
=> OpenGL Development
===> JOGL Development
===> LWJGL Development
=> Java Sound & OpenAL
===> JOAL Development
=> Java on Mobile Devices
===> Android
===> J2ME
Loading...