• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Session类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Session类属于org.apache.qpid.proton.engine包,在下文中一共展示了Session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resolve

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
private <T extends Link> T resolve(String remote, String local,
                                   LinkResolver<T> resolver,
                                   LinkConstructor<T> constructor) {
    String host = remote.substring(2).split("/", 2)[0];
    T link = resolver.resolve(remote);
    if (link == null) {
        Connection conn = connections.get(host);
        if (conn == null) {
            conn = Connection.Factory.create();
            conn.collect(collector);
            conn.setHostname(host);
            conn.open();
            connections.put(host, conn);
        }

        Session ssn = conn.session();
        ssn.open();

        link = constructor.create(ssn, remote, local);
        link.open();
    }
    return link;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:24,代码来源:Pool.java


示例2: onConnectionInit

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public void onConnectionInit(Event event) {
    Connection conn = event.getConnection();

    // Every session or link could have their own handler(s) if we
    // wanted simply by adding the handler to the given session
    // or link
    Session ssn = conn.session();

    // If a link doesn't have an event handler, the events go to
    // its parent session. If the session doesn't have a handler
    // the events go to its parent connection. If the connection
    // doesn't have a handler, the events go to the reactor.
    Sender snd = ssn.sender("sender");
    conn.open();
    ssn.open();
    snd.open();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:19,代码来源:Send.java


示例3: getConnection

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public Connection getConnection()
{
    if (context instanceof Connection) {
        return (Connection) context;
    } else if (context instanceof Transport) {
        Transport transport = getTransport();
        if (transport == null) {
            return null;
        }
        return ((TransportImpl) transport).getConnectionImpl();
    } else {
        Session ssn = getSession();
        if (ssn == null) {
            return null;
        }
        return ssn.getConnection();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:20,代码来源:EventImpl.java


示例4: getTransport

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public Transport getTransport()
{
    if (context instanceof Transport) {
        return (Transport) context;
    } else if (context instanceof Connection) {
        return ((Connection)context).getTransport();
    } else {
        Session session = getSession();
        if (session == null) {
            return null;
        }

        Connection connection = session.getConnection();
        if (connection == null) {
            return null;
        }

        return connection.getTransport();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:22,代码来源:EventImpl.java


示例5: getReactor

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public Reactor getReactor() {
    if (context instanceof Reactor) {
        return (Reactor) context;
    } else if (context instanceof Task) {
        return ((Task)context).getReactor();
    } else if (context instanceof Transport) {
        return ((TransportImpl)context).getReactor();
    } else if (context instanceof Delivery) {
        return ((Delivery)context).getLink().getSession().getConnection().getReactor();
    } else if (context instanceof Link) {
        return ((Link)context).getSession().getConnection().getReactor();
    } else if (context instanceof Session) {
        return ((Session)context).getConnection().getReactor();
    } else if (context instanceof Connection) {
        return ((Connection)context).getReactor();
    } else if (context instanceof Selectable) {
        return ((Selectable)context).getReactor();
    }
    return null;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:22,代码来源:EventImpl.java


示例6: testOpenSessionBeforeOpenConnection

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Test
public void testOpenSessionBeforeOpenConnection()
{
    MockTransportImpl transport = new MockTransportImpl();
    Connection connection = Proton.connection();
    transport.bind(connection);

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

    pumpMockTransport(transport);

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

    connection.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);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:24,代码来源:TransportImplTest.java


示例7: testGetTransportWithDeliveryContext

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Test
public void testGetTransportWithDeliveryContext()
{
    Transport transport = Transport.Factory.create();
    Connection connection = Connection.Factory.create();
    transport.bind(connection);

    Session session = connection.session();
    Sender sender = session.sender("mySender");

    Delivery delivery = sender.delivery("tag".getBytes());

    EventImpl event = createEvent(delivery, Event.Type.DELIVERY);

    assertNotNull("No transport returned", event.getTransport());
    assertSame("Incorrect transport returned", transport, event.getTransport());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:EventImplTest.java


示例8: 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


示例9: close

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public void close() throws NetworkException, MessagingException, TimeoutException
{
    synchronized (_lock)
    {
        if (!_closed.get())
        {
            _closed.set(true);
            if (_connected.get())
            {
                for (Session ssn : _sessions.keySet())
                {
                    _sessions.get(ssn).closeImpl();
                }
                _sessions.clear();
                _connection.close();
                write();
                closeNetworkConnection();
            }
        }
    }
}
 
开发者ID:rajith77,项目名称:splash,代码行数:23,代码来源:BaseConnection.java


示例10: createSender

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
private void createSender(org.apache.qpid.proton.engine.Session session) throws Exception {
   Sender sender = session.sender(subscriberInfo.getClientId());
   Target target = new Target();
   target.setAddress(subscriberInfo.getClientAddress());
   sender.setTarget(target);

   Source source = new Source();
   source.setAddress(subscriberInfo.getClientAddress());
   source.setDurable(TerminusDurability.UNSETTLED_STATE);
   sender.setSource(source);

   sender.open();
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:14,代码来源:LinkInitiator.java


示例11: onSessionRemoteOpen

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


示例12: 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


示例13: newOutgoing

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
public Sender newOutgoing(Session ssn, String remote, String local) {
    Sender snd = ssn.sender(String.format("%s-%s", local, remote));
    Source src = new Source();
    src.setAddress(local);
    snd.setSource(src);
    Target tgt = new Target();
    tgt.setAddress(remote);
    snd.setTarget(tgt);
    return snd;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:Pool.java


示例14: newIncoming

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
public Receiver newIncoming(Session ssn, String remote, String local) {
    Receiver rcv = ssn.receiver(String.format("%s-%s", remote, local));
    Source src = new Source();
    src.setAddress(remote);
    rcv.setSource(src);
    Target tgt = new Target();
    tgt.setAddress(remote);
    rcv.setTarget(tgt);
    return rcv;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:11,代码来源:Pool.java


示例15: next

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public Session next(EnumSet<EndpointState> local, EnumSet<EndpointState> remote)
{
    LinkNode.Query<SessionImpl> query = new EndpointImplQuery<SessionImpl>(local, remote);

    LinkNode<SessionImpl> sessionNode = _node.next(query);

    return sessionNode == null ? null : sessionNode.getValue();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:10,代码来源:SessionImpl.java


示例16: sessionHead

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public Session sessionHead(final EnumSet<EndpointState> local, final EnumSet<EndpointState> remote)
{
    if(_sessionHead == null)
    {
        return null;
    }
    else
    {
        LinkNode.Query<SessionImpl> query = new EndpointImplQuery<SessionImpl>(local, remote);
        LinkNode<SessionImpl> node = query.matches(_sessionHead) ? _sessionHead : _sessionHead.next(query);
        return node == null ? null : node.getValue();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:15,代码来源:ConnectionImpl.java


示例17: doFree

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
void doFree() {
    List<SessionImpl> sessions = new ArrayList<SessionImpl>(_sessions);
    for(Session session : sessions) {
        session.free();
    }
    _sessions = null;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ConnectionImpl.java


示例18: getSession

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Override
public Session getSession()
{
    if (context instanceof Session) {
        return (Session) context;
    } else {
        Link link = getLink();
        if (link == null) {
            return null;
        }
        return link.getSession();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:14,代码来源:EventImpl.java


示例19: doOpenLinkBeforeOpenConnectionTestImpl

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

    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), 0, transport.writes.size());

    // Now open the connection, expect the Open, Begin, and Attach frames
    connection.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);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:36,代码来源:TransportImplTest.java


示例20: testReceiverFlowBeforeOpenConnection

import org.apache.qpid.proton.engine.Session; //导入依赖的package包/类
@Test
public void testReceiverFlowBeforeOpenConnection()
{
    MockTransportImpl transport = new MockTransportImpl();
    Connection connection = Proton.connection();
    transport.bind(connection);

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

    Receiver reciever = session.receiver("myReceiver");
    reciever.flow(5);

    pumpMockTransport(transport);

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

    // Now open the connection, expect the Open and Begin frames but
    // nothing else as we haven't opened the receiver itself yet.
    connection.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);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:29,代码来源:TransportImplTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringResourceStream类代码示例发布时间:2022-05-22
下一篇:
Java Brand类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap