[英]How should I make the server check, if the time stamp made by the node is less than or more than five minutes old?
In my web-app server keeps the list of all the nodes that are connected to it (in the database). 在我的网络应用服务器中,保留了与其连接的所有节点的列表(在数据库中)。 Just to ensure that it doesn't keep the node information that are not connected to it anymore,after a certain interval it deletes the node from the database.
只是为了确保它不再保留未与其连接的节点信息,在一定的时间间隔后,它将从数据库中删除该节点。 Each node connected pings to the server after every 10 seconds and there is an entry made, that this particular node pinged the server at this time.
每个节点每10秒后连接的ping到服务器并有制成的条目, 此特定节点执行ping操作服务器在这个时候。
Problem : 问题:
Please help me with some inputs, as to how should I manage this ? 请帮我一些意见,我应该如何处理呢? If I make a time stamp, like :
如果我制作时间戳记,例如:
new GregorianCalendar().getTimeInMillis();
after every 10 seconds on the server how should the server check,if the time stamp is 5 minutes old or not ? 在服务器上每10秒钟后,如果时间戳记是否为5分钟,服务器应如何检查? Or may be there is an all together another way.
或者,也许还有另一种方式。
boolean isOld = System.currentTimeMillis() = someDate.getTime() > 300000; // 5 mins in ms
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.