首页 \ 问答 \ python的asyncio中的可加入PriorityQueue(Joinable PriorityQueue in python's asyncio)

python的asyncio中的可加入PriorityQueue(Joinable PriorityQueue in python's asyncio)

根据文档 ,有几种Queue实现。 我感兴趣的是JoinableQueue和PriorityQueue,因为我想拥有一个具有优先级的可连接队列。

似乎我只能获得较低版本中的一个功能。 即在3.5中我可以使用Queue(可连接)和PriorityQueue进行区分,但是在3.5以下的python中有JoinableQueue和PriorityQueue(参见下面的示例)。

是否可以将它们组合起来以获得在3.4中获得可连接的PriorityQueue的一般方法?

try:
    # Python 3.4.
    from asyncio import JoinableQueue as Queue # joinable
    from asyncio import PriorityQueue          # I assume this one is not joinable
except ImportError:
    # Python 3.5.
    from asyncio import Queue                  # standard joinable
    from asyncio import PriorityQueue          # I assume this is the one I want

另一种方法是以某种方式影响队列?


As per the documentation, there are several implementations of Queues. The ones I'm interested in are the JoinableQueue and the PriorityQueue, as I'd like to have a joinable queue with priorities.

It appears that I can only get one of the functionalities in the lower versions. I.e. in 3.5 I can make the distinciton with Queue (which is joinable) and PriorityQueue, but in python below 3.5 there is JoinableQueue and PriorityQueue (see example below).

Is it possible to combine them to get a general way to get a joinable PriorityQueue in 3.4?

try:
    # Python 3.4.
    from asyncio import JoinableQueue as Queue # joinable
    from asyncio import PriorityQueue          # I assume this one is not joinable
except ImportError:
    # Python 3.5.
    from asyncio import Queue                  # standard joinable
    from asyncio import PriorityQueue          # I assume this is the one I want

Another approach would be to somehow perhaps influence Queue?


原文:https://stackoverflow.com/questions/31370701
更新时间:2023-05-13 06:05

最满意答案

默认情况下,您的服务是WRAPPED而不是BARE,因此消息中的顶级项必须是与操作同名的类型。 在'经典'JAX-WS中,这需要您添加包装类型。

如果您使用Apache CXF ,它将使用ASM自动生成这些包装器。


By default, your service is WRAPPED, not BARE, and so the top-level item in the message has to be a type with the same name as the operation. In 'classic' JAX-WS, this requires you to add a wrapper type.

If you use Apache CXF, it will automatically generate these wrappers with ASM.

相关问答

更多
  • 您可以使用WSDL Customization中描述的外部绑定文件来自定义WSDL错误到异常名称的映射。 这在“异常类”中明确描述。 You can use an external binding file as described in WSDL Customization to customise the mapping of WSDL faults to exception names. This is described explicitly in The Exception Class.
  • 我想,从您的问题中扣除,您想要使用Apache CXF。 在回答你的问题时: 对于某些特定的应用程序服务器,您需要指定一些其他配置。 请参阅Application Server特定配置指南 。 当然。 默认行为是大多数应用程序服务器首先是服务器的加载类,然后是模块中的类。 因此Apache CXF可能无法正常工作。 是。 例如,默认情况下,Glassfish将使用Metro进行JAX-WS服务,因此需要配置类加载器以允许CXF库提供JAX-WS服务。 如果正确配置了类加载器,则不会出现问题。 也可以看看: ...
  • 我前段时间遇到了同样的问题,我看了一下Guicyfruit的代码并决定提取我需要的东西。 这导致了三个班级。 首先,我们需要一个注释,我们可以使用它来注释我们的Web服务端点。 GuiceManaged.java import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.R ...
  • 我终于发现了什么是错的...... 为了让我的Web服务在JUnit上下文中工作,即通过Endpoint.publish() ,我不得不从我的@WebService注释中删除wsdlLocation属性。 如果不这样做,传递给@WebService注释的wsdlLocation = "WEB-INF/wsdl/SearchIndividualsV1_0.wsdl"与传递给Endpoint.publish()方法的URL值冲突, http://127.0.0.1:9000/rpe-ws/SearchIndiv ...
  • 您使用的库(JAX-WS实现)已创建一个本地线程,其键的类型已由您的Web应用程序类加载器加载。 这意味着Web应用程序类加载器不能被垃圾收集,因为如果没有强引用其类的实例,则只能对类加载器进行垃圾回收。 在多次重新部署之后,您的JVM将耗尽perm gen空间。 一个真正的解决方案是监听Web应用程序的生命周期,并在关闭时删除本地线程。 但是,由于您不了解JAX-WS实现的内部结构,因此您很难做到这一点。 另一种解决方案是将jaxws-rt.jar(以及与JAX-WS相关的其他JAR文件)添加到Tomca ...
  • 您必须使用wsgen生成Web服务工件,然后将这些文件打包到WAR文件中并部署到Tomcat(或任何其他支持JAX-WS的J2EE容器,例如JBoss)。 您不需要使用Endpoint.publish 。 Tomcat将部署和发布Web服务。 请参阅http://docs.oracle.com/javaee/5/tutorial/doc/bnayn.html javax.xml.ws.Endpoint是一个帮助器类,用于在不使用支持JAX-WS的Web容器的情况下在J2SE环境中托管轻量级Web服务。 但这 ...
  • 虽然您可以安全地自动生成WSDL,但通常手动编写从WSDL引用的XSD是有意义的,这为您提供了从JAXB类生成的模式所不具备的所有表达式的丰富性,并且还确保了模式不会当你不想要的时候不要改变。 (这种做法称为契约优先 ,而从类开始称为代码优先。) 合同优先时,您可以在构建过程中自动从XSD生成JAXB类,确保它们始终保持同步。 您可以使用XJB文件自定义生成的类。 如果你正在使用Maven,生成类可能如下所示: org.jvnet.jaxb2.maven2
  • 显然这只发生在MyEclipse中,它有旧版本的Metro(1.1)。 即使我在AbstractVehicle类上指定,它也不会在客户端存根上生成@SeeAlso。 如果我使用JAX-WS Metro 2.1.5及更高版本使用ant任务构建,则无问题。 Apparently this only happens in MyEclipse where it has old version of Metro (1.1). It does not generate @SeeAlso at client stubs, ...
  • 默认情况下,您的服务是WRAPPED而不是BARE,因此消息中的顶级项必须是与操作同名的类型。 在'经典'JAX-WS中,这需要您添加包装类型。 如果您使用Apache CXF ,它将使用ASM自动生成这些包装器。 By default, your service is WRAPPED, not BARE, and so the top-level item in the message has to be a type with the same name as the operation. In 'cl ...
  • 根据我的经验,JAX-WS RI 2.2.5版是最后一个使用Java 5的版本。 From my experience, JAX-WS RI version 2.2.5 is last one working with Java 5.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。