当前位置: 首页>>代码示例>>Java>>正文


Java Transport.setMaxFrameSize方法代码示例

本文整理汇总了Java中org.apache.qpid.proton.engine.Transport.setMaxFrameSize方法的典型用法代码示例。如果您正苦于以下问题:Java Transport.setMaxFrameSize方法的具体用法?Java Transport.setMaxFrameSize怎么用?Java Transport.setMaxFrameSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.qpid.proton.engine.Transport的用法示例。


在下文中一共展示了Transport.setMaxFrameSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleOpen

import org.apache.qpid.proton.engine.Transport; //导入方法依赖的package包/类
private void handleOpen(Reactor reactor, Event event) {
    Connection connection = event.getConnection();
    if (connection.getRemoteState() != EndpointState.UNINITIALIZED) {
        return;
    }
    // Outgoing Reactor connections set the virtual host automatically using the
    // following rules:
    String vhost = connection.getHostname();
    if (vhost == null) {
        // setHostname never called, use the host from the connection's
        // socket address as the default virtual host:
        String conAddr = reactor.getConnectionAddress(connection);
        if (conAddr != null) {
            Address addr = new Address(conAddr);
            connection.setHostname(addr.getHost());
        }
    } else if (vhost.isEmpty()) {
        // setHostname called explictly with a null string. This allows
        // the application to completely avoid sending a virtual host
        // name
        connection.setHostname(null);
    } else {
        // setHostname set by application - use it.
    }
    Transport transport = Proton.transport();

    int maxFrameSizeOption = reactor.getOptions().getMaxFrameSize();
    if (maxFrameSizeOption != 0) {
        transport.setMaxFrameSize(maxFrameSizeOption);
    }

    if (reactor.getOptions().isEnableSaslByDefault()) {
        Sasl sasl = transport.sasl();
        sasl.client();
        sasl.setMechanisms("ANONYMOUS");
    }

    transport.bind(connection);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:40,代码来源:IOHandler.java

示例2: run

import org.apache.qpid.proton.engine.Transport; //导入方法依赖的package包/类
@Override
public void run(Selectable selectable) {
    Reactor reactor = selectable.getReactor();
    try {
        SocketChannel socketChannel = ((ServerSocketChannel)selectable.getChannel()).accept();
        if (socketChannel == null) {
            throw new ReactorInternalException("Selectable readable, but no socket to accept");
        }
        Handler handler = BaseHandler.getHandler(AcceptorImpl.this);
        if (handler == null) {
            handler = reactor.getHandler();
        }
        Connection conn = reactor.connection(handler);
        Record conn_recs = conn.attachments();
        conn_recs.set(CONNECTION_ACCEPTOR_KEY, Acceptor.class, AcceptorImpl.this);
        InetSocketAddress peerAddr = (InetSocketAddress)socketChannel.getRemoteAddress();
        if (peerAddr != null) {
            Address addr = new Address();
            addr.setHost(peerAddr.getHostString());
            addr.setPort(Integer.toString(peerAddr.getPort()));
            conn_recs.set(ReactorImpl.CONNECTION_PEER_ADDRESS_KEY, Address.class, addr);
        }
        Transport trans = Proton.transport();

        int maxFrameSizeOption = reactor.getOptions().getMaxFrameSize();
        if (maxFrameSizeOption != 0) {
            trans.setMaxFrameSize(maxFrameSizeOption);
        }

        if(reactor.getOptions().isEnableSaslByDefault()) {
            Sasl sasl = trans.sasl();
            sasl.server();
            sasl.setMechanisms("ANONYMOUS");
            sasl.done(SaslOutcome.PN_SASL_OK);
        }
        trans.bind(conn);
        IOHandler.selectableTransport(reactor, socketChannel.socket(), trans);
    } catch(IOException ioException) {
        sel.error();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:42,代码来源:AcceptorImpl.java

示例3: AMQPConnectionContext

import org.apache.qpid.proton.engine.Transport; //导入方法依赖的package包/类
public AMQPConnectionContext(ProtonProtocolManager protocolManager,
                             AMQPConnectionCallback connectionSP,
                             String containerId,
                             int idleTimeout,
                             int maxFrameSize,
                             int channelMax,
                             boolean useCoreSubscriptionNaming,
                             ScheduledExecutorService scheduledPool,
                             boolean isIncomingConnection,
                             ClientSASLFactory saslClientFactory,
                             Map<Symbol, Object> connectionProperties) {

   this.protocolManager = protocolManager;
   this.connectionCallback = connectionSP;
   this.useCoreSubscriptionNaming = useCoreSubscriptionNaming;
   this.containerId = (containerId != null) ? containerId : UUID.randomUUID().toString();
   this.isIncomingConnection = isIncomingConnection;
   this.saslClientFactory = saslClientFactory;

   this.connectionProperties.put(AmqpSupport.PRODUCT, "apache-activemq-artemis");
   this.connectionProperties.put(AmqpSupport.VERSION, VersionLoader.getVersion().getFullVersion());

   if (connectionProperties != null) {
      this.connectionProperties.putAll(connectionProperties);
   }

   this.scheduledPool = scheduledPool;
   connectionCallback.setConnection(this);
   this.handler = new ProtonHandler(protocolManager.getServer().getExecutorFactory().getExecutor(), isIncomingConnection);
   handler.addEventHandler(this);
   Transport transport = handler.getTransport();
   transport.setEmitFlowEventOnSend(false);
   if (idleTimeout > 0) {
      transport.setIdleTimeout(idleTimeout);
   }
   transport.setChannelMax(channelMax);
   transport.setInitialRemoteMaxFrameSize(protocolManager.getInitialRemoteMaxFrameSize());
   transport.setMaxFrameSize(maxFrameSize);
   if (!isIncomingConnection && saslClientFactory != null) {
      handler.createClientSASL();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:43,代码来源:AMQPConnectionContext.java


注:本文中的org.apache.qpid.proton.engine.Transport.setMaxFrameSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。