@Override public void start() throws Exception { super.start(); }
public void stop() throws Exception { super.stop(); out = null; }
public void onException(IOException error) { readyCountDownLatch.countDown(); /* * try { super.oneway(new ExceptionResponse(error)); } catch * (IOException e) { // ignore as we are already throwing an exception } */ super.onException(error); }
@Override public void oneway(Object command) throws IOException { String address =(next!=null?next.getRemoteAddress():null); if (address!=null) { String name = Thread.currentThread().getName(); try { String sendname = name + " - SendTo:"+address; Thread.currentThread().setName(sendname); super.oneway(command); }finally { Thread.currentThread().setName(name); } } else { super.oneway(command); } }
public Object request(Object command, int timeout) throws IOException { // Changed this method to use a LogWriter object to actually // print the messages to the log, and only in case of logging // being active, instead of logging the message directly. if (logging) logWriter.logRequest(log, command); Object rc = super.request(command, timeout); if (logging) logWriter.logResponse(log, command); return rc; }
public void install(TransportFilter filter) { filter.setTransportListener(this); getNext().setTransportListener(filter); setNext(filter); }
public void onCommand(Object o) { final Command command = (Command)o; // redirect to the endpoint that the last response came from Endpoint from = command.getFrom(); transport.setTargetEndpoint(from); super.onCommand(command); } }
Transport originalTransport = remoteBroker; while (originalTransport instanceof TransportFilter) { originalTransport = ((TransportFilter) originalTransport).getNext();
@Override public void transportResumed() { if( discoveryAgent instanceof Suspendable ) { try { ((Suspendable)discoveryAgent).suspend(); } catch (Exception e) { LOG.warn("Exception suspending discoverAgent: ", discoveryAgent); } } super.transportResumed(); }
@Override public void transportInterupted() { if( discoveryAgent instanceof Suspendable ) { try { ((Suspendable)discoveryAgent).resume(); } catch (Exception e) { LOG.warn("Exception resuming discoverAgent: ", discoveryAgent); } } super.transportInterupted(); } }
public void oneway(Object command) throws IOException { boolean wasInterrupted = Thread.interrupted(); try { if (readyCountDownLatch.getCount() > 0 && !readyCountDownLatch.await(negotiateTimeout, TimeUnit.MILLISECONDS)) { throw new IOException("Wire format negotiation timeout: peer did not send his wire format."); } } catch (InterruptedException e) { InterruptedIOException interruptedIOException = new InterruptedIOException("Interrupted waiting for wire format negotiation"); interruptedIOException.initCause(e); try { onException(interruptedIOException); } finally { Thread.currentThread().interrupt(); wasInterrupted = false; } throw interruptedIOException; } finally { if (wasInterrupted) { Thread.currentThread().interrupt(); } } super.oneway(command); }
public Object request(Object command) throws IOException { // Changed this method to use a LogWriter object to actually // print the messages to the log, and only in case of logging // being active, instead of logging the message directly. if (logging) logWriter.logRequest(log, command); Object rc = super.request(command); if (logging) logWriter.logResponse(log, command); return rc; }
public void install(TransportFilter filter) { filter.setTransportListener(this); getNext().setTransportListener(filter); setNext(filter); }
public void onCommand(Object o) { final Command command = (Command)o; // redirect to the endpoint that the last response came from Endpoint from = command.getFrom(); transport.setTargetEndpoint(from); super.onCommand(command); } }
Transport originalTransport = remoteBroker; while (originalTransport instanceof TransportFilter) { originalTransport = ((TransportFilter) originalTransport).getNext();
@Override public void transportResumed() { if( discoveryAgent instanceof Suspendable ) { try { ((Suspendable)discoveryAgent).suspend(); } catch (Exception e) { LOG.warn("Exception suspending discoverAgent: ", discoveryAgent); } } super.transportResumed(); }
@Override public void transportInterupted() { if( discoveryAgent instanceof Suspendable ) { try { ((Suspendable)discoveryAgent).resume(); } catch (Exception e) { LOG.warn("Exception resuming discoverAgent: ", discoveryAgent); } } super.transportInterupted(); } }
public void start() throws Exception { super.start(); if (firstStart.compareAndSet(true, false)) { sendWireFormat(); } }
@Override public void stop() throws Exception { super.stop(); }
private InterruptedIOException dealWithInterrupt(InterruptedException e) { if (LOG.isDebugEnabled()) { LOG.debug("Operation interrupted: " + e, e); } InterruptedIOException interruptedIOException = new InterruptedIOException(e.getMessage()); interruptedIOException.initCause(e); try { if (transportFilter != null) { transportFilter.onException(interruptedIOException); } } finally { Thread.currentThread().interrupt(); } return interruptedIOException; }