本文整理了Java中java.lang.Thread.getName()
方法的一些代码示例,展示了Thread.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Thread.getName()
方法的具体详情如下:
包路径:java.lang.Thread
类名称:Thread
方法名:getName
[英]Returns this thread's name.
[中]返回此线程的名称。
代码示例来源:origin: iluwatar/java-design-patterns
@Override
public void run() {
LOGGER.info("{} processing {}", Thread.currentThread().getName(), task.toString());
try {
Thread.sleep(task.getTimeMs());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(Throwable e) throws Exception {
name[0] = Thread.currentThread().getName();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() throws Exception {
name[0] = Thread.currentThread().getName();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public String apply(Integer v) throws Exception {
return v + ": " + Thread.currentThread().getName();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() throws Exception {
name[0] = Thread.currentThread().getName();
cdl.countDown();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
}),
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
}),
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public void run() throws Exception {
name[0] = Thread.currentThread().getName();
cdl.countDown();
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
})
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Integer v) throws Exception {
return Thread.currentThread().getName().substring(0, 4);
}
}),
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onComplete() {
name.set(Thread.currentThread().getName());
cdl.countDown();
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(Integer t) {
System.out.println("Thread: " + Thread.currentThread().getName());
System.out.println("t: " + t);
count.incrementAndGet();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void onError(Throwable e) {
name.set(Thread.currentThread().getName());
err.set(e);
cdl.countDown();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public String apply(Integer t) {
assertTrue(Thread.currentThread().getName().equals(currentThreadName));
return "Value_" + t + "_Thread_" + Thread.currentThread().getName();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(String s) {
String threadName = Thread.currentThread().getName();
System.out.println("Source ThreadName: " + threadName + " Expected => " + parentThreadName);
assertEquals(parentThreadName, threadName);
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void accept(String s) {
String threadName = Thread.currentThread().getName();
System.out.println("Source ThreadName: " + threadName + " Expected => " + parentThreadName);
assertEquals(parentThreadName, threadName);
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(CompletableObserver observer) {
name.set(Thread.currentThread().getName());
EmptyDisposable.complete(observer);
}
}).subscribeOn(Schedulers.computation());
代码示例来源:origin: ReactiveX/RxJava
@Before
public void before() {
stringObserver = TestHelper.mockObserver();
for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getName().startsWith("RxNewThread")) {
count++;
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@Before
public void before() {
stringSubscriber = TestHelper.mockSubscriber();
for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getName().startsWith("RxNewThread")) {
count++;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!