< prev index next > src/java.base/share/classes/jdk/internal/vm/ThreadContainer.java
Print this page
/*
- * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* questions.
*/
package jdk.internal.vm;
+ import java.util.Objects;
import java.util.stream.Stream;
/**
* A container of threads.
*/
*/
protected ThreadContainer(boolean shared) {
super(shared);
}
+ /**
+ * Return the name of this container, may be null.
+ */
+ public String name() {
+ return null;
+ }
+
/**
* Returns the parent of this container or null if this is the root container.
*/
public ThreadContainer parent() {
return ThreadContainers.parent(this);
* The scoped values captured when the thread container was created.
*/
public ScopedValueContainer.BindingsSnapshot scopedValueBindings() {
return null;
}
+
+ @Override
+ public String toString() {
+ String name = name();
+ if (name != null && name.indexOf('@') >= 0) {
+ return name;
+ } else {
+ String id = Objects.toIdentityString(this);
+ return (name != null) ? name + "/" + id : id;
+ }
+ }
}
< prev index next >