You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org> on 2009/03/20 15:14:50 UTC

[jira] Created: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

SMTP transport can receive more than one message at same time
-------------------------------------------------------------

                 Key: WSCOMMONS-454
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
             Project: WS-Commons
          Issue Type: Bug
            Reporter: Amila Chinthaka Suriarachchi
            Priority: Blocker


hi all,

recently I started some RM tests with the commons mail transport.
Mail transport listener runs in a timer task.

TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                 workerPool.execute(new Runnable() {
                    public void run() {
                         if (state == BaseConstants.PAUSED) {
                            if (log.isDebugEnabled()) {
                                log.debug("Transport " + getTransportName() +
                                        " poll trigger : Transport is currently paused..");
                            }
                        } else {
                            poll(entry);
                        }
                        synchronized (entry) {
                            if (!entry.canceled) {
                                schedulePoll(entry, pollInterval);
                            }
                        }
                    }
                });

            }
        };
        entry.timerTask = timerTask;
        timer.schedule(timerTask, pollInterval)

As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.

In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
it can not receive the message number 1.

I tested this this the following sample.

TimerTask timerTask = new TimerTask(){

            public void run() {
                System.out.println("In the timer task");
                try {
                    Thread.sleep(60000);
                } catch (InterruptedException e) {
                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                }
                System.out.println("Going out of timer task");
            }
        };

        Timer timer = new Timer("Testtimer");
        timer.schedule(timerTask,0, 1000);

And I saw timer task does not run until it finishes the first task.

Can we start a new thread to each new message? That is how earlier SMTP transport had done that.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689861#action_12689861 ] 

Andreas Veithen commented on WSCOMMONS-454:
-------------------------------------------

The fact that the client transmits messages in Sequence message order doesn't imply that the service will receive them in the right order. That actually depends on the transport protocols used between the client and the service, i.e. SMTP and POP3/IMAP in this case. I don't think that these protocols provide any guarantee on message order.

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689878#action_12689878 ] 

Amila Chinthaka Suriarachchi commented on WSCOMMONS-454:
--------------------------------------------------------

yes we can not guarantee the message ordering at the transport level.
But I think this means RMS client should not send the message#2 until it receives acknowledgement for message #1.

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on WSCOMMONS-454 started by Asankha C. Perera.

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693618#action_12693618 ] 

Andreas Veithen commented on WSCOMMONS-454:
-------------------------------------------

Asankha,

Your solution involves tasks (the ones responsible for polling) that add new tasks (the ones that process the messages) to the task queue and then wait for their completion. Considering that all these tasks are executed using a single thread pool and that the number of threads in this pool is bounded, how can you guarantee that the transport never gets into a state where all threads are allocated to tasks of the first kind waiting for tasks of the second kind (which can never complete because all threads are taken by tasks of the first kind)?

When I started working on SYNAPSE-434 I didn't find any convincing argument showing that this could never happen, except if concurrent polls are disallowed and the size of the thread pool is at least N+1, where N is the number of services listening on the transport. Now that concurrent polls are allowed this argument breaks down too. To avoid this problem I started to implemented a different pattern (but I never completed the refactoring of AbstractPollingTransportListener), where the polling task terminates early and then let the processing tasks coordinate themselves such that the last one that completes does the cleanup job (closes the connection, etc.). Since in that approach there are no tasks waiting for other tasks to complete, it can be easily proven that no deadlock will ever occur.


> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>             Fix For: Transports 1.0
>
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689072#action_12689072 ] 

Asankha C. Perera commented on WSCOMMONS-454:
---------------------------------------------

It seems like POP3 never allows you to download mail in parallel. The only Google result I came across was [1] "if you have thousands of messages sitting on the POP server which have never been downloaded on a given client, it will take quite a while to download them as well, even longer if your POP server is not capable of sending messages in parallel". Since POP3 is a simple protocol with one connection to port 110 etc, I do not see a way to provide parallel retrieval anyway.. usually POP3 servers does not even allow the same client to re-connect after a NW disconnect, until a timeout of a few minutes

So I am going to provide a parameter in the MailTransportListener if parallel processing is to be allowed or not. Default will be to not process in parallel. If anyone knows a POP3 mail server that supports parallel retrieval let me know :)

[1] http://wooga.drbacchus.com/pop-vs-imap#comment-980

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera resolved WSCOMMONS-454.
-----------------------------------------

       Resolution: Fixed
    Fix Version/s: Transports 1.0

Now the mail transport supports both parallel processing as well as optional concurrent polling. This allows even the POP3 use case to process multiple messages at once.

The AbstractPollingTransport now understands an optional service level parameter:
        <parameter name="transport.ConcurrentPollingAllowed">false</parameter>

When set to true, polling will occur at the scheduled interval, even while previous polling runs have not completed. However, care has been taken not to process the same message twice, and was tested with both IMAP and POP3. [Note: Some POP3 servers may disable concurrent login to the same mailbox, and in such cases this option should not be used]

The mail transport understands an optional service level parameter:
        <parameter name="transport.mail.ProcessInParallel">true</parameter>

When set to true, each message is processed by a separate worker thread. With IMAP, logs shows that multiple messages are indeed even fetched - in parallel.

e.g. A digest log with IMAP

A44 FETCH 2 (BODY[TEXT]<0.16384>)
* 2 FETCH (BODY[TEXT]<0> {16384}
A45 FETCH 1 (BODY[TEXT]<0.16384>)
* 1 FETCH (BODY[TEXT]<0> {16384}
A46 FETCH 1 (BODY[TEXT]<16384.16384>)
* 1 FETCH (BODY[TEXT]<16384> {16384}
A47 FETCH 2 (BODY[TEXT]<16384.16384>)
* 2 FETCH (BODY[TEXT]<16384> {16384}

The code has been tested with IMAP and POP3 against Gmail, for all 4 scenarios the above two options now makes available.

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>             Fix For: Transports 1.0
>
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694284#action_12694284 ] 

Andreas Veithen commented on WSCOMMONS-454:
-------------------------------------------

No I didn't start to modify AbstractPollingTransportListener. I only started to think about how to implement this without making the code in AbstractPollingTransportListener (and subclasses) more complex. I started to create an abstraction of the concept of a task group with a completion action (with two implementations: one for a thread pool and one executing the tasks sequentially in a single thread), but I think the code is not complete.

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>             Fix For: Transports 1.0
>
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera reassigned WSCOMMONS-454:
-------------------------------------------

    Assignee: Asankha C. Perera

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683895#action_12683895 ] 

Andreas Veithen commented on WSCOMMONS-454:
-------------------------------------------

I think this issue duplicates SYNAPSE-434 (which has been on my todo list for quite some time). Can you confirm?

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693634#action_12693634 ] 

Asankha C. Perera commented on WSCOMMONS-454:
---------------------------------------------

Andreas

Thanks for bringing this possibility into focus.. Have you made any changes to the AbstractPollingTransportListener or shall I fix this? It would be fairly easy to inject this logic the way you have propose and is the perfect solution

thanks
asankha

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>             Fix For: Transports 1.0
>
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689093#action_12689093 ] 

Andreas Veithen commented on WSCOMMONS-454:
-------------------------------------------

I think that for most use cases it is OK not to start a new poll before all messages in the current poll have been processed. However there is value in enhancing the POP3/IMAP transport listener to allow processing of these messages in parallel (as I suggested in SYNAPSE-434). I really mean concurrent processing here, and not concurrent polls or concurrent downloading.

For the RM use case, I have some doubts that people really want to do RM over POP3/IMAP and I would suggest a completely different approach, which is to implement an SMTP transport listener. To me, this would make much more sense because such a transport would not use polling but be able to accept messages as they arrive. Probably it would even be easier to implement this SMTP transport from scratch than to sort out all the possible concurrency issues that may arise in the POP3/IMAP transport. I remember that there has been a discussion between Paul and me where we identified at least two Java implementations of the SMTP protocol that could be used for this.

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-454) SMTP transport can receive more than one message at same time

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689860#action_12689860 ] 

Amila Chinthaka Suriarachchi commented on WSCOMMONS-454:
--------------------------------------------------------

As far as RM is concerned this should not be a problem. the reply model spec says

I) The Client SHOULD transmit messages in the Sequence message order.

so it is not possible to receive messages out of order.

[1] http://wso2.org/node/2792

> SMTP transport can receive more than one message at same time
> -------------------------------------------------------------
>
>                 Key: WSCOMMONS-454
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-454
>             Project: WS-Commons
>          Issue Type: Bug
>            Reporter: Amila Chinthaka Suriarachchi
>            Assignee: Asankha C. Perera
>            Priority: Blocker
>
> hi all,
> recently I started some RM tests with the commons mail transport.
> Mail transport listener runs in a timer task.
> TimerTask timerTask = new TimerTask() {
>             @Override
>             public void run() {
>                  workerPool.execute(new Runnable() {
>                     public void run() {
>                          if (state == BaseConstants.PAUSED) {
>                             if (log.isDebugEnabled()) {
>                                 log.debug("Transport " + getTransportName() +
>                                         " poll trigger : Transport is currently paused..");
>                             }
>                         } else {
>                             poll(entry);
>                         }
>                         synchronized (entry) {
>                             if (!entry.canceled) {
>                                 schedulePoll(entry, pollInterval);
>                             }
>                         }
>                     }
>                 });
>             }
>         };
>         entry.timerTask = timerTask;
>         timer.schedule(timerTask, pollInterval)
> As I saw timer task only  re activates only after  earlier invocation finish. i.e  after completing the message.
> In RM inorder delivery case lets say we receive message number 2 before 1. then the initial thread does not return and
> it can not receive the message number 1.
> I tested this this the following sample.
> TimerTask timerTask = new TimerTask(){
>             public void run() {
>                 System.out.println("In the timer task");
>                 try {
>                     Thread.sleep(60000);
>                 } catch (InterruptedException e) {
>                     e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
>                 }
>                 System.out.println("Going out of timer task");
>             }
>         };
>         Timer timer = new Timer("Testtimer");
>         timer.schedule(timerTask,0, 1000);
> And I saw timer task does not run until it finishes the first task.
> Can we start a new thread to each new message? That is how earlier SMTP transport had done that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.