protected TimeStampStream getWriter() { return next.narrow(TimeStampStream.class); }
protected Socket getSocket() { return next.narrow(Socket.class); }
@Override public <T> T narrow(Class<T> target) { if (target.isAssignableFrom(getClass())) { return target.cast(this); } return next.narrow(target); }
@Override public <T> T narrow(Class<T> target) { if (target.isAssignableFrom(getClass())) { return target.cast(this); } Transport transport = connectedTransport.get(); if (transport != null) { return transport.narrow(target); } return null; }
private void stopFailoverTransport(Transport transport) { FailoverTransport failoverTransport = transport.narrow(FailoverTransport.class); if (failoverTransport != null) { // may be blocked on write, in which case stop will block try { failoverTransport.handleTransportFailure(new IOException("Bridge stopped")); } catch (InterruptedException ignored) {} } }
@Override public <T> T narrow(Class<T> target) { if (target.isAssignableFrom(getClass())) { return target.cast(this); } return getNext().narrow(target); }
@Override public <T> T narrow(Class<T> target) { if (target.isAssignableFrom(getClass())) { return target.cast(this); } synchronized (reconnectMutex) { for (Iterator<FanoutTransportHandler> iter = transports.iterator(); iter.hasNext();) { FanoutTransportHandler th = iter.next(); if (th.transport != null) { T rc = th.transport.narrow(target); if (rc != null) { return rc; } } } } return null; }
/** * Overriding to allow for proper configuration through reflection but * delegate to get common configuration */ @Override public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { if (transport instanceof SslTransport) { SslTransport sslTransport = (SslTransport) transport.narrow(SslTransport.class); IntrospectionSupport.setProperties(sslTransport, options); } else if (transport instanceof NIOSSLTransport) { NIOSSLTransport sslTransport = (NIOSSLTransport) transport.narrow(NIOSSLTransport.class); IntrospectionSupport.setProperties(sslTransport, options); } return super.compositeConfigure(transport, format, options); }
/** * Overriding to allow for proper configuration through reflection but delegate to get common * configuration */ @Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { SslTransport sslTransport = transport.narrow(SslTransport.class); IntrospectionSupport.setProperties(sslTransport, options); return super.compositeConfigure(transport, format, options); }
private Transport createRemoteTransport(final Transport local) throws Exception { Transport transport = TransportFactory.compositeConnect(remote); CompositeTransport ct = transport.narrow(CompositeTransport.class); if (ct != null && localUri != null && proxyToLocalBroker) { ct.add(false, new URI[] { localUri }); } // Add a transport filter so that we can track the transport life cycle transport = new TransportFilter(transport) { @Override public void stop() throws Exception { LOG.info("Stopping proxy."); super.stop(); ProxyConnection dummy = new ProxyConnection(local, this); LOG.debug("Removing proxyConnection {}", dummy.toString()); connections.remove(dummy); } }; return transport; }
private void signalInterruptionProcessingComplete() { if (LOG.isDebugEnabled()) { LOG.debug("transportInterruptionProcessingComplete: " + transportInterruptionProcessingComplete.get() + " for:" + this.getConnectionInfo().getConnectionId()); } FailoverTransport failoverTransport = transport.narrow(FailoverTransport.class); if (failoverTransport != null) { failoverTransport.connectionInterruptProcessingComplete(this.getConnectionInfo().getConnectionId()); if (LOG.isDebugEnabled()) { LOG.debug("notified failover transport (" + failoverTransport + ") of interruption completion for: " + this.getConnectionInfo().getConnectionId()); } } transportInterruptionProcessingComplete.set(0); }
private void signalInterruptionProcessingNeeded() { FailoverTransport failoverTransport = transport.narrow(FailoverTransport.class); if (failoverTransport != null) { failoverTransport.getStateTracker().transportInterrupted(this.getConnectionInfo().getConnectionId()); if (LOG.isDebugEnabled()) { LOG.debug("notified failover transport (" + failoverTransport + ") of pending interruption processing for: " + this.getConnectionInfo().getConnectionId()); } } }
Socket socket = next.narrow(Socket.class); if (socket != null) { socket.setTcpNoDelay(wireFormat.isTcpNoDelayEnabled());
private void collectBrokerInfos() { int timeout = 30000; TcpTransport tcpTransport = remoteBroker.narrow(TcpTransport.class); if (tcpTransport != null) { timeout = tcpTransport.getConnectionTimeout();
@Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { TcpTransport tcpTransport = transport.narrow(TcpTransport.class); IntrospectionSupport.setProperties(tcpTransport, options); Map<String, Object> socketOptions = IntrospectionSupport.extractProperties(options, "socket."); tcpTransport.setSocketOptions(socketOptions); if (tcpTransport.isTrace()) { try { transport = TransportLoggerSupport.createTransportLogger(transport, tcpTransport.getLogWriterName(), tcpTransport.isDynamicManagement(), tcpTransport.isStartLogging(), tcpTransport.getJmxPort()); } catch (Throwable e) { LOG.error("Could not create TransportLogger object for: " + tcpTransport.getLogWriterName() + ", reason: " + e, e); } } boolean useInactivityMonitor = "true".equals(getOption(options, "useInactivityMonitor", "true")); if (useInactivityMonitor && isUseInactivityMonitor(transport)) { transport = createInactivityMonitor(transport, format); IntrospectionSupport.setProperties(transport, options); } // Only need the WireFormatNegotiator if using openwire if (format instanceof OpenWireFormat) { transport = new WireFormatNegotiator(transport, (OpenWireFormat)format, tcpTransport.getMinmumWireFormatVersion()); } return super.compositeConfigure(transport, format, options); }
@Override public <T> T narrow(Class<T> target) { if (target.isAssignableFrom(getClass())) { return target.cast(this); } return next.narrow(target); }
/** * Overriding to allow for proper configuration through reflection but delegate to get common * configuration */ @Override @SuppressWarnings("rawtypes") public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { SslTransport sslTransport = transport.narrow(SslTransport.class); IntrospectionSupport.setProperties(sslTransport, options); return super.compositeConfigure(transport, format, options); }
@SuppressWarnings("rawtypes") @Override public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { transport = super.serverConfigure(transport, format, options); MutexTransport mutex = transport.narrow(MutexTransport.class); if (mutex != null) { mutex.setSyncOnCommand(true); } return transport; }
@Override protected Transport createInactivityMonitor(Transport transport, WireFormat format) { StompInactivityMonitor monitor = new StompInactivityMonitor(transport, format); StompTransportFilter filter = (StompTransportFilter) transport.narrow(StompTransportFilter.class); filter.setInactivityMonitor(monitor); return monitor; } }
@SuppressWarnings("rawtypes") @Override public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { transport = super.serverConfigure(transport, format, options); MutexTransport mutex = transport.narrow(MutexTransport.class); if (mutex != null) { mutex.setSyncOnCommand(true); } return transport; }