一般信号量范围是什么?(what is general semaphores range?)
一般信号量的范围是什么。 我知道它可以带有负值,0和1.负值表示阻塞队列中阻塞的进程数量。 0表示没有进程处于阻塞状态,1表示有一个资源可用,没有进程抢占它,我想知道是否有可能具有大于1的值(例如2),它是什么意思? 这是否意味着我们有单个信号量的多个资源?
What is the range of a general semaphore. I know that it can take negative values, 0 and 1. Negative values demonstrating the number of processes that are blocked in block queue. 0 means no process is in block and 1 means there is one resource available that no process have preempted it i want to know is it possible to have values greater than 1 for it.(2 for example) and what does it mean? Does it mean that we have more than one resource for a single semaphore?
原文:https://stackoverflow.com/questions/20656295
最满意答案
解决方案如下:(我们检查了cxf源,因为它包含很多拦截器,我们从那里得到了想法)
public class Interceptor extends AbstractPhaseInterceptor<Message> { private ObjectFactory objectFactory = new ObjectFactory(); public Interceptor() { super(Phase.PRE_LOGICAL); addBefore(HolderOutInterceptor.class.getName()); } @Override public void handleMessage(Message message) { MessageContentsList outObjects = MessageContentsList.getContentsList(message); Assert.isTrue(outObjects.size() == 1); Object outObject = outObjects.get(0); // object is our soap response } }
The solution is as here: (we checked cxf sources because it contains a lot of interceptors, we got the ideas from there)
public class Interceptor extends AbstractPhaseInterceptor<Message> { private ObjectFactory objectFactory = new ObjectFactory(); public Interceptor() { super(Phase.PRE_LOGICAL); addBefore(HolderOutInterceptor.class.getName()); } @Override public void handleMessage(Message message) { MessageContentsList outObjects = MessageContentsList.getContentsList(message); Assert.isTrue(outObjects.size() == 1); Object outObject = outObjects.get(0); // object is our soap response } }
相关问答
更多-
您需要在/META-INF/cxf/目录下创建一个名为org.apache.cxf.Logger的文件(即带有Logger扩展名的org.apache.cxf文件),其文件内容如下: org.apache.cxf.common.logging.Log4jLogger 参考: 使用Log4j代替java.util.logging并配置CXF日志记录以便通过Log4J 。 另外如果您更换标准:最后找出错误。 这是因为我的测试客户端由于QName不匹配而无法正确解开响应。 我一直在遵循代码第一的方法,所以必须手动创建一个像这样的“package-info.java”并提及我的Qname。 @javax.xml.bind.annotation.XmlSchema(namespace = "www.example.com/common/exceptions", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) pac ...
SOAP out拦截器CXF(SOAP out interceptor CXF)[2021-09-22]
您可以检查消息中的SOAPAction标头(下面显示的大多数示例来自http://cxf.apache.org/docs/interceptors.html : if (message.getVersion() instanceof Soap11) { Map> headers = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS)); if (heade ... 尽管代码看起来很好,但我相信即使您没有使用MTOM的完整功能,也需要使用MTOM。解决方案如下:(我们检查了cxf源,因为它包含很多拦截器,我们从那里得到了想法) public class Interceptor extends AbstractPhaseInterceptor{ private ObjectFactory objectFactory = new ObjectFactory(); public Interceptor() { super(Phase.PRE_LOGICAL); addBefore(Hol ... 所以在我的自定义拦截器中,我写了下面的代码: Fault fault = new Fault(message.getContent(Exception.class)); 现在这是一些遗留代码,它抛出了Java的异常,并让框架将其转换为错误。 我不会在这方面感受到我的感受,但是这会让你产生错误。 现在,如果您从服务方法中抛出过错,那么请执行 Fault fault = message.getContect(Fault.class); 希望这会帮助你得到你想要的答案。 确保你像下面那样注册拦截器原来要走的路是: 启用mtom并注入拦截器:etc... 发现当您在不引用CXF Lib jar文件的情况下运行生成的客户端类时会发生这种情况。 将它们添加到类路径中后,将生成消息正文。 It was found that this happens when you run the generated client class without referencing the CXF Lib jar files. After adding them into the classpath, the body of the message is then generat ...我不确定您在寻找什么,但我以不同方式处理了CXF端点的例外情况。 我不得不在SOAPFault中返回带有自定义详细信息的HTTP-500(如验证错误消息等),所以...... 保持异常.onException(classOf[PredicateValidationException]).handled(false) Camel处理以将其传递给CXF .onException(classOf[PredicateValidationException]).handled(false) 创建org.apache. ...我试图从SoapUI中删除命名空间pru ,我有同样的错误,所以这是我的错误,我必须添加名称空间。 Pru引用了我的wsdl的命名空间tns 。 我读了node-soap的github问题,一个引用了命名空间tns 。 https://github.com/vpulim/node-soap/issues/537 我更改了这些wsdl.js文件行: this.ignoredNamespaces= [ 'tns', 'targetNamespace', 'typedNamespace'] WSDL.protot ...相关文章
更多- general comments rather than in favor
- 使用mybatis执行sql的时候为什么会出现Parameter index out of range (1 > number of parameters, which is 0)?
- Guava学习笔记:Range
- Guava Range类-范围处理
- 这些是什么
- 我的微信号
- java是什么
- Hive是什么?
- shell是什么
- JSON是什么?
最新问答
更多- 获取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的基本操作命令。。。