com.goldeninnovations.smp.messagespool
Class MemoryMessageSpool

java.lang.Object
  extended by com.goldeninnovations.smp.messagespool.MemoryMessageSpool
All Implemented Interfaces:
MessageSpool

public class MemoryMessageSpool
extends Object
implements MessageSpool

An in-memory blocking MessageSpool implementation. Fastest Spool Implementation but provides no data persistence or recovery options.

Default MessageSpool


Constructor Summary
MemoryMessageSpool()
           
 
Method Summary
 EmailMessage createMessage()
          Factory method called when a new message is being processed.
 EmailMessage deSpoolMessage()
          Returns the newt EmailMessage in the spool.
 boolean spoolMessage(EmailMessage message)
          Stores a new message in the spool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryMessageSpool

public MemoryMessageSpool()
Method Detail

createMessage

public EmailMessage createMessage()
Description copied from interface: MessageSpool
Factory method called when a new message is being processed. Allows MessageSpool implementation to provide a custom EmailMessage implementation.

Specified by:
createMessage in interface MessageSpool
Returns:
a new concrete EmailMessage.

spoolMessage

public boolean spoolMessage(EmailMessage message)
Description copied from interface: MessageSpool
Stores a new message in the spool. Once this method returns, the SMPServer assumes it has been saved and can notify the sender that the message was accepted.

Specified by:
spoolMessage in interface MessageSpool
Parameters:
message - the EmailMessage to spool.
Returns:
false if the message was not saved successfully.

deSpoolMessage

public EmailMessage deSpoolMessage()
                            throws InterruptedException
Description copied from interface: MessageSpool
Returns the newt EmailMessage in the spool. If the spool is empty, implementations can either return null, or block until the next available message.

Specified by:
deSpoolMessage in interface MessageSpool
Returns:
the next EmailMessage, or null if queue is empty and non-blocking.
Throws:
InterruptedException - thrown for blocking implementations that are interrupted.


Copyright © 2010 Eric Daugherty. All Rights Reserved.