Skip to content

Commit 35ec2cd

Browse files
committed
Merge branch 'r1viollet/split_debug' of github.com:DataDog/java-profiler into r1viollet/split_debug
2 parents 137e203 + 6eef881 commit 35ec2cd

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

build.gradle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
id "com.diffplug.spotless" version "6.11.0"
1515
}
1616

17-
version = "1.28.0"
17+
version = "1.29.0"
1818

1919
apply plugin: "com.dipien.semantic-version"
2020
version = project.findProperty("ddprof_version") ?: version
@@ -39,7 +39,8 @@ repositories {
3939
mavenContent {
4040
snapshotsOnly()
4141
}
42-
url 'https://oss.sonatype.org/content/repositories/snapshots/'
42+
// see https://central.sonatype.org/publish/publish-portal-snapshots/#consuming-via-gradle
43+
url 'https://central.sonatype.com/repository/maven-snapshots/'
4344
}
4445
}
4546

@@ -75,7 +76,14 @@ nexusPublishing {
7576
password = "admin123"
7677
}
7778
} else {
79+
// see https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-central
80+
// For official documentation:
81+
// staging repo publishing https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
82+
// snapshot publishing https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-via-other-methods
7883
sonatype {
84+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
85+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
86+
7987
username = System.getenv("SONATYPE_USERNAME")
8088
password = System.getenv("SONATYPE_PASSWORD")
8189
}

ddprof-lib/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ def shouldSkipDebugExtraction() {
3636
if (project.hasProperty('skip-debug-extraction')) {
3737
return true
3838
}
39-
39+
4040
// Skip if required tools are not available
4141
if (os().isLinux() && !checkObjcopyAvailable()) {
4242
return true
4343
}
44-
44+
4545
if (os().isMacOsX() && !checkDsymutilAvailable()) {
4646
return true
4747
}
48-
48+
4949
return false
5050
}
5151

ddprof-lib/src/main/java/com/datadoghq/profiler/JavaProfiler.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@
3535
*/
3636
public final class JavaProfiler {
3737
static final Unsafe UNSAFE;
38-
static final boolean isJDK8;
3938
static {
4039
Unsafe unsafe = null;
4140
String version = System.getProperty("java.version");
42-
isJDK8 = version.startsWith("1.8");
4341
try {
4442
Field f = Unsafe.class.getDeclaredField("theUnsafe");
4543
f.setAccessible(true);
@@ -129,7 +127,7 @@ private void initializeContextStorage() {
129127
if (this.contextStorage == null) {
130128
int maxPages = getMaxContextPages0();
131129
if (maxPages > 0) {
132-
if (isJDK8) {
130+
if (UNSAFE != null) {
133131
contextBaseOffsets = new long[maxPages];
134132
// be sure to choose an illegal address as a sentinel value
135133
Arrays.fill(contextBaseOffsets, Long.MIN_VALUE);
@@ -238,14 +236,14 @@ public void removeThread() {
238236
*/
239237
public void setContext(long spanId, long rootSpanId) {
240238
int tid = TID.get();
241-
if (isJDK8) {
242-
setContextJDK8(tid, spanId, rootSpanId);
239+
if (UNSAFE != null) {
240+
setContextUnsafe(tid, spanId, rootSpanId);
243241
} else {
244242
setContextByteBuffer(tid, spanId, rootSpanId);
245243
}
246244
}
247245

248-
private void setContextJDK8(int tid, long spanId, long rootSpanId) {
246+
private void setContextUnsafe(int tid, long spanId, long rootSpanId) {
249247
if (contextBaseOffsets == null) {
250248
return;
251249
}
@@ -313,14 +311,14 @@ public void clearContext() {
313311
*/
314312
public void setContextValue(int offset, int value) {
315313
int tid = TID.get();
316-
if (isJDK8) {
317-
setContextJDK8(tid, offset, value);
314+
if (UNSAFE != null) {
315+
setContextUnsafe(tid, offset, value);
318316
} else {
319317
setContextByteBuffer(tid, offset, value);
320318
}
321319
}
322320

323-
private void setContextJDK8(int tid, int offset, int value) {
321+
private void setContextUnsafe(int tid, int offset, int value) {
324322
if (contextBaseOffsets == null) {
325323
return;
326324
}
@@ -344,14 +342,14 @@ public void setContextByteBuffer(int tid, int offset, int value) {
344342

345343
void copyTags(int[] snapshot) {
346344
int tid = TID.get();
347-
if (isJDK8) {
348-
copyTagsJDK8(tid, snapshot);
345+
if (UNSAFE != null) {
346+
copyTagsUnsafe(tid, snapshot);
349347
} else {
350348
copyTagsByteBuffer(tid, snapshot);
351349
}
352350
}
353351

354-
void copyTagsJDK8(int tid, int[] snapshot) {
352+
void copyTagsUnsafe(int tid, int[] snapshot) {
355353
if (contextBaseOffsets == null) {
356354
return;
357355
}

0 commit comments

Comments
 (0)