org.apache.catalina.tribes.transport.bio.util

Class FastQueue

public class FastQueue extends Object

A fast queue that remover thread lock the adder thread.
Limit the queue length when you have strange producer thread problemes. FIXME add i18n support to log messages

Version: $Revision: 500684 $ $Date: 2007-01-28 00:27:18 +0100 (Sun, 28 Jan 2007) $

Author: Rainer Jung Peter Rossbach

Constructor Summary
FastQueue()
Generate Queue SingleRemoveSynchronizedAddLock and set add and wait Timeouts
Method Summary
booleanadd(ChannelMessage msg, Member[] destination, InterceptorPayload payload)
Add new data to the queue
longgetAddWaitTimeout()
get current add wait timeout
SingleRemoveSynchronizedAddLockgetLock()
intgetMaxQueueLength()
get Max Queue length
intgetMaxSize()
longgetRemoveWaitTimeout()
get current remove wait timeout
intgetSize()
booleanisCheckLock()
booleanisEnabled()
LinkObjectremove()
remove the complete queued object list
voidsetAddWaitTimeout(long timeout)
Set add wait timeout (default 10000 msec)
voidsetCheckLock(boolean checkLock)
voidsetEnabled(boolean enable)
voidsetMaxQueueLength(int length)
voidsetMaxSize(int size)
voidsetRemoveWaitTimeout(long timeout)
set remove wait timeout ( default 30000 msec)
voidstart()
start queuing
voidstop()
start queuing
voidunlockAdd()
unlock queue for next add
voidunlockRemove()
unlock queue for next remove

Constructor Detail

FastQueue

public FastQueue()
Generate Queue SingleRemoveSynchronizedAddLock and set add and wait Timeouts

Method Detail

add

public boolean add(ChannelMessage msg, Member[] destination, InterceptorPayload payload)
Add new data to the queue

See Also: org.apache.catalina.tribes.util.IQueue#add(java.lang.String, java.lang.Object) FIXME extract some method

getAddWaitTimeout

public long getAddWaitTimeout()
get current add wait timeout

Returns: current wait timeout

getLock

public SingleRemoveSynchronizedAddLock getLock()

getMaxQueueLength

public int getMaxQueueLength()
get Max Queue length

See Also: org.apache.catalina.tribes.util.IQueue#getMaxQueueLength()

getMaxSize

public int getMaxSize()

Returns: The max size

getRemoveWaitTimeout

public long getRemoveWaitTimeout()
get current remove wait timeout

Returns: The timeout

getSize

public int getSize()

isCheckLock

public boolean isCheckLock()

Returns: Returns the checkLock.

isEnabled

public boolean isEnabled()

remove

public LinkObject remove()
remove the complete queued object list

See Also: org.apache.catalina.tribes.util.IQueue#remove() FIXME extract some method

setAddWaitTimeout

public void setAddWaitTimeout(long timeout)
Set add wait timeout (default 10000 msec)

Parameters: timeout

setCheckLock

public void setCheckLock(boolean checkLock)

Parameters: checkLock The checkLock to set.

setEnabled

public void setEnabled(boolean enable)

setMaxQueueLength

public void setMaxQueueLength(int length)

setMaxSize

public void setMaxSize(int size)

Parameters: size

setRemoveWaitTimeout

public void setRemoveWaitTimeout(long timeout)
set remove wait timeout ( default 30000 msec)

Parameters: timeout

start

public void start()
start queuing

stop

public void stop()
start queuing

unlockAdd

public void unlockAdd()
unlock queue for next add

unlockRemove

public void unlockRemove()
unlock queue for next remove
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.