Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-20-2008, 02:24 AM
Member
 
Join Date: Oct 2008
Posts: 4
Rep Power: 0
sheky is on a distinguished road
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 ??
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 10-20-2008, 02:50 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 571
Rep Power: 2
fishtoprecords is on a distinguished road
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.?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 10-20-2008, 10:36 AM
Member
 
Join Date: Oct 2008
Posts: 4
Rep Power: 0
sheky is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 10-20-2008, 08:39 PM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 571
Rep Power: 2
fishtoprecords is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 10-21-2008, 10:13 AM
Member
 
Join Date: Oct 2008
Posts: 4
Rep Power: 0
sheky is on a distinguished road
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!

thx
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 10-21-2008, 04:16 PM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 571
Rep Power: 2
fishtoprecords is on a distinguished road
Default
Start a thread, have its mail loop look lile:

Code:
public void run() {
  boolean done = false;
  while (!done) {
      Thread.sleep(100);
       dosomething();
    }
}
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
send email using apache commons email jnamendi JavaServer Faces 0 10-14-2008 06:55 PM
passing a value from parent thread to child thread sachinj13 Threads and Synchronization 7 09-07-2008 10:06 PM
data from the main/GUI thread to another runnin thread... cornercuttin Threads and Synchronization 2 04-23-2008 11:30 PM
If JNI thread call the java object in another thread, it will crash. skaterxu Advanced Java 0 01-28-2008 08:02 AM
Creating a Thread (extending Java Thread Class) JavaForums Java Blogs 0 12-19-2007 10:31 AM


All times are GMT +2. The time now is 11:08 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org