net.sf.hajavamail
Class TransportProxy

java.lang.Object
  extended by javax.mail.Service
      extended by javax.mail.Transport
          extended by net.sf.hajavamail.TransportProxy

public class TransportProxy
extends Transport

Since:
1.0
Version:
$Revision: 1.3 $
Author:
Paul Ferraro

Field Summary
static String CONNECT_RETRY_PERIOD
           
static String CONNECT_TIMEOUT
           
static String POOL_SIZE
           
static String SENDER_STRATEGY
           
 
Fields inherited from class javax.mail.Service
debug, session, url
 
Constructor Summary
TransportProxy(Session session, URLName url)
          Constructs a new TransportProxy.
 
Method Summary
 void addTransportListener(TransportListener listener)
           
 void close()
          Closes the Transport proxy.
protected  void finalize()
          Closes the transpory proxy, if not closed already.
protected  boolean protocolConnect(String hostList, int port, String user, String password)
          Creates and starts a new connector thread for each underlying transport.
 void removeTransportListener(TransportListener listener)
           
 void sendMessage(Message message, Address[] addresses)
          Performs simple message validation before sending using the sender strategy configured via the SENDER_STRATEGY session property.
 
Methods inherited from class javax.mail.Transport
notifyTransportListeners, send, send
 
Methods inherited from class javax.mail.Service
addConnectionListener, connect, connect, connect, getURLName, isConnected, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POOL_SIZE

public static final String POOL_SIZE
See Also:
Constant Field Values

SENDER_STRATEGY

public static final String SENDER_STRATEGY
See Also:
Constant Field Values

CONNECT_RETRY_PERIOD

public static final String CONNECT_RETRY_PERIOD
See Also:
Constant Field Values

CONNECT_TIMEOUT

public static final String CONNECT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

TransportProxy

public TransportProxy(Session session,
                      URLName url)
               throws MessagingException
Constructs a new TransportProxy.

Parameters:
session -
url -
Throws:
MessagingException
Method Detail

protocolConnect

protected boolean protocolConnect(String hostList,
                                  int port,
                                  String user,
                                  String password)
                           throws MessagingException
Creates and starts a new connector thread for each underlying transport. This method returns after the first successful transport connection is made.

Overrides:
protocolConnect in class Service
Throws:
MessagingException - if no transports were connected within the timeout configured via the CONNECT_TIMEOUT session property.
See Also:
Service.protocolConnect(java.lang.String, int, java.lang.String, java.lang.String)

sendMessage

public void sendMessage(Message message,
                        Address[] addresses)
                 throws MessagingException
Performs simple message validation before sending using the sender strategy configured via the SENDER_STRATEGY session property.

Specified by:
sendMessage in class Transport
Throws:
MessagingException
See Also:
Transport.sendMessage(javax.mail.Message, javax.mail.Address[])

addTransportListener

public void addTransportListener(TransportListener listener)
Overrides:
addTransportListener in class Transport
See Also:
Transport.addTransportListener(javax.mail.event.TransportListener)

removeTransportListener

public void removeTransportListener(TransportListener listener)
Overrides:
removeTransportListener in class Transport
See Also:
Transport.removeTransportListener(javax.mail.event.TransportListener)

close

public void close()
           throws MessagingException
Closes the Transport proxy. Implementation is as follows:
  1. Waits until until all sender threads have completed.
  2. Interrupts the execution of any active connector threads
  3. Closes the underlying transports
  4. Calls javax.mail.Service.close()

Overrides:
close in class Service
Throws:
MessagingException
See Also:
Service.close()

finalize

protected void finalize()
                 throws Throwable
Closes the transpory proxy, if not closed already.

Overrides:
finalize in class Service
Throws:
Throwable
See Also:
Object.finalize()