kill

killing an infinite loop in java

时光总嘲笑我的痴心妄想 提交于 2019-11-30 15:48:32
问题 I am using a third-party library to process a large number of data sets. The process very occasionally goes into an infinite loop (or is blocked - don't know why and can't get into the code). I'd like to kill this after a set time and continue to the next case. A simple example is: for (Object data : dataList) { Object result = TheirLibrary.processData(data); store(result); } processData normally takes 1 second max. I'd like to set a timer which kills processData() after , say, 10 seconds

killing an infinite loop in java

[亡魂溺海] 提交于 2019-11-30 15:09:19
I am using a third-party library to process a large number of data sets. The process very occasionally goes into an infinite loop (or is blocked - don't know why and can't get into the code). I'd like to kill this after a set time and continue to the next case. A simple example is: for (Object data : dataList) { Object result = TheirLibrary.processData(data); store(result); } processData normally takes 1 second max. I'd like to set a timer which kills processData() after , say, 10 seconds EDIT I would appreciate a code snippet (I am not practiced in using Threads). The Executor approach looks

How to find out which Node.js pid is running on which port

南笙酒味 提交于 2019-11-30 15:04:50
问题 I'd like to restart one of many Node.js processes I have running on my server. If I run ps ax | grep node I get a list of all my Node proccesses but it doesn't tell me which port they're on. How do I kill the one running on port 3000 (for instance). What is a good way to manage multiple Node processes? 回答1: If you run: $ netstat -anp 2> /dev/null | grep :3000 You should see something like: tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 5902/node In this case the 5902 is the pid. You can use something

Return code when OS kills your process

左心房为你撑大大i 提交于 2019-11-30 08:55:42
问题 I've wanted to test if with multiply processes I'm able to use more than 4GB of ram on 32bit O.S (mine: Ubuntu with 1GB ram). So I've written a small program that mallocs slightly less then 1GB, and do some action on that array, and ran 5 instances of this program vie forks. The thing is, that I suspect that O.S killed 4 of them, and only one survived and displayed it's "PID: I've finished"). (I've tried it with small arrays and got 5 printing, also when I look at the running processes with

How can I kill processes in Android?

纵饮孤独 提交于 2019-11-30 07:39:40
问题 I have this code below: package com.example.killall; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; //import android.widget.TextView; import android.app.ActivityManager; public class MainKill extends Activity { private Button BprocessesKill ; //private TextView processesKill; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main

shell script to kill the process listening on port 3000? [duplicate]

两盒软妹~` 提交于 2019-11-30 06:12:08
问题 This question already has answers here : How to kill a process running on particular port in Linux? (21 answers) Closed last year . I want to define a bash alias named kill3000 to automate the following task: $ lsof -i:3000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ruby 13402 zero 4u IPv4 2847851 0t0 TCP *:3000 (LISTEN) $ kill -9 13402 回答1: alias kill3000="fuser -k -n tcp 3000" 回答2: Try this: kill -9 $(lsof -i:3000 -t) The -t flag is what you want: it displays PID, and nothing else.

Android kill process [duplicate]

江枫思渺然 提交于 2019-11-30 02:28:07
问题 This question already has answers here : How to kill an application with all its activities? [duplicate] (6 answers) Closed 6 years ago . How to kill whole application in onne single click.. finish() is not working?? it redirects to tha previous activity...pls guide me. public void onClick(View arg0) { // TODO Auto-generated method stub WallpaperManager wp = WallpaperManager .getInstance(getApplicationContext()); try { Display d = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))

how to kill hadoop jobs

末鹿安然 提交于 2019-11-29 19:58:44
I want to kill all my hadoop jobs automatically when my code encounters an unhandled exception. I am wondering what is the best practice to do it? Thanks Depending on the version, do: version <2.3.0 Kill a hadoop job: hadoop job -kill $jobId You can get a list of all jobId's doing: hadoop job -list version >=2.3.0 Kill a hadoop job: yarn application -kill $ApplicationId You can get a list of all ApplicationId's doing: yarn application -list Use of folloing command is depreciated hadoop job -list hadoop job -kill $jobId consider using mapred job -list mapred job -kill $jobId Run list to show

How to kill a nohup process?

孤街醉人 提交于 2019-11-29 19:52:44
I executed the following command $ nohup ./tests.run.pl 0 & now when I try to kill it (and the executions that are started from this script) using $ kill -0 <process_id> it does not work. How can I kill a nohupped process and the processes that runs via the nohupped script? Thanks kill -0 does not kill the process. It just checks if you could send a signal to it. Simply kill pid , and if that doesn't work, try kill -9 pid . Simply kill <pid> which will send a SIGTERM , which nohup won't ignore. You should not send a SIGKILL first as that gives the process no chance to recover; you should try

Android - Perfect solution for quitting or terminating an application programmatically?

北城余情 提交于 2019-11-29 18:15:56
If my app encounters a particular error, I want to end my app without any trace of it remaining in the system. I have already seen many threads on this topic, specially these two. Is quitting an application frowned upon? How to quit android application programmatically The answers are great but the proposed solutions are too tedious and/or unnecessarily complex. Taking a cue from Neil Traft's answer in the first post above, I have found a perfect solution for such scenarios. System.exit(0) or android.os.Process.killProcess(android.os.Process.myPid()) both seem to work if you have only one