org.apache.geronimo.javamail.store.pop3.connection
Class POP3ConnectionPool

java.lang.Object
  extended by org.apache.geronimo.javamail.store.pop3.connection.POP3ConnectionPool

public class POP3ConnectionPool
extends Object


Field Summary
protected  String authid
           
protected  POP3Connection availableConnection
           
protected  boolean closed
           
protected  boolean debug
           
protected static String DEFAULT_MAIL_HOST
           
protected  String host
           
protected static String MAIL_AUTHORIZATIONID
           
protected static String MAIL_PORT
           
protected static String MAIL_SASL_REALM
           
protected  String password
           
protected  int port
           
protected  ProtocolProperties props
           
protected  String realm
           
protected  POP3Store store
           
protected  String username
           
 
Constructor Summary
POP3ConnectionPool(POP3Store store, ProtocolProperties props)
          Create a connection pool associated with a give POP3Store instance.
 
Method Summary
 void close()
          Close the entire connection pool.
protected  POP3Connection createPoolConnection()
          Creates an authenticated pool connection and adds it to the connection pool.
 POP3Connection getConnection()
          Get a connection from the pool.
 boolean protocolConnect(String host, int port, String username, String password)
          Manage the initial connection to the POP3 server.
 void releaseConnection(POP3Connection connection)
          Return a connection to the connection pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAIL_PORT

protected static final String MAIL_PORT
See Also:
Constant Field Values

MAIL_SASL_REALM

protected static final String MAIL_SASL_REALM
See Also:
Constant Field Values

MAIL_AUTHORIZATIONID

protected static final String MAIL_AUTHORIZATIONID
See Also:
Constant Field Values

DEFAULT_MAIL_HOST

protected static final String DEFAULT_MAIL_HOST
See Also:
Constant Field Values

store

protected POP3Store store

props

protected ProtocolProperties props

availableConnection

protected POP3Connection availableConnection

debug

protected boolean debug

host

protected String host

port

protected int port

username

protected String username

password

protected String password

realm

protected String realm

authid

protected String authid

closed

protected boolean closed
Constructor Detail

POP3ConnectionPool

public POP3ConnectionPool(POP3Store store,
                          ProtocolProperties props)
Create a connection pool associated with a give POP3Store instance. The connection pool manages handing out connections for both the Store and Folder and Message usage.

Parameters:
store - The Store we're creating the pool for.
props - The protocol properties abstraction we use.
Method Detail

protocolConnect

public boolean protocolConnect(String host,
                               int port,
                               String username,
                               String password)
                        throws MessagingException
Manage the initial connection to the POP3 server. This is the first point where we obtain the information needed to make an actual server connection. Like the Store protocolConnect method, we return false if there's any sort of authentication difficulties.

Parameters:
host - The host of the mail server.
port - The mail server connection port.
user - The connection user name.
password - The connection password.
Returns:
True if we were able to connect and authenticate correctly.
Throws:
MessagingException

createPoolConnection

protected POP3Connection createPoolConnection()
                                       throws MessagingException
Creates an authenticated pool connection and adds it to the connection pool. If there is an existing connection already in the pool, this returns without creating a new connection.

Throws:
MessagingException

getConnection

public POP3Connection getConnection()
                             throws MessagingException
Get a connection from the pool. We try to retrieve a live connection, but we test the connection's liveness before returning one. If we don't have a viable connection in the pool, we'll create a new one. The returned connection will be in the authenticated state already.

Returns:
A POP3Connection object that is connected to the server.
Throws:
MessagingException

releaseConnection

public void releaseConnection(POP3Connection connection)
                       throws MessagingException
Return a connection to the connection pool.

Parameters:
connection - The connection getting returned.
Throws:
MessagingException

close

public void close()
           throws MessagingException
Close the entire connection pool.

Throws:
MessagingException


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.