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


Java Session.close方法代码示例

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


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

示例1: onRemoteClose

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
@Override
public void onRemoteClose(Session session) throws Exception {
   lock();
   try {
      session.close();
      session.free();
   } finally {
      unlock();
   }

   AMQPSessionContext sessionContext = (AMQPSessionContext) session.getContext();
   if (sessionContext != null) {
      sessionContext.close();
      sessions.remove(session);
      session.setContext(null);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:AMQPConnectionContext.java

示例2: onSessionRemoteClose

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
@Override
public void onSessionRemoteClose(Event evt) {
    Session ssn = evt.getSession();
    if (ssn.getLocalState() != EndpointState.CLOSED) {
        ssn.close();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:Handshaker.java

示例3: onSessionClose

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
private void onSessionClose(Session session) {
    AmqpSessionContext sessionContext = (AmqpSessionContext) session.getContext();
    if (sessionContext != null) {
        LOG.trace("Session {} closed", sessionContext.sessionId);
        sendToActiveMQ(new RemoveInfo(sessionContext.sessionId), null);
        session.setContext(null);
    }
    session.close();
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:10,代码来源:AmqpProtocolConverter.java

示例4: processSessionClose

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
private void processSessionClose(Session session) {
    ProtonSession protonSession = (ProtonSession) session.getContext();

    sessions.remove(protonSession.getId());

    session.close();
    session.free();
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:9,代码来源:NettySimpleAmqpServer.java

示例5: doLinkAttachAfterEndSentTestImpl

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
void doLinkAttachAfterEndSentTestImpl(boolean receiverLink)
{
    MockTransportImpl transport = new MockTransportImpl();
    Connection connection = Proton.connection();
    transport.bind(connection);

    connection.open();

    Session session = connection.session();
    session.open();

    Link link = null;
    if(receiverLink)
    {
        link = session.receiver("myReceiver");
    }
    else
    {
        link = session.sender("mySender");
    }

    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 2, transport.writes.size());

    assertTrue("Unexpected frame type", transport.writes.get(0) instanceof Open);
    assertTrue("Unexpected frame type", transport.writes.get(1) instanceof Begin);

    // Send the necessary responses to open/begin
    transport.handleFrame(new TransportFrame(0, new Open(), null));

    Begin begin = new Begin();
    begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
    transport.handleFrame(new TransportFrame(0, begin, null));

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 2, transport.writes.size());

    // Cause a End frame to be sent
    session.close();
    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
    assertTrue("Unexpected frame type", transport.writes.get(2) instanceof End);

    // Open the link and verify the transport doesn't
    // send any Attach frame, as an End frame was sent already.
    link.open();
    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:52,代码来源:TransportImplTest.java

示例6: doLinkDetachAfterEndSentTestImpl

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
void doLinkDetachAfterEndSentTestImpl(boolean receiverLink)
{
    MockTransportImpl transport = new MockTransportImpl();
    Connection connection = Proton.connection();
    transport.bind(connection);

    connection.open();

    Session session = connection.session();
    session.open();

    Link link = null;
    if(receiverLink)
    {
        link = session.receiver("myReceiver");
    }
    else
    {
        link = session.sender("mySender");
    }
    link.open();

    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());

    assertTrue("Unexpected frame type", transport.writes.get(0) instanceof Open);
    assertTrue("Unexpected frame type", transport.writes.get(1) instanceof Begin);
    assertTrue("Unexpected frame type", transport.writes.get(2) instanceof Attach);

    // Send the necessary responses to open/begin
    transport.handleFrame(new TransportFrame(0, new Open(), null));

    Begin begin = new Begin();
    begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
    transport.handleFrame(new TransportFrame(0, begin, null));

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());

    // Cause an End frame to be sent
    session.close();
    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 4, transport.writes.size());
    assertTrue("Unexpected frame type", transport.writes.get(3) instanceof End);

    // Close the link and verify the transport doesn't
    // send any Detach frame, as an End frame was sent already.
    link.close();
    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 4, transport.writes.size());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:54,代码来源:TransportImplTest.java

示例7: testSessionEndAfterCloseSent

import org.apache.qpid.proton.engine.Session; //导入方法依赖的package包/类
/**
 * Verify that no End frame is emitted by the Transport should a Session close
 * after the Close frame was sent.
 */
@Test
public void testSessionEndAfterCloseSent()
{
    MockTransportImpl transport = new MockTransportImpl();
    Connection connection = Proton.connection();
    transport.bind(connection);

    connection.open();

    Session session = connection.session();
    session.open();

    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 2, transport.writes.size());

    assertTrue("Unexpected frame type", transport.writes.get(0) instanceof Open);
    assertTrue("Unexpected frame type", transport.writes.get(1) instanceof Begin);

    // Send the necessary responses to open/begin
    transport.handleFrame(new TransportFrame(0, new Open(), null));

    Begin begin = new Begin();
    begin.setRemoteChannel(UnsignedShort.valueOf((short) 0));
    transport.handleFrame(new TransportFrame(0, begin, null));

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 2, transport.writes.size());

    // Cause a Close frame to be sent
    connection.close();
    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
    assertTrue("Unexpected frame type", transport.writes.get(2) instanceof Close);

    // Close the session and verify the transport doesn't
    // send any End frame, as a Close frame was sent already.
    session.close();
    pumpMockTransport(transport);

    assertEquals("Unexpected frames written: " + getFrameTypesWritten(transport), 3, transport.writes.size());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:47,代码来源:TransportImplTest.java


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