- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有下面的程序,它使用java mail api发送邮件,现在这是我开发的简单程序,我想通过使用executorframework在并行执行方面进行修改,我希望5个不同的线程独立地触发我的这个程序,但是这5个不同的线程应该同时触发
假设有五个不同的线程 t1、t2、t3、t4 和 t5,那么它们都应该独立地调用我的函数,即 main(@) 现在正在调用 rite,但同时
下面是我的java代码
public class SSendEmail {
public static void main(String [] args) throws Exception, IOException, Exception{
String smtpHost = "xxx";
String mailSmtpPort = "000";
String mailTo[] = {"sart@wer.com" };
String mailCc[] = {"sart@wer.com" };
xxsendmail(mailTo, mailCc, "sendername",
"testsubject.", "testsubject..", smtpHost , mailSmtpPort);
}
最佳答案
我认为您会使用 ScheduledExecutorService
并像这样调用它。
ScheduledExecutorService exec = Executors.newScheduledThreadPool(amount);
for (int i = 0; i < amount; i++) {
exec.schedule(yourMailSendingRunnable, delay, TimeUnit.MILLISECONDS);
}
您应该替换 amount
、yourMailSendingRunnable
和 delay
以满足您的需求。
关于java - 通过并行处理,使程序能够由不同的线程同时发送邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36504199/
我正在使用 Java 编写一个时钟程序,该程序能够“滴答作响”,但它存在问题。我认为它与 getter 和 setter 或 toString() 方法有关。 计数器类 package clock;
const Index = () => { // Ref Links const frefLinks = { 1: useRef(1), 2: useRef(2), 3: useRef(3
所以我读了here不能 pickle 装饰函数。确实: import multiprocessing as mp def deco(f): def wrapper(*args, **kwarg
我在go1.11.2 linux/amd64 版本。当包godog使用 go get github.com/DATA-DOG/godog/ 安装,godog 可执行文件在 $GOPATH/bin/中创
如何正确压缩字符串,以便 PHP 能够解压缩? 我试过这个: public static byte[] compress(String string) throws IOException {
我们这里的问题是表明 在测试中使用 Kleene 代数。 在 b 的值由 p 保留的情况下,我们有交换条件 bp = pb;两个程序之间的等价性简化为等式 在 b 的值不被 p 保留的情况下,我们有交
我有一个与我的网络相关的非常奇怪的问题,我在具有多个接口(interface)的 VirtualBox 上安装了 RDO Grizzly OpenStack。 虚拟盒子: eth0 - managem
我正在尝试使用 Passport.js授权谷歌OAuth2在 Node.js .我整个星期都在尝试让它工作,但不知道为什么它不工作,所以现在我求助于 stack 寻求一些潜在的帮助。我已经尝试了所有在
我是一名优秀的程序员,十分优秀!