Remove from array after a period of time
I'm having trouble with people flooding my java app with connections, and right now I have it so that if an IP opens more then 2 connections at once with it, it adds it to a "bad connections" array and disallows that ip from connecting.
But.. I'm having trouble thinking of how I would go about making it so that after the IP has been in the bad connections array for a minute, it removes it from the array.
Re: Remove from array after a period of time
First of all I guess you would have to store the ip and the time it was added to the list. Have some sort of timed job running that loops through the list every so often and clears out and ip that was added more than 1 minute ago. This could possibly be done implementing Runnable or by a TimerTask of some sort.