Results 1 to 6 of 6
  1. #1
    sheky is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Question Check email by background thread

    hello..
    I need some advice or directions, how to make a web application which will check email every 10sec by thread and work some basic background job, depends of email contents.. (update database)
    And after that show results in browsers..

    Maybe I need make that with servlet ??

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    You could make it a servlet, but lets back up a notch.

    Most things that alert on email run on the client. Could be a laptop, desktop, blackberry, iPhone, etc. Its the client that can easily display things to the user, ring bells, make sounds, etc.

    Its not clear what the "web application" would do. Email is kept on a server, and most folks pull it down to their local machine to read the messages.

    Are you sure you want to use these terms: servlet, web application, etc.?

  3. #3
    sheky is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Smile

    Yes, I must use email check on server side, every 10, od 20 sec in background, depends of email contents update some elements of database.

    Its not problem work with email, my problem is how to run some background job every 10 sec in servlet, after deploy on GlasshFish. Because complete solution will be web application that communicate with other web service (or web pages), and collect data from them, and update database with collected data.

  4. #4
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    If I was the sysadmin for the mail server, and I found your code checking every 10 seconds, I'd strangle you.

    Its trivial to setup a daemon thread in Java and run it under any controller, Glassfish, Tomcat, JBoss, etc.

    What is your problem?

  5. #5
    sheky is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Default

    I now! I due the same!
    But I'm a student, and for part of project solution we need to make 2 web services that communicate with email (what is ridiculous), best way to due this is with wsdl, but user request is to work with email and due some background jobs depends of command included in message.

    Second part of first web service is to check weather wsdl every 10min, and update local database..

    So.. my question still is how to run background thread every 10sec (min)? What is best solution...? Some advice, except to change user request, but that is not on me! :rolleyes:

    thx ;)

  6. #6
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Start a thread, have its mail loop look lile:

    Java Code:
    public void run() {
      boolean done = false;
      while (!done) {
          Thread.sleep(100);
           dosomething();
        }
    }

Similar Threads

  1. send email using apache commons email
    By jnamendi in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 10-14-2008, 06:55 PM
  2. passing a value from parent thread to child thread
    By sachinj13 in forum Threads and Synchronization
    Replies: 7
    Last Post: 09-07-2008, 10:06 PM
  3. data from the main/GUI thread to another runnin thread...
    By cornercuttin in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-23-2008, 11:30 PM
  4. Replies: 0
    Last Post: 01-28-2008, 08:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •