protected OpenWireFormatFactory createWireFormatFactory() { OpenWireFormatFactory wf = new OpenWireFormatFactory(); wf.setCacheEnabled(false); wf.setVersion(1); wf.setTightEncodingEnabled(true); wf.setSizePrefixDisabled(true); return wf; }
@Override public boolean isProtocol(byte[] value) { if (value.length < 8) { throw new IllegalArgumentException("Protocol header length changed " + value.length); } int start = !((OpenWireFormat)wireFormatFactory.createWireFormat()).isSizePrefixDisabled() ? 4 : 0; int j = 0; // type if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) { return false; } start++; WireFormatInfo info = new WireFormatInfo(); final byte[] magic = info.getMagic(); int remainingLen = value.length - start; int useLen = remainingLen > magic.length ? magic.length : remainingLen; useLen += start; // magic for (int i = start; i < useLen; i++) { if (value[i] != magic[j]) { return false; } j++; } return true; }
protected void initOpenWireProtocolVerifier() { if (isAllProtocols() || enabledProtocols.contains(AutoTransportUtils.OPENWIRE)) { OpenWireProtocolVerifier owpv; if (wireFormatFactory instanceof OpenWireFormatFactory) { owpv = new OpenWireProtocolVerifier((OpenWireFormatFactory) wireFormatFactory); } else { owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory()); } protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv); } }
public OpenWireProtocolManager(OpenWireProtocolManagerFactory factory, ActiveMQServer server) { this.factory = factory; this.server = server; this.wireFactory = new OpenWireFormatFactory(); // preferred prop, should be done via config wireFactory.setCacheEnabled(false); advisoryProducerId.setConnectionId(ID_GENERATOR.generateId()); scheduledPool = server.getScheduledPool(); this.wireFormat = (OpenWireFormat) wireFactory.createWireFormat(); final ClusterManager clusterManager = this.server.getClusterManager(); ClusterConnection cc = clusterManager.getDefaultConnection(null); if (cc != null) { cc.addClusterTopologyListener(this); } }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); //server.setWireFormatFactory(createWireFormatFactory(options)); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
protected OpenWireFormatFactory createWireFormatFactory() { OpenWireFormatFactory wf = new OpenWireFormatFactory(); wf.setCacheEnabled(false); wf.setVersion(1); wf.setTightEncodingEnabled(true); wf.setSizePrefixDisabled(true); return wf; }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); //server.setWireFormatFactory(createWireFormatFactory(options)); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
@Override public boolean isProtocol(byte[] value) { if (value.length < 8) { throw new IllegalArgumentException("Protocol header length changed " + value.length); } int start = !((OpenWireFormat)wireFormatFactory.createWireFormat()).isSizePrefixDisabled() ? 4 : 0; int j = 0; // type if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) { return false; } start++; WireFormatInfo info = new WireFormatInfo(); final byte[] magic = info.getMagic(); int remainingLen = value.length - start; int useLen = remainingLen > magic.length ? magic.length : remainingLen; useLen += start; // magic for (int i = start; i < useLen; i++) { if (value[i] != magic[j]) { return false; } j++; } return true; }
protected OpenWireFormatFactory createWireFormatFactory() { OpenWireFormatFactory wf = new OpenWireFormatFactory(); wf.setCacheEnabled(false); wf.setVersion(1); wf.setTightEncodingEnabled(true); wf.setSizePrefixDisabled(true); return wf; }
@Override public TransportServer doBind(final URI location) throws IOException { try { if (SslContext.getCurrentSslContext() != null) { try { context = SslContext.getCurrentSslContext().getSSLContext(); } catch (Exception e) { throw new IOException(e); } } Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setAutoTransportOptions(IntrospectionSupport.extractProperties(options, "auto.")); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
@Override public boolean isProtocol(byte[] value) { if (value.length < 8) { throw new IllegalArgumentException("Protocol header length changed " + value.length); } int start = !((OpenWireFormat)wireFormatFactory.createWireFormat()).isSizePrefixDisabled() ? 4 : 0; int j = 0; // type if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) { return false; } start++; WireFormatInfo info = new WireFormatInfo(); final byte[] magic = info.getMagic(); int remainingLen = value.length - start; int useLen = remainingLen > magic.length ? magic.length : remainingLen; useLen += start; // magic for (int i = start; i < useLen; i++) { if (value[i] != magic[j]) { return false; } j++; } return true; }
protected OpenWireFormatFactory createWireFormatFactory() { OpenWireFormatFactory wf = new OpenWireFormatFactory(); wf.setCacheEnabled(false); wf.setVersion(1); wf.setTightEncodingEnabled(true); wf.setSizePrefixDisabled(true); return wf; }
protected void initOpenWireProtocolVerifier() { if (isAllProtocols() || enabledProtocols.contains(AutoTransportUtils.OPENWIRE)) { OpenWireProtocolVerifier owpv; if (wireFormatFactory instanceof OpenWireFormatFactory) { owpv = new OpenWireProtocolVerifier((OpenWireFormatFactory) wireFormatFactory); } else { owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory()); } protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv); } }
@Override public boolean isProtocol(byte[] value) { if (value.length < 8) { throw new IllegalArgumentException("Protocol header length changed " + value.length); } int start = !((OpenWireFormat)wireFormatFactory.createWireFormat()).isSizePrefixDisabled() ? 4 : 0; int j = 0; // type if (value[start] != WireFormatInfo.DATA_STRUCTURE_TYPE) { return false; } start++; WireFormatInfo info = new WireFormatInfo(); final byte[] magic = info.getMagic(); int remainingLen = value.length - start; int useLen = remainingLen > magic.length ? magic.length : remainingLen; useLen += start; // magic for (int i = start; i < useLen; i++) { if (value[i] != magic[j]) { return false; } j++; } return true; }
protected OpenWireFormatFactory createWireFormatFactory() { OpenWireFormatFactory wf = new OpenWireFormatFactory(); wf.setCacheEnabled(false); wf.setVersion(1); wf.setTightEncodingEnabled(true); wf.setSizePrefixDisabled(true); return wf; }
protected void initOpenWireProtocolVerifier() { if (isAllProtocols() || enabledProtocols.contains(AutoTransportUtils.OPENWIRE)) { OpenWireProtocolVerifier owpv; if (wireFormatFactory instanceof OpenWireFormatFactory) { owpv = new OpenWireProtocolVerifier((OpenWireFormatFactory) wireFormatFactory); } else { owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory()); } protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv); } }
@Override public ConnectionEntry createConnectionEntry(Acceptor acceptorUsed, Connection connection) { OpenWireFormat wf = (OpenWireFormat) wireFactory.createWireFormat(); OpenWireConnection owConn = new OpenWireConnection(connection, server, server.getExecutorFactory().getExecutor(), this, wf); owConn.sendHandshake(); //first we setup ttl to -1 //then when negotiation, we handle real ttl and delay ConnectionEntry entry = new ConnectionEntry(owConn, null, System.currentTimeMillis(), -1); owConn.setConnectionEntry(entry); return entry; }
protected void initOpenWireProtocolVerifier() { if (isAllProtocols() || enabledProtocols.contains(AutoTransportUtils.OPENWIRE)) { OpenWireProtocolVerifier owpv; if (wireFormatFactory instanceof OpenWireFormatFactory) { owpv = new OpenWireProtocolVerifier((OpenWireFormatFactory) wireFormatFactory); } else { owpv = new OpenWireProtocolVerifier(new OpenWireFormatFactory()); } protocolVerifiers.put(AutoTransportUtils.OPENWIRE, owpv); } }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); //server.setWireFormatFactory(createWireFormatFactory(options)); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }
@Override public TransportServer doBind(final URI location) throws IOException { try { Map<String, String> options = new HashMap<String, String>(URISupport.parseParameters(location)); Map<String, Object> autoProperties = IntrospectionSupport.extractProperties(options, "auto."); this.enabledProtocols = AutoTransportUtils.parseProtocols((String) autoProperties.get("protocols")); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); AutoTcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); //server.setWireFormatFactory(createWireFormatFactory(options)); server.setWireFormatFactory(new OpenWireFormatFactory()); if (options.get("allowLinkStealing") != null){ allowLinkStealingSet = true; } IntrospectionSupport.setProperties(server, options); server.setTransportOption(IntrospectionSupport.extractProperties(options, "transport.")); server.setWireFormatOptions(AutoTransportUtils.extractWireFormatOptions(options)); server.bind(); return server; } catch (URISyntaxException e) { throw IOExceptionSupport.create(e); } }