T
T
TheRevan2018-01-18 05:46:54
Java
TheRevan, 2018-01-18 05:46:54

How to implement a non-blocking timer in java?

Given: There is a game in java (alas, the client is also in java), in which it is possible to build various buildings .. The Ping object is sent to the server in which information about the user is transmitted and that he wants to build a specific building on a specific planet, but the building delay for example 20 minutes is needed to build it. How to implement this without blocking other user actions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2018-01-18
@TheRevan

Run in a separate thread. If you need to return some result after starting the task, you can use the Callable interface .
In general, the topic is not new. There are thousands of examples on the Internet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question