aspose file tools
The moose likes Java in General and the fly likes (architecture) threading, memcached ... etc Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "(architecture) threading, memcached ... etc" Watch "(architecture) threading, memcached ... etc" New topic
Author

(architecture) threading, memcached ... etc

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 757

Goal

For the purpose of this post, let's just say I'm trying to design a system that sends email.

Description

The client enters:
  • source email address
  • destination email address

  • However the system will only accept a request if there is no pending request with the same source email address. Basically it takes about 30 seconds and maybe longer to complete a request!

    e.g.

    Request #1 ( me@foo.com to she@some.info ) is accepted and now pending.

    If I submit a new request ( me@foo.com to him@here.org ) before the first request completes, system will reject it.

    Current thoughts

    I can easily do a sychronization on the source email address like this:


    However this will not work in a cluster of webservers. What are my alternatives ?

    Regards,

    Pho
    Nick Kelly
    Ranch Hand

    Joined: Jan 28, 2005
    Posts: 45
    Hi Pho,

    I assume if you're using a cluster of web servers you will have some sort of database to store information in?

    If so, you could have a database table to hold pending request details.

    Each time you receive a request to send an email you would check if there is already a corresponding row in the pending request table.
    If there is you reject it.
    If not, you add a row for it and then send the email.

    When the email is sent you delete the row from the pending request table.

    Hope that helps!
     
    I agree. Here's the link: http://jrebel.com/download
     
    subject: (architecture) threading, memcached ... etc
     
    Similar Threads
    JavaMail/James: Handle email bouncebacks?
    Validate a given url against valid comma seperated list of domain names
    Final in loop
    Correct email address for SCEA 5 part 2 submission
    Account registration and email activation