com.latencybusters.lbm
Class LBMObjectRecycler

java.lang.Object
  extended by com.latencybusters.lbm.LBMObjectRecyclerBase
      extended by com.latencybusters.lbm.LBMObjectRecycler

public class LBMObjectRecycler
extends LBMObjectRecyclerBase

Basic implementation of an object recycler that implements all supported LBM object types. The size limits for the object pools for each object type can be tuned and should be set immediately after instantiating the class and before using any instance of the class. This implementation is synchronized on a per object type basis(doneWithMessage/retrieveMessage, doneWithReceiverStatistics/retrieveReceiverStatistics, etc) via a thread local pool of objects and a synchronized shared pool of objects.


Constructor Summary
LBMObjectRecycler()
           
 
Method Summary
 void close()
          A method to clean up all objects referenced by the recycler when the application is closing (which will dispose all of the stats objects in the recycler).
 void disposeThreadLocals()
          A convenience method to clean up thread local variables if needed.
 void doneWithAsyncOperationInfo(LBMAsyncOperationInfo obj)
          Call when finished with a LBMAsyncOperationInfo object.
 void doneWithContextSourceEvent(LBMContextSourceEvent obj)
          Call when finished with a LBMContextSourceEvent object.
 void doneWithContextStatistics(LBMContextStatistics obj)
          Call when finished with a LBMContextStatistics object.
 void doneWithEventQueueStatistics(LBMEventQueueStatistics obj)
          Call when finished with a LBMEventQueueStatistics object.
 void doneWithImmediateMessageReceiverStatistics(LBMImmediateMessageReceiverStatistics obj)
          Call when finished with a LBMImmediateMessageReceiverStatistics object.
 void doneWithImmediateMessageSourceStatistics(LBMImmediateMessageSourceStatistics obj)
          Call when finished with a LBMImmediateMessageSourceStatistics object.
 void doneWithMessage(LBMMessage obj)
          Call when finished with a LBMMessage object.
 void doneWithReceiverStatistics(LBMReceiverStatistics obj)
          Call when finished with a LBMReceiverStatistics object.
 void doneWithSourceEvent(LBMSourceEvent obj)
          Call when finished with a LBMSourceEvent object.
 void doneWithSourceStatistics(LBMSourceStatistics obj)
          Call when finished with a LBMSourceStatistics object.
 int getLocalPoolAsyncOperationInfoCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolContextSourceEventCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolContextStatisticsCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolEventQueueStatisticsCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolImmediateMessageReceiverStatisticsCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolImmediateMessageSourceStatisticsCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolMessageCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolReceiverStatisticsCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolSourceEventCount()
          Gets the current number of objects in the local pool.
 int getLocalPoolSourceStatisticsCount()
          Gets the current number of objects in the local pool.
 LBMAsyncOperationInfo retrieveAsyncOperationInfo(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMContextSourceEvent retrieveContextSourceEvent(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMContextStatistics retrieveContextStatistics(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMEventQueueStatistics retrieveEventQueueStatistics(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMImmediateMessageReceiverStatistics retrieveImmediateMessageReceiverStatistics(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMImmediateMessageSourceStatistics retrieveImmediateMessageSourceStatistics(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMMessage retrieveMessage(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMReceiverStatistics retrieveReceiverStatistics(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMSourceEvent retrieveSourceEvent(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 LBMSourceStatistics retrieveSourceStatistics(java.lang.Object cbObj)
          LBM will call this method to attempt to retrieve an object that it can reuse.
 int returnAllAsyncOperationInfosToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllContextSourceEventsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllContextStatisticsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllEventQueueStatisticsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllImmediateMessageReceiverStatisticsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllImmediateMessageSourceStatisticsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllMessagesToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllReceiverStatisticsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllSourceEventsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 int returnAllSourceStatisticsToSharedPool()
          Returns all of the objects in the local pool back to the shared pool.
 void setLocalAsyncOpInfosPoolSize(int size)
          Sets the size of the thread local pool of LBMAsyncOperationInfo for all LBMObjectRecyclers (defaults to 10)
 void setLocalCtxSrcEvPoolSize(int size)
          Sets the size of the thread local pool of LBMContextSourceEvents for all LBMObjectRecyclers (defaults to 10)
 void setLocalCtxStatsPoolSize(int size)
          Sets the size of the thread local pool of LBMContextStatistics for all LBMObjectRecyclers (defaults to 10)
 void setLocalEvqStatsPoolSize(int size)
          Sets the size of the thread local pool of LBMEventQueueStatistics for all LBMObjectRecyclers (defaults to 10)
 void setLocalIMRcvStatsPoolSize(int size)
          Sets the size of the thread local pool of LBMImmediateMessageReceiverStatistics for all LBMObjectRecyclers (defaults to 10)
 void setLocalIMSrcStatsPoolSize(int size)
          Sets the size of the thread local pool of LBMImmediateMessageSourceStatistics for all LBMObjectRecyclers (defaults to 10)
 void setLocalMsgPoolSize(int size)
          Sets the size of the thread local pool of LBMMessages for all LBMObjectRecyclers (defaults to 1000)
 void setLocalRcvStatsPoolSize(int size)
          Sets the size of the thread local pool of LBMReceiverStatistics for all LBMObjectRecyclers (defaults to 10)
 void setLocalSrcEvPoolSize(int size)
          Sets the size of the thread local pool of LBMSourceEvents for all LBMObjectRecyclers (defaults to 10)
 void setLocalSrcStatsPoolSize(int size)
          Sets the size of the thread local pool of LBMSourceStatistics for all LBMObjectRecyclers (defaults to 10)
 void setSharedAsyncOpInfosPoolSize(int size)
          Sets the size of the shared pool of LBMAsyncOperationInfo for all LBMObjectRecyclers (defaults to 20)
 void setSharedCtxSrcEvPoolSize(int size)
          Sets the size of the shared pool of LBMContextSourceEvents for all LBMObjectRecyclers (defaults to 20)
 void setSharedCtxStatsPoolSize(int size)
          Sets the size of the shared pool of LBMContextStatistics for all LBMObjectRecyclers (defaults to 20)
 void setSharedEvqStatsPoolSize(int size)
          Sets the size of the shared pool of LBMEventQueueStatistics for all LBMObjectRecyclers (defaults to 20)
 void setSharedIMRcvStatsPoolSize(int size)
          Sets the size of the shared pool of LBMImmediateMessageReceiverStatistics for all LBMObjectRecyclers (defaults to 20)
 void setSharedIMSrcStatsPoolSize(int size)
          Sets the size of the shared pool of LBMImmediateMessageSourceStatistics for all LBMObjectRecyclers (defaults to 20)
 void setSharedMsgPoolSize(int size)
          Sets the size of the shared pool of LBMMessages for all LBMObjectRecyclers (defaults to 2000)
 void setSharedRcvStatsPoolSize(int size)
          Sets the size of the shared pool of LBMReceiverStatistics for all LBMObjectRecyclers (defaults to 20)
 void setSharedSrcEvPoolSize(int size)
          Sets the size of the shared pool of LBMSourceEvents for all LBMObjectRecyclers (defaults to 20)
 void setSharedSrcStatsPoolSize(int size)
          Sets the size of the shared pool of LBMSourceStatistics for all LBMObjectRecyclers (defaults to 20)
 
Methods inherited from class com.latencybusters.lbm.LBMObjectRecyclerBase
doneWithContextSourceEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LBMObjectRecycler

public LBMObjectRecycler()
Method Detail

setLocalMsgPoolSize

public void setLocalMsgPoolSize(int size)
Sets the size of the thread local pool of LBMMessages for all LBMObjectRecyclers (defaults to 1000)

Parameters:
size - the size of the local pool

setSharedMsgPoolSize

public void setSharedMsgPoolSize(int size)
Sets the size of the shared pool of LBMMessages for all LBMObjectRecyclers (defaults to 2000)

Parameters:
size - the size of the shared pool

doneWithMessage

public void doneWithMessage(LBMMessage obj)
Call when finished with a LBMMessage object. Call dispose on the message object before passing to this method. If the local and shared object size is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithMessage in class LBMObjectRecyclerBase
Parameters:
obj - The message object

retrieveMessage

public LBMMessage retrieveMessage(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveMessage in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolMessageCount

public int getLocalPoolMessageCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllMessagesToSharedPool

public int returnAllMessagesToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalRcvStatsPoolSize

public void setLocalRcvStatsPoolSize(int size)
Sets the size of the thread local pool of LBMReceiverStatistics for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedRcvStatsPoolSize

public void setSharedRcvStatsPoolSize(int size)
Sets the size of the shared pool of LBMReceiverStatistics for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithReceiverStatistics

public void doneWithReceiverStatistics(LBMReceiverStatistics obj)
Call when finished with a LBMReceiverStatistics object. Do not call dispose on the stats object before passing to this method. If the local and shared object limit is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithReceiverStatistics in class LBMObjectRecyclerBase
Parameters:
obj - The stats object

retrieveReceiverStatistics

public LBMReceiverStatistics retrieveReceiverStatistics(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveReceiverStatistics in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolReceiverStatisticsCount

public int getLocalPoolReceiverStatisticsCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllReceiverStatisticsToSharedPool

public int returnAllReceiverStatisticsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalSrcStatsPoolSize

public void setLocalSrcStatsPoolSize(int size)
Sets the size of the thread local pool of LBMSourceStatistics for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedSrcStatsPoolSize

public void setSharedSrcStatsPoolSize(int size)
Sets the size of the shared pool of LBMSourceStatistics for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithSourceStatistics

public void doneWithSourceStatistics(LBMSourceStatistics obj)
Call when finished with a LBMSourceStatistics object. Do not call dispose on the stats object before passing to this method. If the local and shared object limit is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithSourceStatistics in class LBMObjectRecyclerBase
Parameters:
obj - The stats object

retrieveSourceStatistics

public LBMSourceStatistics retrieveSourceStatistics(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveSourceStatistics in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolSourceStatisticsCount

public int getLocalPoolSourceStatisticsCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllSourceStatisticsToSharedPool

public int returnAllSourceStatisticsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalCtxStatsPoolSize

public void setLocalCtxStatsPoolSize(int size)
Sets the size of the thread local pool of LBMContextStatistics for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedCtxStatsPoolSize

public void setSharedCtxStatsPoolSize(int size)
Sets the size of the shared pool of LBMContextStatistics for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithContextStatistics

public void doneWithContextStatistics(LBMContextStatistics obj)
Call when finished with a LBMContextStatistics object. Do not call dispose on the stats object before passing to this method. If the local and shared object size is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithContextStatistics in class LBMObjectRecyclerBase
Parameters:
obj - The stats object

retrieveContextStatistics

public LBMContextStatistics retrieveContextStatistics(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveContextStatistics in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolContextStatisticsCount

public int getLocalPoolContextStatisticsCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllContextStatisticsToSharedPool

public int returnAllContextStatisticsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalIMRcvStatsPoolSize

public void setLocalIMRcvStatsPoolSize(int size)
Sets the size of the thread local pool of LBMImmediateMessageReceiverStatistics for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedIMRcvStatsPoolSize

public void setSharedIMRcvStatsPoolSize(int size)
Sets the size of the shared pool of LBMImmediateMessageReceiverStatistics for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithImmediateMessageReceiverStatistics

public void doneWithImmediateMessageReceiverStatistics(LBMImmediateMessageReceiverStatistics obj)
Call when finished with a LBMImmediateMessageReceiverStatistics object. Do not call dispose on the stats object before passing to this method. If the local and shared object limit is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithImmediateMessageReceiverStatistics in class LBMObjectRecyclerBase
Parameters:
obj - The stats object

retrieveImmediateMessageReceiverStatistics

public LBMImmediateMessageReceiverStatistics retrieveImmediateMessageReceiverStatistics(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveImmediateMessageReceiverStatistics in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolImmediateMessageReceiverStatisticsCount

public int getLocalPoolImmediateMessageReceiverStatisticsCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllImmediateMessageReceiverStatisticsToSharedPool

public int returnAllImmediateMessageReceiverStatisticsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalIMSrcStatsPoolSize

public void setLocalIMSrcStatsPoolSize(int size)
Sets the size of the thread local pool of LBMImmediateMessageSourceStatistics for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedIMSrcStatsPoolSize

public void setSharedIMSrcStatsPoolSize(int size)
Sets the size of the shared pool of LBMImmediateMessageSourceStatistics for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithImmediateMessageSourceStatistics

public void doneWithImmediateMessageSourceStatistics(LBMImmediateMessageSourceStatistics obj)
Call when finished with a LBMImmediateMessageSourceStatistics object. Do not call dispose on the stats object before passing to this method. If the local and shared object limit is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithImmediateMessageSourceStatistics in class LBMObjectRecyclerBase
Parameters:
obj - The stats object

retrieveImmediateMessageSourceStatistics

public LBMImmediateMessageSourceStatistics retrieveImmediateMessageSourceStatistics(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveImmediateMessageSourceStatistics in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolImmediateMessageSourceStatisticsCount

public int getLocalPoolImmediateMessageSourceStatisticsCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllImmediateMessageSourceStatisticsToSharedPool

public int returnAllImmediateMessageSourceStatisticsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalEvqStatsPoolSize

public void setLocalEvqStatsPoolSize(int size)
Sets the size of the thread local pool of LBMEventQueueStatistics for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedEvqStatsPoolSize

public void setSharedEvqStatsPoolSize(int size)
Sets the size of the shared pool of LBMEventQueueStatistics for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithEventQueueStatistics

public void doneWithEventQueueStatistics(LBMEventQueueStatistics obj)
Call when finished with a LBMEventQueueStatistics object. Do not call dispose on the stats object before passing to this method. If the local and shared object limit is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithEventQueueStatistics in class LBMObjectRecyclerBase
Parameters:
obj - The stats object

retrieveEventQueueStatistics

public LBMEventQueueStatistics retrieveEventQueueStatistics(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveEventQueueStatistics in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid stats object will be returned

getLocalPoolEventQueueStatisticsCount

public int getLocalPoolEventQueueStatisticsCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllEventQueueStatisticsToSharedPool

public int returnAllEventQueueStatisticsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalSrcEvPoolSize

public void setLocalSrcEvPoolSize(int size)
Sets the size of the thread local pool of LBMSourceEvents for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedSrcEvPoolSize

public void setSharedSrcEvPoolSize(int size)
Sets the size of the shared pool of LBMSourceEvents for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithSourceEvent

public void doneWithSourceEvent(LBMSourceEvent obj)
Call when finished with a LBMSourceEvent object. Call dispose on the source event object before passing to this method. If the local and shared object size is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithSourceEvent in class LBMObjectRecyclerBase
Parameters:
obj - The message object

retrieveSourceEvent

public LBMSourceEvent retrieveSourceEvent(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveSourceEvent in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid object will be returned

getLocalPoolSourceEventCount

public int getLocalPoolSourceEventCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllSourceEventsToSharedPool

public int returnAllSourceEventsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalCtxSrcEvPoolSize

public void setLocalCtxSrcEvPoolSize(int size)
Sets the size of the thread local pool of LBMContextSourceEvents for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedCtxSrcEvPoolSize

public void setSharedCtxSrcEvPoolSize(int size)
Sets the size of the shared pool of LBMContextSourceEvents for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithContextSourceEvent

public void doneWithContextSourceEvent(LBMContextSourceEvent obj)
Call when finished with a LBMContextSourceEvent object. Call dispose on the source event object before passing to this method. If the local and shared object size is reached, it will simply ignore the passed object which will result in it being garbage collected.

Parameters:
obj - The message object

retrieveContextSourceEvent

public LBMContextSourceEvent retrieveContextSourceEvent(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveContextSourceEvent in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid object will be returned

getLocalPoolContextSourceEventCount

public int getLocalPoolContextSourceEventCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllContextSourceEventsToSharedPool

public int returnAllContextSourceEventsToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

setLocalAsyncOpInfosPoolSize

public void setLocalAsyncOpInfosPoolSize(int size)
Sets the size of the thread local pool of LBMAsyncOperationInfo for all LBMObjectRecyclers (defaults to 10)

Parameters:
size - the size of the local pool

setSharedAsyncOpInfosPoolSize

public void setSharedAsyncOpInfosPoolSize(int size)
Sets the size of the shared pool of LBMAsyncOperationInfo for all LBMObjectRecyclers (defaults to 20)

Parameters:
size - the size of the shared pool

doneWithAsyncOperationInfo

public void doneWithAsyncOperationInfo(LBMAsyncOperationInfo obj)
Call when finished with a LBMAsyncOperationInfo object. Do not call dispose on the async info object before passing to this method. If the local and shared object limit is reached, it will simply ignore the passed object which will result in it being garbage collected.

Overrides:
doneWithAsyncOperationInfo in class LBMObjectRecyclerBase
Parameters:
obj - The async info object

retrieveAsyncOperationInfo

public LBMAsyncOperationInfo retrieveAsyncOperationInfo(java.lang.Object cbObj)
LBM will call this method to attempt to retrieve an object that it can reuse. It will transfer a batch of objects from the shared pool when the local pool gets low or will create the objects if the shared pool is empty.

Overrides:
retrieveAsyncOperationInfo in class LBMObjectRecyclerBase
Parameters:
cbObj - The callback object token that was stored when setting LBMObjectRecycler in the attributes
Returns:
A valid async info object will be returned

getLocalPoolAsyncOperationInfoCount

public int getLocalPoolAsyncOperationInfoCount()
Gets the current number of objects in the local pool.

Returns:
The number of objects

returnAllAsyncOperationInfosToSharedPool

public int returnAllAsyncOperationInfosToSharedPool()
Returns all of the objects in the local pool back to the shared pool. If the shared pool is full, the objects are still removed from the local pool but they are discarded and will be garbage collected (and are not counted in the return value as objects that were actually returned).

Returns:
The number of objects actually returned

disposeThreadLocals

public void disposeThreadLocals()
A convenience method to clean up thread local variables if needed.


close

public void close()
A method to clean up all objects referenced by the recycler when the application is closing (which will dispose all of the stats objects in the recycler).

Overrides:
close in class LBMObjectRecyclerBase


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.