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

Java Link类代码示例

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

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



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

示例1: onDelivery

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onDelivery(Event evt) {
    Delivery dlv = evt.getDelivery();
    Link link = dlv.getLink();
    if (link instanceof Sender) {
        dlv.settle();
    } else {
        Receiver rcv = (Receiver) link;
        if (!dlv.isPartial()) {
            byte[] bytes = new byte[dlv.pending()];
            rcv.recv(bytes, 0, bytes.length);
            String address = router.getAddress(rcv);
            Message message = new Message(bytes);
            messages.put(address, message);
            dlv.disposition(Accepted.getInstance());
            dlv.settle();
            if (!quiet) {
                System.out.println(String.format("Got message(%s): %s", address, message));
            }
            send(address);
        }
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:24,代码来源:Server.java


示例2: resolve

import org.apache.qpid.proton.engine.Link; //导入依赖的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


示例3: onLinkFlow

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkFlow(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Sender) {
        Sender sender = (Sender) link;
        while ((sent < count) && sender.getCredit() > 0) {
            Delivery dlv = sender.delivery(String.format("spout-%s", sent).getBytes());

            Message msg = new Message(String.format("Hello World! [%s]", sent));
            byte[] bytes = msg.getBytes();
            sender.send(bytes, 0, bytes.length);
            sender.advance();

            if (!quiet) {
                System.out.println(String.format("Sent %s to %s: %s", new String(dlv.getTag()),
                                                 sender.getTarget().getAddress(), msg));
            }
            sent++;
        }
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:22,代码来源:Spout.java


示例4: getReactor

import org.apache.qpid.proton.engine.Link; //导入依赖的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


示例5: onUnhandled

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onUnhandled(Event event) {
    int window = this.window;
    Link link = event.getLink();

    switch(event.getType()) {
    case LINK_LOCAL_OPEN:
    case LINK_REMOTE_OPEN:
    case LINK_FLOW:
    case DELIVERY:
        if (link instanceof Receiver) {
            this.drained += link.drained();
            if (this.drained == 0) {
                topup((Receiver)link, window);
            }
        }
        break;
    default:
        break;
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:22,代码来源:FlowController.java


示例6: remoteLinkOpened

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
protected void remoteLinkOpened(Link link) throws Exception {

      AMQPSessionContext protonSession = getSessionExtension(link.getSession());

      link.setSource(link.getRemoteSource());
      link.setTarget(link.getRemoteTarget());
      if (link instanceof Receiver) {
         Receiver receiver = (Receiver) link;
         if (link.getRemoteTarget() instanceof Coordinator) {
            Coordinator coordinator = (Coordinator) link.getRemoteTarget();
            protonSession.addTransactionHandler(coordinator, receiver);
         } else {
            protonSession.addReceiver(receiver);
         }
      } else {
         Sender sender = (Sender) link;
         protonSession.addSender(sender);
      }
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:AMQPConnectionContext.java


示例7: onLinkFlow

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkFlow(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Sender) {
        Sender snd = (Sender) link;
        send(router.getAddress(snd), snd);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:Server.java


示例8: add

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
private void add(Link link) {
    if (link instanceof Sender) {
        add((Sender) link);
    } else {
        add((Receiver) link);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:Router.java


示例9: remove

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
private void remove(Link link) {
    if (link instanceof Sender) {
        remove((Sender) link);
    } else {
        remove((Receiver) link);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:Router.java


示例10: onLinkRemoteOpen

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkRemoteOpen(Event evt) {
    Link link = evt.getLink();
    if (link.getLocalState() == EndpointState.UNINITIALIZED) {
        link.setSource(link.getRemoteSource());
        link.setTarget(link.getRemoteTarget());
        link.open();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:10,代码来源:Handshaker.java


示例11: onLinkRemoteClose

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


示例12: onLinkLocalOpen

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkLocalOpen(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Receiver) {
        Receiver receiver = (Receiver) link;

        if (block) {
            receiver.flow(count);
        } else {
            receiver.drain(count);
        }
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:14,代码来源:Drain.java


示例13: onLinkFlow

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkFlow(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Receiver) {
        Receiver receiver = (Receiver) link;

        if (!receiver.draining()) {
            receiver.getSession().getConnection().close();
        }
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:Drain.java


示例14: onLinkLocalOpen

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkLocalOpen(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Receiver) {
        topUp((Receiver) link);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:FlowController.java


示例15: onLinkRemoteOpen

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkRemoteOpen(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Receiver) {
        topUp((Receiver) link);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:FlowController.java


示例16: onLinkFlow

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onLinkFlow(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Receiver) {
        topUp((Receiver) link);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:FlowController.java


示例17: onDelivery

import org.apache.qpid.proton.engine.Link; //导入依赖的package包/类
@Override
public void onDelivery(Event evt) {
    Link link = evt.getLink();
    if (link instanceof Receiver) {
        topUp((Receiver) link);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:FlowController.java


示例18: linkHead

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


示例19: getSession

import org.apache.qpid.proton.engine.Link; //导入依赖的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


示例20: getLink

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java FFT类代码示例发布时间:2022-05-22
下一篇:
Java CDropTarget类代码示例发布时间: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