我和我这个时代的另一位开发人员最近从一台Core 2 Duo机器搬到了新的Core 2 Quad 9505; 两者都使用JDK 1.6.0_18运行Windows XP SP3 32位.
在这样做的时候,我们对一些时序/统计/度量聚合代码的自动单元测试很快就会失败,因为看起来似乎是从System.nanoTime()返回的荒谬值.
在我的机器上可靠地显示此行为的测试代码是:
import static org.junit.Assert.assertThat;
import org.hamcrest.Matchers;
import org.junit.Test;
public class NanoTest {
@Test
public void testNanoTime() throws InterruptedException {
final long sleepMillis = 5000;
long nanosBefore = System.nanoTime();
long millisBefore = System.currentTimeMillis();
Thread.sleep(sleepMillis);
long nanosTaken = System.nanoTime() - nanosBefore;
long millisTaken = System.currentTimeMillis() - millisBefore;
System.out.println("nanosTaken="+nanosTaken);
System.out.println("millisTaken="+millisTaken);
// Check it slept within 10% of requested time
assertThat((double)millisTaken, Matchers.closeTo(sleepMillis, sleepMillis * 0.1));
assertThat((double)nanosTaken, Matchers.closeTo(sleepMillis * 1000000, sleepMillis * 1000000 …Run Code Online (Sandbox Code Playgroud) 在我的项目中,有许多依赖项可传递地包含在其他依赖项中,这些依赖项没有任何公司存储库中提供的pom.xml文件.这些是由各个团队支持的内部jar专用库,为了方便起见,这些库已经上传到存储库中,但不幸的是,这些存储库不是我可以使用的.
对于这些依赖项,Maven坚持每次运行构建时都尝试从每个存储库列表中检索poms,或者mvn dependency:list.这意味着maven尝试从7个不同的存储库位置检索8x pom文件,并且这是通过全球企业WAN进行的; 它真的很慢.
例如,对于一个特定的依赖
C:\Working\dev\workspace\project>mvn dependency:list
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building project
[INFO] task-segment: [dependency:list]
[INFO] ------------------------------------------------------------------------
[WARNING] Unable to get resource 'aGroupId:anArtifactId:pom:4.0.14i' from repository inhouse (http://someRepo1/proximity/repository/inhouse): While configuring wagon for 'inhouse': Unable to apply wagon configuration.
Downloading: http://someRepo1/proximity/repository/extFree/aGroupId/anArtifactId/4.0.14i/anArtifactId-4.0.14i.pom
[INFO] Unable to find resource 'aGroupId:anArtifactId:pom:4.0.14i' in repository extFree (http://someRepo1/proximity/repository/extFree)
Downloading: http://someRepo1/proximity/repository/externalNonFree/aGroupId/anArtifactId/4.0.14i/anArtifactId-4.0.14i.pom
[INFO] Unable to find resource 'aGroupId:anArtifactId:pom:4.0.14i' in repository extNonFree (http://someRepo1/proximity/repository/externalNonFree)
Downloading: http://someRepo2/efs/dist/maven/maven2-repository/incr/common/lib/aGroupId/anArtifactId/4.0.14i/anArtifactId-4.0.14i.pom
[INFO] Unable …Run Code Online (Sandbox Code Playgroud) 我们有一个JAX-WS/JAXB绑定到外部Web服务,该服务在Java 7(1.7.0u80)上运行良好,包含了参考实现.在迁移到Java 8(1.8.0u66)期间,Web服务调用通常可以正常工作,但是它不能再将SOAP错误及其详细信息元素解析为具有自定义详细信息的Java异常,而是提供未绑定到命名空间错误的前缀.
失败的是
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:138)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy61.proprietaryServiceCall(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.doInvoke(JaxWsPortClientInterceptor.java:580)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.doInvoke(JaxWsPortClientInterceptor.java:554)
... 56 more
Caused by: java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace
at com.sun.xml.internal.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:355)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.selectLoader(LeafPropertyXsiLoader.java:75)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.startElement(LeafPropertyXsiLoader.java:58)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:559)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153)
at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:229)
at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266) …Run Code Online (Sandbox Code Playgroud) 我最近阅读了很多关于JMS,Spring(和TIBCO EMS)关于连接,会话,消费者和生产者的最佳实践
在春天的世界里工作时,似乎流行的智慧
AbstractMessageListenerContainer与多个消费者/线程.CachingConnectionFactory下面的a JmsTemplate来维护与代理的单个连接,然后缓存会话和生成器.对于生成/发布,这是我的(大型)服务器应用程序现在正在做的事情,之前它正在为它发布的每条消息创建一个新的连接/会话/生成器(坏!),因为使用了原始连接工厂JmsTemplate.旧的行为有时会导致在高峰时段在短时间内在代理上创建和关闭1,000个连接,甚至导致套接字/文件句柄限制.
但是,当切换到此模型时,我无法理解使用与代理的单个TCP连接的性能限制/注意事项.我知道JMS提供程序应该确保它可以以多线程方式使用 - 但从实际角度来看
假设我有点走上正轨
非常感谢任何想法或指向更多阅读主题或经验,即使与其他经纪人.
artifacts ×1
cxf ×1
dependencies ×1
java ×1
java-8 ×1
jax-ws ×1
jaxb ×1
jms ×1
maven-2 ×1
nanotime ×1
repository ×1
spring ×1
spring-jms ×1
tibco-ems ×1
timestamp ×1
web-services ×1