Fields Summary |
---|
private static final Logger | log |
public static final Method | ON_MESSAGEThe MailListener.onMessage method |
private boolean | releasedA flag indicated if the unit of work has been released |
private boolean | traceThe logging trace level flag |
private long | nextNewMsgCheckTimeThe time at which the next new msgs check should be performed |
protected org.jboss.resource.adapter.mail.MailResourceAdapter | raThe resource adapter |
protected MailActivationSpec | specThe activation spec for the mail folder |
protected javax.resource.spi.endpoint.MessageEndpointFactory | endpointFactoryThe message endpoint factory |
Methods Summary |
---|
public int | compareTo(java.lang.Object obj)
MailActivation ma = (MailActivation) obj;
long compareTo = nextNewMsgCheckTime - ma.getNextNewMsgCheckTime();
return (int) compareTo;
|
private void | deliverMsg(javax.mail.Message msg)
MessageEndpoint endpoint = null;
try
{
endpoint = endpointFactory.createEndpoint(null);
if (endpoint != null)
{
if( trace )
log.trace("deliverMsg, msg subject="+msg.getSubject());
MailListener listener = (MailListener) endpoint;
listener.onMessage(msg);
}
}
catch (Throwable e)
{
log.debug("onMessage delivery failure", e);
}
finally
{
if (endpoint != null)
{
endpoint.release();
}
}
|
public long | getNextNewMsgCheckTime()
return nextNewMsgCheckTime;
|
public boolean | isReleased()
return released;
|
public void | release()
released = true;
if( trace )
log.trace("released");
|
public void | run()
released = false;
if( trace )
log.trace("Begin new msgs check");
try
{
MailFolder mailFolder = new MailFolder(spec);
mailFolder.open();
Message[] msgs = mailFolder.getNewMessages();
for(int n = 0; released == false && n < msgs.length; n ++)
{
Message msg = msgs[n];
deliverMsg(msg);
}
mailFolder.close();
}
catch (Exception e)
{
log.error("Failed to execute folder check, spec="+ spec, e);
}
if( trace )
log.trace("End new msgs check");
|
public void | updateNextNewMsgCheckTime(long now)
nextNewMsgCheckTime = now + spec.getPollingInterval();
|