/** Used internally. If overridden, call this method first. Only creates the down_handler thread if down_thread is true */ public void startDownHandler() { if(down_thread) { if(down_handler == null) { down_handler=new DownHandler(down_queue, this, observer); if(down_thread_prio >= 0) { try { down_handler.setPriority(down_thread_prio); } catch (VirtualMachineError err) { // GemStoneAddition // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } catch(Throwable t) { if(log.isErrorEnabled()) log.error("priority " + down_thread_prio + " could not be set for thread", t); } } down_handler.setDaemon(true); // GemStoneAddition down_handler.start(); } } }
public DownHandler(Queue mq, Protocol handler, ProtocolObserver observer) { super(GemFireTracer.GROUP, "TempName"); // GemStoneAddition this.mq=mq; this.handler=handler; this.observer=observer; if(handler != null) setName("DownHandler (" + handler.getName() + ')'); else setName("DownHandler"); setDaemon(true); }
if(down_handler != null && down_handler.isAlive()) { boolean interrupted = Thread.interrupted(); // GemStoneAddition try { down_handler.join(THREAD_JOIN_TIMEOUT); if(down_handler != null && down_handler.isAlive()) { down_handler.interrupt(); // still alive ? let's just kill it without mercy... down_handler.join(THREAD_JOIN_TIMEOUT); if(down_handler != null && down_handler.isAlive()) if(log.isErrorEnabled()) log.error("down_handler thread for " + getName() + " was interrupted (in order to be terminated), but is is still alive");
public void setObserver(ProtocolObserver observer) { this.observer=observer; observer.setProtocol(this); if(up_handler != null) up_handler.setObserver(observer); if(down_handler != null) down_handler.setObserver(observer); }
if(log.isWarnEnabled()) log.warn(getName() + " caught exception", e);