1   /*
2    * $Id: AutoIncrementGreenMailSupport.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.email;
12  
13  import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
14  
15  public class AutoIncrementGreenMailSupport extends AbstractGreenMailSupport
16  {
17  
18      // something odd happening here?  50006 seems to have failed a
19      // couple of times?
20      public static final int INITIAL_SERVER_PORT = 50007;
21      // large enough to jump away from a group of related ports
22      public static final int PORT_INCREMENT = 17;
23      private static final AtomicInteger nextPort = new AtomicInteger(INITIAL_SERVER_PORT);
24  
25      protected int nextPort()
26      {
27          return nextPort.addAndGet(PORT_INCREMENT);
28      }
29  
30  }