小编Rai*_*ndo的帖子

Apache Camel在负载下路由性能下降

我正在使用Apache Camel根据请求消息中的某个属性路由SOAP请求.该消息被针对正则表达式匹配,并且如果找到匹配所述请求将被路由到"calldestination1",如果没有,它将被路由到"calldestination2".

我正在使用以下配置:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:cxf="http://camel.apache.org/schema/cxf"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">

<!-- ... -->

<cxf:cxfEndpoint id="testEndpointTest"
    address="http://localhost:8080/testEndpoint"
    endpointName="s:testEndpoint_Port"
    serviceName="s:testEndpoint"
    wsdlURL="wsdl/testEndpoint.wsdl"
    xmlns:s="http://teste.com/testEndpoint"/>

<!-- ... -->

<camelContext xmlns="http://camel.apache.org/schema/spring">

    <endpoint id="calldestination1" uri="http://localhost:8080/destination1?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>
    <endpoint id="calldestination2" uri="http://localhost:8080/destination2?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>

    <route streamCache="true">
        <!--CXF consumer using MESSAGE format--> 
        <from uri="cxf:bean:testEndpointTest?dataFormat=MESSAGE"/>

        <choice>
            <when>
                <simple>${bodyAs(java.lang.String)} regex ${properties:router.regex}</simple>
                <to uri="calldestination1"/>
            </when>
            <otherwise>
                <to uri="calldestination2"/>
            </otherwise>
        </choice>

    </route>

</camelContext>
Run Code Online (Sandbox Code Playgroud)

当运行"calldestination2"的目标服务器处于加载状态时,请求可能需要大约1150ms才能响应.Apache Camel似乎没有很好地处理这个问题.

为了复制这种行为,我使用带有延迟(OnRequest Script)和jmeter的SOAP MockService的SoapUI.拳头我没有延迟地对SoapUI MockService进行测试,然后延迟1100ms.
然后我配置Apache Camel将请求路由到SoapUI服务并重复测试.

JMeter - > SoapUI - 0ms延迟
〜每秒1200个请求; 25ms请求平均值; 0%错误 …

soap cxf apache-camel

8
推荐指数
1
解决办法
438
查看次数

Android Spinner没有使用Android 5.0的三星设备

我正在使用自定义Spinner小部件,其代码如下.除了三星的Android 5.0设备外,大多数设备都能正常运行.单击时,Spinner应显示值列表但不会发生.

在使用Android 5.0的模拟器和其他品牌设备上,它可以正常工作.

有没有人面对类似的事情或对可能发生的事情有任何想法?

XML

<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)

<Spinner
    android:id="@+id/_combo_spinner"
    android:layout_width="0px"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:focusable="false"
    android:background="@null"
    android:clickable="false"
    android:paddingBottom="@dimen/cell_text_section_text_padding_bottom"
    android:paddingLeft="@dimen/cell_text_section_text_padding_left"
    android:paddingRight="@dimen/cell_text_section_text_padding_right"
    android:paddingTop="@dimen/cell_text_section_text_padding_top"
    android:spinnerMode="dropdown" />

<View
    android:layout_width="@dimen/drawable_stroke_width"
    android:layout_height="match_parent"
    android:layout_marginBottom="5dp"
    android:layout_marginTop="3dp"
    android:background="@color/stroke_dark_grey"
    android:paddingBottom="@dimen/cell_text_section_text_padding_bottom"
    android:paddingTop="@dimen/cell_text_section_text_padding_top" />

<ImageView
    style="@style/image__default"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_gravity="center"
    android:layout_marginLeft="@dimen/cell_text_section_text_padding_left"
    android:layout_marginRight="@dimen/cell_text_section_text_padding_right"
    android:src="@drawable/ic_action_expand" />
Run Code Online (Sandbox Code Playgroud)

Java的

public class ComboBoxView extends LinearLayout {

private Spinner mSpinner;
private OnItemSelectedListener mListener;

public ComboBoxView(Context context) {
    super(context);
    initializeLayout(context);
}

public ComboBoxView(Context context, AttributeSet attrs) {
    super(context, attrs);
    initializeLayout(context);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public ComboBoxView(Context context, AttributeSet attrs, int defStyleAttr) { …
Run Code Online (Sandbox Code Playgroud)

java android spinner android-5.0-lollipop

6
推荐指数
1
解决办法
1669
查看次数

Java - 一次创建多个子文件夹

我正在尝试创建一个函数,使用 Java 在一条指令中创建多个文件夹/子文件夹。\n我可以使用 的File方法mkdirs()来创建单个文件夹及其父文件夹。

\n\n

我想要的结构示例:

\n\n
folder\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 subfolder\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 subsubfolder1\n    \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 subsubfolder2\n    \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 subsubfolder3\n
Run Code Online (Sandbox Code Playgroud)\n\n

例如,在 Linux 中,我可以使用以下命令来实现此目的:

\n\n
mkdir -p folder/subfolder/{subsubfolder1,subsubfolder2,subsubfolder3}\n
Run Code Online (Sandbox Code Playgroud)\n\n

有没有一种方法可以在 Java 中实现这一目标?

\n

java directory subdirectory

5
推荐指数
1
解决办法
7296
查看次数