简体   繁体   English

如果节点创建的时间戳少于或超过五分钟,我应该如何使服务器检查?

[英]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 : 问题:

  • When a node pings the server, server manages to store the node information but it ( I ) doesn't know how to make a time stamp in the database, so that after the server time out (lets say 5 minutes) it deletes the node information. 当节点对服务器执行ping操作时,服务器设法存储该节点的信息,但是它( I )不知道如何在数据库中制作时间戳,因此在服务器超时(例如5分钟)后,它将删除该节点信息。

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.

相关问题 如何检查事件是否少于30分钟? - How to check if event is less than 30 minutes? 如何检查2个日期之间的差异是否超过20分钟 - How to check if the difference between 2 dates is more than 20 minutes 如果它少于或多于 4 位,我如何让它显示错误消息? | Java - How do I make it to show an error message if it's less or more than 4 digits? | Java 如果一个或多个变量小于0,如何使if语句不执行并转到else if语句? - How do I make an if statement not execute and go to the else if statement if one or more variables are less than 0? 如果时间跨度重叠且少于30分钟,则对日志记录条目进行分组? - Group logging entries if time span overlap and less than 30 minutes? 我如何以编程方式同时在单个节点上应用不止一种样式 - How can i apply more than 1 style to a single node at the same time programmatically 如何在列表中多次检入GSP Grails - How do I check in GSP Grails more than one time in list 如何为我已经拥有的时间戳添加分钟? - How to add minutes to a time stamp that I already have? 你如何进行大于或小于字符串的比较 - How do you do a compare of more than or less than with string 我在Java服务器中拥有五个线程,如何使它们同时运行一个任务? - I hava five threads in java server, how should I do to make them run one task concurrently?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM