Package com.alibaba.ttl
Interface TransmittableThreadLocal.Transmitter.Transmittee<C,B>
-
- Type Parameters:
C- the transmittee capture data typeB- the transmittee backup data type
- Enclosing class:
- TransmittableThreadLocal.Transmitter
public static interface TransmittableThreadLocal.Transmitter.Transmittee<C,B>The transmittee is the extension point for otherThreadLocals which are registered byregisterTransmitteemethod. Transmittance is completed by methodscapture()=>replay(Object)=>restore(Object)(akaCRRoperations),
-
-
Method Detail
-
capture
@NonNull C capture()
Capture.NOTE:
- do NOT return
null. - do NOT throw any exceptions, just ignored.
- Returns:
- the capture data of transmittee
- Since:
- 2.14.0
- do NOT return
-
replay
@NonNull B replay(@NonNull C captured)
Replay.NOTE:
- do NOT return
null. - do NOT throw any exceptions, just ignored.
- Parameters:
captured- the capture data of transmittee, the return value of methodcapture()- Returns:
- the backup data of transmittee
- Since:
- 2.14.0
- do NOT return
-
clear
@NonNull B clear()
Clear.NOTE:
- do NOT return
null. - do NOT throw any exceptions, just ignored.
Semantically, the code
`B backup = clear();`is same as`B backup = replay(EMPTY_CAPTURE);`.The reason for providing this method is:
- lead to more readable code
- need not provide the constant
EMPTY_CAPTURE.
- Returns:
- the backup data of transmittee
- Since:
- 2.14.0
- do NOT return
-
restore
void restore(@NonNull B backup)
Restore.NOTE:
do NOT throw any exceptions, just ignored.- Parameters:
backup- the backup data of transmittee, the return value of methodsreplay(Object)orclear()- Since:
- 2.14.0
- See Also:
replay(Object),clear()
-
-