Package com.amazonaws.xray.emitters
Class DelegatingEmitter
- java.lang.Object
-
- com.amazonaws.xray.emitters.Emitter
-
- com.amazonaws.xray.emitters.DelegatingEmitter
-
public class DelegatingEmitter extends Emitter
AnEmitter
which delegates all calls to anotherEmitter
. Extend from this class to customize when segments and subsegments are sent.class CircuitBreakingEmitter extends DelegatingEmitter { private final CircuitBreaker circuitBreaker; CircuitBreakingEmitter() { super(Emitter.create()); circuitBreaker = CircuitBreaker.create(); } {@literal @}Override public boolean sendSegment(Segment segment) { if (circuitBreaker.isOpen()) { return super.sendSegment(segment); } return false; } }
-
-
Field Summary
-
Fields inherited from class com.amazonaws.xray.emitters.Emitter
DAEMON_BUF_RECEIVE_SIZE, PRIORITY_PROTOCOL_HEADER, PROTOCOL_DELIMITER, PROTOCOL_HEADER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DelegatingEmitter(Emitter delegate)
Constructs a newDelegatingEmitter
that delegates all calls to the providedEmitter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
sendSegment(Segment segment)
Sends a segment to the X-Ray daemon.boolean
sendSubsegment(Subsegment subsegment)
Sends a subsegment to the X-Ray daemon.
-
-
-
Constructor Detail
-
DelegatingEmitter
protected DelegatingEmitter(Emitter delegate)
Constructs a newDelegatingEmitter
that delegates all calls to the providedEmitter
.
-
-
Method Detail
-
sendSegment
public boolean sendSegment(Segment segment)
Description copied from class:Emitter
Sends a segment to the X-Ray daemon.- Specified by:
sendSegment
in classEmitter
- Parameters:
segment
- the segment to send- Returns:
- true if the send operation was successful
-
sendSubsegment
public boolean sendSubsegment(Subsegment subsegment)
Description copied from class:Emitter
Sends a subsegment to the X-Ray daemon.- Specified by:
sendSubsegment
in classEmitter
- Parameters:
subsegment
- the subsegment to send- Returns:
- true if the send operation was successful
-
-