Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:22:26+00:00 2026-06-15T20:22:26+00:00

After every 5 seconds a node pings the server. If the ping is successful,

  • 0

After every 5 seconds a node pings the server. If the ping is successful, node’s time-stamp gets updated into the server database.After every 3 minutes server checks if there is any time-stamp older than 3 minutes. If it founds any,it removes the node from it’s database.

Now the problem. I am unable to implement this query. For example I want it in a rather simple way like :

// Get the server time-stamp in milliseconds

select LastPingedAt from JustPinged where LastPingedAt > 3 Minutes"

// If it finds any,delete each of them from the database.

The logic :
Let the server's time stamp at the point of checking be 'serverStamp'
Let the node's time stamp (time in milliseconds when it last pinged) in the 
database's table be 'nodeStamp'.

If ( serverStamp - nodeStamp > 3 minutes)
// Delete those nodes
If( severStamp - nodeStamp < 3 minutes)
// retain those nodes

I am unable to design a the query to implement further.

At any point, JustPinged table looks like :

--------------------------|----------------------
NodesThatJustPinged       |          LastPingedAt
--------------------------|-----------------------
 xxx.xxx.xxx.xxx          |          1355406367402
--------------------------|-----------------------
 yyy.yyy.yyy.yyy          |          1355406421277
--------------------------|-----------------------

The time is in milliseconds as from new GregorianCalendar().getTimeInMillis().

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:22:27+00:00Added an answer on June 15, 2026 at 8:22 pm

    There is no need to get all of the records and process them in your program. This can be done with a single SQL statement. All you need to execute is a statement like this:

    delete from JustPinged where CurrentTime - LastPingedAt > 180000;
    

    So you just need to build the string in Java, interpolating the current time value, and run it:

    String query = "delete from JustPinged where " +
         [your current time variable here] + " - LastPingedAt > 180000;";
    
    your_statement_object.executeQuery(query);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using node.js to query a MySQL database table every 10 seconds. Using
I have a loop which basically calls this every few seconds (after the timeout):
I developed a program which after every two minutes call db to check new
I want to update an column after every 20 minutes but it wont not
I am trying to autoreload my page after every 20 seconds. I am using
In my code i need to poll a url after every 5 seconds using
I want Java Timer to call function n times after every t seconds. I
I want to change the background image of the activity after every 30 seconds
<meta http-equiv=Refresh Content=5> This script reloads or refresh the page after every 5 seconds.
Currently I am drawing a Circle on my Current Location after every 35 seconds

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.