- java.lang.Object
-
- brave.internal.Platform
-
public abstract class Platform extends java.lang.ObjectAccess to platform-specific features.Note: Logging is centralized here to avoid classloader problems.
Originally designed by OkHttp team, derived from
okhttp3.internal.platform.Platform
-
-
Constructor Summary
Constructors Constructor Description Platform()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Clockclock()static Platformget()abstract java.lang.StringgetHostString(java.net.InetSocketAddress socket)GuardsInetSocketAddress.getHostString(), as it isn't available until Java 7java.lang.StringlinkLocalIp()voidlog(java.lang.String msg, java.lang.Object param1, java.lang.Throwable thrown)LikeLogger.log(Level, String, Object), except with a throwable argvoidlog(java.lang.String msg, java.lang.Throwable thrown)LikeLogger.log(Level, String)abstract longnextTraceIdHigh()Returns the high 8-bytes for128-bit trace IDs.abstract longrandomLong()This class uses pseudo-random number generators to provision IDs.
-
-
-
Method Detail
-
getHostString
@Nullable public abstract java.lang.String getHostString(java.net.InetSocketAddress socket)
GuardsInetSocketAddress.getHostString(), as it isn't available until Java 7
-
linkLocalIp
@Nullable public java.lang.String linkLocalIp()
-
get
public static Platform get()
-
log
public void log(java.lang.String msg, @Nullable java.lang.Throwable thrown)LikeLogger.log(Level, String)
-
log
public void log(java.lang.String msg, java.lang.Object param1, @Nullable java.lang.Throwable thrown)LikeLogger.log(Level, String, Object), except with a throwable arg
-
randomLong
public abstract long randomLong()
This class uses pseudo-random number generators to provision IDs.This optimizes speed over full coverage of 64-bits, which is why it doesn't share a
SecureRandom. It will useThreadLocalRandomunless used in JRE 6 which doesn't have the class.
-
nextTraceIdHigh
public abstract long nextTraceIdHigh()
Returns the high 8-bytes for128-bit trace IDs.The upper 4-bytes are epoch seconds and the lower 4-bytes are random. This makes it convertible to Amazon X-Ray trace ID format v1.
-
clock
public Clock clock()
-
-