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

  • Home
  • SEARCH
  • 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 892929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:08:20+00:00 2026-05-15T14:08:20+00:00

Im developing the java Email application with Timer, I have a two arraylists named

  • 0

Im developing the java Email application with Timer, I have a two arraylists named ActiveProcesses,InActiveProcesses. If I start the Timer it will send the Email with InActiveProcesses list values for every seconds. But the problem is the timer is sent the Email if the InActiveProcesses list values is same.For Example the InActiveProcess list contains the value abcd, it will send Email every seconds with same List values. I want to send the Email only the InActiveProcesses list contains different values. The Timer will check the values every seconds if the values are different it will send the Email. How to handle this problem using java. Thanks in advance. Here is the code,

for (int i = 0; i < InActiveProcess.size(); i++)
{
    if (!ActiveProcess.contains(InActiveProcess.get(i)))
    {
        list3.add(InActiveProcess.get(i));
    }
}
for (int i = 0; i < ActiveProcess.size(); i++)
{
    if (!InActiveProcess.contains(ActiveProcess.get(i)))
    {
        list3.add(ActiveProcess.get(i));
    }
}
log.info("Processes which are Not Running: " + list3);

StringBuilder sb = new StringBuilder();

for (int k = 0; k < list3.size(); k++)
{

    Result = list3.get(k);

    sb.append(Result.toString());

    sb.append(" ");

}

String message = sb.toString();

log.info(message);

sms.SendMessage("1254554555", message);

es.SendMail("abcdr@gmail.com", " Server process is down", message);

This is my Timer class.

int delay = 5000; // delay for 5 sec.

int interval = 1000; // iterate every sec.

Timer timer = new Timer();

        timer.scheduleAtFixedRate(new sample() {

        }, delay, interval);

The Timer is Execute the sample() class for Every seconds and sent Email to specified Address. I want to handle the Timer will Execute for every second at the same time, the Email is sent es.SendMail("abcdr@gmail.com", " Server process is down", message); if message contains values is different.

  • 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-05-15T14:08:21+00:00Added an answer on May 15, 2026 at 2:08 pm

    Update: The question changed after posting this answer. This is the answer to the original question:

    You can use a Timer class.

    You can schedule actions to be taken when the timer is off through a TimerTask. This class is abstract so you have to extend it and implement the method run().

    class MyTimerTask extends TimerTask {
    
       @Override
       public void run(){
       // Task to do here
     }
    }
    

    And then in your main class

    MyTimerTask task = new MyTimerTask(); // this class implements WHAT to do inside the method run();
    Date date = new Date(...) // This class will tell timer WHEN to do the task
    Timer timer = new Timer(task,date); //Good to go!
    

    Alternatively you can do Timer timer = new Timer(task,delay) to have the task executed after delay miliseconds

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 494k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just do it: record.destroyed? Details are here ActiveRecord::Persistence May 16, 2026 at 11:00 am
  • Editorial Team
    Editorial Team added an answer Okay, silly silly me. It must've been the fatigue or… May 16, 2026 at 11:00 am
  • Editorial Team
    Editorial Team added an answer You don't need the Serializable attribute for XML serialization I… May 16, 2026 at 11:00 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm developing a Java app on the Windows platform, and my application needs to
We are working on developing a Java EE based application. Our application is Java
i'm developing an application running on WebLogic 10 and of course in java. Ok,
Having to interact with several different email servers via IMAP (using javamail), I have
I am developing a small utility application emailafriend using Spring. The basic functionality is
I'm developing a java web service, with client certificate security enabled. I don't want
I've got a small Java program that I'm developing for a project, which pulls
I'm developing in Java and using JUnit to test some of my methods. Some
We'd like to send a single email which has multiple contents attached. Scenario is
Since I'm used to developing in Java, I'm familiar with what files get generated

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.