|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.barracudamvc.core.event.DefaultEventPool
public class DefaultEventPool
This class acts as a pool for Events. Should significantly improve performance by allowing us to reuse event objects.
Field Summary | |
---|---|
protected long |
cleanupInterval
|
static long |
DEFAULT_CLEANUP_INTERVAL
|
static int |
DEFAULT_MAX_RETRIES
|
static int |
DEFAULT_POOL_SIZE
|
static long |
DEFAULT_RETRY_INTERVAL
|
static long |
DEFAULT_TIMEOUT
|
protected Map |
eventMap
|
protected long |
lastCleanup
|
protected long |
lastUpdate
|
protected static org.apache.log4j.Logger |
logger
|
protected int |
maxRetries
|
protected int |
poolSize
|
protected long |
retryInterval
|
protected Object |
sync
|
protected long |
timeout
|
Constructor Summary | |
---|---|
DefaultEventPool()
Default constructor. |
|
DefaultEventPool(int ipoolSize,
long itimeout,
long iretryInterval,
int imaxRetries,
long icleanupInterval)
Public constructor. |
Method Summary | |
---|---|
BaseEvent |
checkoutEvent(Class event)
check out an event from the EventPool. |
void |
cleanupLockedEvents()
Cleanup any locked events which weren't released (they should all be). |
void |
releaseEvent(BaseEvent event)
check the event back in, allowing someone else to have access to it. |
void |
shutdown()
Shutdown the event pool |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger logger
public static int DEFAULT_POOL_SIZE
public static long DEFAULT_TIMEOUT
public static long DEFAULT_RETRY_INTERVAL
public static int DEFAULT_MAX_RETRIES
public static long DEFAULT_CLEANUP_INTERVAL
protected Map eventMap
protected int poolSize
protected long timeout
protected long retryInterval
protected int maxRetries
protected long cleanupInterval
protected long lastUpdate
protected long lastCleanup
protected Object sync
Constructor Detail |
---|
public DefaultEventPool()
public DefaultEventPool(int ipoolSize, long itimeout, long iretryInterval, int imaxRetries, long icleanupInterval)
ipoolSize
- - how many event instances to keep for each
class of event)itimeout
- - how long may an event be checked out before
it may be reclaimed by the pooliretryInterval
- - how long between retries if there are no
events currently availableimaxRetries
- - maximum number of retriesicleanupInterval
- - how often should the cleanup thread run (millisecs).Method Detail |
---|
public BaseEvent checkoutEvent(Class event) throws NoAvailableEventsException, InvalidClassException
checkoutEvent
in interface EventPool
event
- the class of event we are interested in checking out
NoAvailableEventsException
- if there are no available events in the queue
InvalidClassException
- if the event class is not validpublic void releaseEvent(BaseEvent event)
releaseEvent
in interface EventPool
event
- the event we're releasing our lock onpublic void cleanupLockedEvents()
cleanupLockedEvents
in interface EventPool
public void shutdown()
shutdown
in interface EventPool
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |