我正在创建一个测试工具来强调加载服务器.我创建了许多不同的线程,向服务器发送单独的请求.它似乎受ChannelFactory的限制.它是进行实际服务调用的瓶颈,例如:
_proxy.MyServiceCall(...);
Run Code Online (Sandbox Code Playgroud)
我尝试了几种不同的方法:
所有这些都导致了非常相似的性能.通道工厂似乎正在使用全局静态可用连接池.我试过这个但是找不到任何东西.你对此有更多了解吗?你认为我猜有一个静态的连接池是正确的吗?如果是这样,你知道如何配置?
这是测试应用程序的当前配置:
<configuration>
<system.serviceModel>
<client>
<endpoint binding="wsHttpBinding" bindingConfiguration="SynchronizationServiceBinding" contract="My.Namespace.ISynchronizationService" name="ClientBinding">
</endpoint>
</client>
<bindings>
<wsHttpBinding>
<binding name="SynchronizationServiceBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="10485760">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
<readerQuotas maxArrayLength="1000000"/>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> </configuration>
Run Code Online (Sandbox Code Playgroud) 我正在尝试在安全模式下使用更新版本的 Xalan (2.7.2) 并且遇到无法理解未知属性的问题。问题是,它阻止您使用任何发出 XHTML(在安全处理模式下)的样式表,因为它不允许“th”元素的“colspan”属性之类的东西。
相关的更改文件在这里:http : //svn.apache.org/viewvc/xalan/java/branches/xalan-j_2_7_1_maint/src/org/apache/xalan/processor/XSLTElementProcessor.java?r1=1359736&r2=1581058&pathrev=15810format =h
请参阅以下示例:
import javax.xml.XMLConstants;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamSource;
import java.io.StringReader;
public class XalanSecureAttributeRepro {
private static final String XSL =
"<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" +
" <xsl:output method=\"html\"/>\n" +
" <xsl:template match=\"/*\">\n" +
" <th colspan=\"2\"/>\n" +
" </xsl:template>\n" +
"</xsl:stylesheet>";
public static void main( String[] args ) throws Exception {
System.setProperty( "javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl" );
TransformerFactory tf = TransformerFactory.newInstance();
tf.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true);
tf.setErrorListener( new DefaultErrorHandler( true ) );
final Source source = …Run Code Online (Sandbox Code Playgroud) 我注意到,最新版本的Java(1.7.0_u51)序列化和散列图的反序列化不再保留hashmap中元素的顺序.见下面的例子:
@Test
public void test() throws IOException, ClassNotFoundException {
HashMap<String, String> map1 = new HashMap<>();
map1.put("a1234567", "aaa");
map1.put("b1234567", "bbb");
System.out.println("Map1: " + map1.toString());
byte[] serializedMap1 = objectToBytes(map1);
System.out.println("Map1 Serialized: " + Arrays.toString(serializedMap1));
Object map2 = bytesToObject(serializedMap1);
System.out.println("Map2: " + map2.toString());
byte[] serializedMap2 = objectToBytes((Serializable) map2);
System.out.println("Map2 Serialized: " + Arrays.toString(serializedMap2));
Object map3 = bytesToObject(serializedMap2);
System.out.println("Map3: " + map3.toString());
byte[] serializedMap3 = objectToBytes((Serializable) map3);
System.out.println("Map3 Serialized: " + Arrays.toString(serializedMap3));
Object map4 = bytesToObject(serializedMap3);
System.out.println("Map4: " + map4.toString());
byte[] serializedMap4 = objectToBytes((Serializable) …Run Code Online (Sandbox Code Playgroud)