set Busy- and Blocking-Threads to daemon mode (they will now not prevent

YaCy from termination if still running)
pull/1/head
Michael Peter Christen 10 years ago
parent 64887f6b21
commit 7bfab5eb9d

@ -32,6 +32,10 @@ public abstract class AbstractBlockingThread<J extends WorkflowJob> extends Abst
private WorkflowProcessor<J> manager = null; private WorkflowProcessor<J> manager = null;
private final static ConcurrentLog log = new ConcurrentLog("AbstractBlockingThread"); private final static ConcurrentLog log = new ConcurrentLog("AbstractBlockingThread");
public AbstractBlockingThread() {
super();
}
@Override @Override
public void setManager(final WorkflowProcessor<J> manager) { public void setManager(final WorkflowProcessor<J> manager) {
this.manager = manager; this.manager = manager;

@ -45,6 +45,7 @@ public abstract class AbstractBusyThread extends AbstractThread implements BusyT
private long busySleep = Long.MIN_VALUE; private long busySleep = Long.MIN_VALUE;
public AbstractBusyThread(long idleSleep, long busySleep) { public AbstractBusyThread(long idleSleep, long busySleep) {
super();
this.idleSleep = idleSleep; this.idleSleep = idleSleep;
this.busySleep = busySleep; this.busySleep = busySleep;
} }

@ -48,6 +48,10 @@ public abstract class AbstractThread extends Thread implements WorkflowThread {
private String monitorURL = null; private String monitorURL = null;
private long threadBlockTimestamp = System.currentTimeMillis(); private long threadBlockTimestamp = System.currentTimeMillis();
public AbstractThread() {
this.setDaemon(true);
}
protected final void announceThreadBlockApply() { protected final void announceThreadBlockApply() {
// shall only be used, if a thread blocks for an important reason // shall only be used, if a thread blocks for an important reason
// like a socket connect and must renew the timestamp to correct // like a socket connect and must renew the timestamp to correct

@ -44,6 +44,8 @@ public class InstantBlockingThread<J extends WorkflowJob> extends AbstractBlocki
private static final ConcurrentMap<Long, String> jobs = new ConcurrentHashMap<Long, String>(); private static final ConcurrentMap<Long, String> jobs = new ConcurrentHashMap<Long, String>();
public InstantBlockingThread(final WorkflowProcessor<J> manager) { public InstantBlockingThread(final WorkflowProcessor<J> manager) {
super();
// jobExec is the name of a method of the object 'env' that executes the one-step-run // jobExec is the name of a method of the object 'env' that executes the one-step-run
// jobCount is the name of a method that returns the size of the job // jobCount is the name of a method that returns the size of the job

Loading…
Cancel
Save