kill

How to prevent an android activity to get killed

我是研究僧i 提交于 2019-12-18 09:37:33
问题 I have developed an application that does require to do constant network activity. This Activity does the network connections thru an AsyncTask, sometime this work being done in background (application not having focus). My application sometimes gets killed after 30 mins, even if the system does not seem to lack resources (memory). I have read the Activity life cycle in the Application Fundamentals section on developer.android.com, but can't find an answer. What would be the proper way to

Inno Setup Kill a running process

天涯浪子 提交于 2019-12-18 05:12:25
问题 I have already implemented a way to find whether a process ("iexplore.exe") is running, I now need to find a way to close it (terminate the process) from Inno Setup. strProg := 'iexplore.exe'; winHwnd := FindWindowByWindowName(strProg); MsgBox('winHwnd: ' + inttostr(winHwnd), mbInformation, MB_OK ); if winHwnd <> 0 then retVal:=postmessage(winHwnd,WM_CLOSE,0,0); The message box in the example above will always return 0 therefore no handle is ever gotten. (the WM_CLOSE constant in the example

improper killing of mysqld - now not starting

落爺英雄遲暮 提交于 2019-12-18 04:52:10
问题 I stopped mysqld by killing the process id, and then deleted mysqld.sock file also. Now, mysqld is not starting. I know there is some data corruption. But now I need to start MySQL without re-installing it. Below are the logs that generated. InnoDB: using the same InnoDB data or log files. InnoDB: Unable to lock ./ibdata1, error: 11 InnoDB: Check that you do not already have another mysqld process InnoDB: using the same InnoDB data or log files. 140107 8:27:43 InnoDB: Unable to open the first

Java - Process.destroy() source code for Linux

好久不见. 提交于 2019-12-17 20:46:11
问题 I need to check to code of Process.destroy() to see how exactly it kill s a subprocess on Linux. Does anyone know what this method does or have a link to its source? I checked the jdk source and Process is just an abstract class and the destroy method has not been implemented, there seem to be no links to any subclass that extends or implements Process . Any help will be appreciated. Thanks, 回答1: Process management and all the like operations are done by the OS. Therefore, the JVM has to call

Java消息队列任务的平滑关闭

扶醉桌前 提交于 2019-12-17 18:22:44
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1.问题背景 对于消息队列任务的监听,我们一般使用Java写一个独立的程序,在Linux服务器上运行。当订阅者程序启动后,会通过消息队列客户端接收消息,放入线程池中并发的处理。 那么问题来了,当我们修改程序后,需要重新启动时,如何保证消息都能够被处理呢? 一些开源的消息队列中间件,会提供ACK机制(消息确认机制),当订阅者处理完消息后,会通知服务端删除对应消息,如果订阅者出现异常,服务端未收到确认消费,则会重试发送。 那如果消息队列中间件没有提供ACK机制,或者为了高吞度量的考虑关闭了ACK功能,如何最大可能保证消息都能够被处理呢? 正常来说,订阅者程序关闭后,消息会在队列中堆积,等待订阅者下次订阅消费,所以未接收的消息是不会丢失的。可能出现的问题就是在关闭的一瞬间,已经从消息队列中取出,但还没有被处理的消息。 因此我们需要一套平滑关闭的机制,保证在重启的时候,已接收的消息可以得到正常处理。 2.问题分析 平滑关闭的思路如下: 在关闭程序时,首先关闭消息订阅,保证不再接收新的消息。 关闭线程池,等待线程池中的消息处理完毕。 程序退出。 关闭消息订阅:消息队列的客户端都会提供关闭连接的方法,具体可以自行查看API。 关闭线程池:Java的 ThreadPoolExecutor 线程池提供 shutdown() 和

Activity restarts on Force Close

空扰寡人 提交于 2019-12-17 16:08:12
问题 I have an Application with a single root Activity. I've recently had it brought to my attention that any kind of Force Close on my Activity results in it restarting and I have no idea why this might happen. If I force an uncaught exception or use the 'long back press to force close' option, they both result in the same. My only guess would have been some form of quirk relating to retained references to some part of the Activity, only I don't have any outside of some WeakReference entries at

how can I kill a Linux process in java with SIGKILL Process.destroy() does SIGTERM

烂漫一生 提交于 2019-12-17 16:06:07
问题 In Linux when I run the destroy function on java.lang.Process object (Which is true typed java.lang.UNIXProcess ) it sends a SIGTERM signal to process, is there a way to kill it with SIGKILL? 回答1: Not using pure Java. Your simplest alternative is to use Runtime.exec() to run a kill -9 <pid> command as an external process. Unfortunately, it is not that simple to get hold of the PID. You will either need to use reflection black-magic to access the private int pid field, or mess around with the

kill a process started with popen

假如想象 提交于 2019-12-17 15:25:29
问题 After opening a pipe to a process with popen , is there a way to kill the process that has been started? (Using pclose is not what I want because that will wait for the process to finish, but I need to kill it.) 回答1: Don't use popen() , write your own wrapper that does what you'd like. It's fairly straightforward to fork() , and then replace stdin & stdout by using dup2() , and then calling exec() on your child. That way, your parent will have the exact child PID, and you can use kill() on

Kill or terminate subprocess when timeout?

醉酒当歌 提交于 2019-12-17 08:53:07
问题 I would like to repeatedly execute a subprocess as fast as possible. However, sometimes the process will take too long, so I want to kill it. I use signal.signal(...) like below: ppid=pipeexe.pid signal.signal(signal.SIGALRM, stop_handler) signal.alarm(1) ..... def stop_handler(signal, frame): print 'Stop test'+testdir+'for time out' if(pipeexe.poll()==None and hasattr(signal, "SIGKILL")): os.kill(ppid, signal.SIGKILL) return False but sometime this code will try to stop the next round from

How do I kill an Activity when the Back button is pressed?

↘锁芯ラ 提交于 2019-12-17 07:22:07
问题 I got an Activity that when it starts, it loads an image from the internet. In an effort to save memory, when the Activity is left by the back button being pressed, I want the activity to dump all data, that is get rid of all the strings and images that are in it. I figured the best way to do this was to just kill the activity. Well, I can't seem to figure out the callback for when the Back button is pressed. So, I have been trying to use the onPause() and the onStop() callbacks for the task