public abstract class Platform extends Object
Note: Logging is centralized here to avoid classloader problems.
Originally designed by OkHttp team, derived from okhttp3.internal.platform.Platform
| Constructor | Description |
|---|---|
Platform() |
| Modifier and Type | Method | Description |
|---|---|---|
Clock |
clock() |
|
static Platform |
get() |
|
abstract String |
getHostString(InetSocketAddress socket) |
Guards
InetSocketAddress.getHostString(), as it isn't available until Java 7 |
String |
linkLocalIp() |
|
void |
log(String msg,
Object param1,
Throwable thrown) |
Like
Logger.log(Level, String, Object), except with a throwable arg |
void |
log(String msg,
Throwable thrown) |
|
abstract long |
nextTraceIdHigh() |
Returns the high 8-bytes for
128-bit trace IDs. |
abstract long |
randomLong() |
This class uses pseudo-random number generators to provision IDs.
|
@Nullable public abstract String getHostString(InetSocketAddress socket)
InetSocketAddress.getHostString(), as it isn't available until Java 7public static Platform get()
public void log(String msg, Object param1, @Nullable Throwable thrown)
Logger.log(Level, String, Object), except with a throwable argpublic abstract long randomLong()
This optimizes speed over full coverage of 64-bits, which is why it doesn't share a SecureRandom. It will use ThreadLocalRandom unless used in JRE 6
which doesn't have the class.
public abstract long nextTraceIdHigh()
128-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.
public Clock clock()
Copyright © 2018 OpenZipkin. All rights reserved.