|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.netty.channel.ChannelLocal<T>
public class ChannelLocal<T>
A global variable that is local to a Channel
. Think of this as a
variation of ThreadLocal
whose key is a Channel
rather than
a Thread.currentThread()
. One difference is that you always have to
specify the Channel
to access the variable.
Alternatively, you might want to use the
ChannelHandlerContext.attachment
property, which performs better.
Constructor Summary | |
---|---|
ChannelLocal()
Creates a Channel local variable. |
Method Summary | |
---|---|
T |
get(Channel channel)
Returns the value of this variable. |
protected T |
initialValue(Channel channel)
Returns the initial value of the variable. |
T |
remove(Channel channel)
Removes the variable and returns the removed value. |
T |
set(Channel channel,
T value)
Sets the value of this variable. |
T |
setIfAbsent(Channel channel,
T value)
Sets the value of this variable only when no value was set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChannelLocal()
Channel
local variable.
Method Detail |
---|
protected T initialValue(Channel channel)
null
. Override it to change the initial value.
public T get(Channel channel)
public T set(Channel channel, T value)
null
if there was no old value.public T setIfAbsent(Channel channel, T value)
null
if the specified value was set.
An existing value if failed to set.public T remove(Channel channel)
initialValue(Channel)
,
which is null
by default.
null
) if no value was set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |