本文整理了Java中java.lang.Thread.<init>()
方法的一些代码示例,展示了Thread.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Thread.<init>()
方法的具体详情如下:
包路径:java.lang.Thread
类名称:Thread
方法名:<init>
[英]Allocates a new Thread object. This constructor has the same effect as #Thread(ThreadGroup,Runnable,String) (null, null, gname), where gname is a newly generated name. Automatically generated names are of the form "Thread-"+n, where n is an integer.
[中]分配一个新的线程对象。此构造函数与#Thread(ThreadGroup,Runnable,String)(null,null,gname)具有相同的效果,其中gname是新生成的名称。自动生成的名称的形式为“Thread-”+n,其中n是一个整数。
代码示例来源:origin: square/okhttp
public static ThreadFactory threadFactory(String name, boolean daemon) {
return runnable -> {
Thread result = new Thread(runnable, name);
result.setDaemon(daemon);
return result;
};
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Thread newThread(Runnable r) {
return new Thread(r, name);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public Thread newThread(Runnable r) {
return new Thread(r, name);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public Thread newThread(Runnable r) {
return new Thread(r, name);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public Thread newThread(Runnable r) {
return new Thread(r, name);
}
};
代码示例来源:origin: ReactiveX/RxJava
@Override
public void execute(Runnable r) {
new Thread(r).start();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void execute(Runnable r) {
new Thread(r).start();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void execute(Runnable r) {
new Thread(r).start();
}
}, true);
代码示例来源:origin: ReactiveX/RxJava
@Override
public void execute(Runnable r) {
new Thread(r).start();
}
}, true);
代码示例来源:origin: ReactiveX/RxJava
@Override
public void execute(Runnable r) {
new Thread(r).start();
}
}, true);
代码示例来源:origin: ReactiveX/RxJava
@Override
public void execute(Runnable r) {
new Thread(r).start();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Subscriber<? super String> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
new Thread(new Runnable() {
@Override
public void run() {
counter.incrementAndGet();
subscriber.onNext("one");
subscriber.onComplete();
}
}).start();
}
}).publish();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Subscriber<? super String> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
new Thread(new Runnable() {
@Override
public void run() {
counter.incrementAndGet();
subscriber.onNext("one");
subscriber.onComplete();
}
}).start();
}
}).cacheWithInitialCapacity(1);
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Subscriber<? super String> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
t = new Thread(new Runnable() {
@Override
public void run() {
subscriber.onNext("hello");
subscriber.onComplete();
}
});
t.start();
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Observer<? super String> observer) {
observer.onSubscribe(Disposables.empty());
new Thread(new Runnable() {
@Override
public void run() {
counter.incrementAndGet();
observer.onNext("one");
observer.onComplete();
}
}).start();
}
}).replay();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Observer<? super String> observer) {
observer.onSubscribe(Disposables.empty());
new Thread(new Runnable() {
@Override
public void run() {
counter.incrementAndGet();
observer.onNext("one");
observer.onComplete();
}
}).start();
}
}).publish();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Observer<? super String> observer) {
observer.onSubscribe(Disposables.empty());
new Thread(new Runnable() {
@Override
public void run() {
counter.incrementAndGet();
observer.onNext("one");
observer.onComplete();
}
}).start();
}
}).cache();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Observer<? super String> observer) {
observer.onSubscribe(Disposables.empty());
new Thread(new Runnable() {
@Override
public void run() {
counter.incrementAndGet();
observer.onNext("one");
observer.onComplete();
}
}).start();
}
}).cacheWithInitialCapacity(1);
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(final Observer<? super String> observer) {
observer.onSubscribe(Disposables.empty());
t = new Thread(new Runnable() {
@Override
public void run() {
observer.onNext("hello");
observer.onComplete();
}
});
t.start();
}
}
代码示例来源:origin: google/guava
private TimedThread(long expectedCompletionWaitMillis) {
completed = new Completion(expectedCompletionWaitMillis);
thread = new Thread(new JoinTarget(expectedCompletionWaitMillis));
thread.start();
}
内容来源于网络,如有侵权,请联系作者删除!