Experimental: Support Gradle --parallel
This should be treated as experimental but with these changes it seems to build ok. BUILD SUCCESSFUL Total time: 5 mins 15.533 secs It turns out that our sporadic Redis problems were fixed in a later version of Jedis. The problem was that the `connection.subscribe()` exited immediately. When I started adding debug logic, the problem went away (because I was using a newer versio of Jedis). spring-data-redis 1.5.2 is updated to work with the 2.7.3 version of Jedis. Polishing
This commit is contained in:
committed by
Artem Bilan
parent
b57018b78b
commit
75a7b63350
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.integration.test.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
|
||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
|
||||
/**
|
||||
* Use to take a heap dump programmatically. Useful to examine the heap when debugging
|
||||
* sporadic test failures.
|
||||
* <p>
|
||||
* Usage: {@code HeapDumper.dumpHeap("/tmp/foo.hprof");}
|
||||
* <p>
|
||||
* If the file exists already, it will be replaced.
|
||||
* <p>
|
||||
* Courtesy:
|
||||
* https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java
|
||||
* <pre>
|
||||
* See https://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/HotSpotDiagnosticMXBean.html#dumpHeap-java.lang.String-boolean-
|
||||
* </pre>
|
||||
* @author Gary Russell
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
public class HeapDumper {
|
||||
|
||||
// This is the name of the HotSpot Diagnostic MBean
|
||||
private static final String HOTSPOT_BEAN_NAME = "com.sun.management:type=HotSpotDiagnostic";
|
||||
|
||||
// field to store the hotspot diagnostic MBean
|
||||
private static volatile HotSpotDiagnosticMXBean hotspotMBean;
|
||||
|
||||
public static void dumpHeap(String fileName) {
|
||||
dumpHeap(fileName, true);
|
||||
}
|
||||
|
||||
public static void dumpHeap(String fileName, boolean live) {
|
||||
File file = new File(fileName);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
// initialize hotspot diagnostic MBean
|
||||
initHotspotMBean();
|
||||
try {
|
||||
hotspotMBean.dumpHeap(fileName, live);
|
||||
}
|
||||
catch (RuntimeException re) {
|
||||
throw re;
|
||||
}
|
||||
catch (Exception exp) {
|
||||
throw new RuntimeException(exp);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize the hotspot diagnostic MBean field
|
||||
private static void initHotspotMBean() {
|
||||
if (hotspotMBean == null) {
|
||||
synchronized (Object.class) {
|
||||
if (hotspotMBean == null) {
|
||||
hotspotMBean = getHotspotMBean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get the hotspot diagnostic MBean from the
|
||||
// platform MBean server
|
||||
private static HotSpotDiagnosticMXBean getHotspotMBean() {
|
||||
try {
|
||||
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
|
||||
HotSpotDiagnosticMXBean bean = ManagementFactory.newPlatformMXBeanProxy(server, HOTSPOT_BEAN_NAME,
|
||||
HotSpotDiagnosticMXBean.class);
|
||||
return bean;
|
||||
}
|
||||
catch (RuntimeException re) {
|
||||
throw re;
|
||||
}
|
||||
catch (Exception exp) {
|
||||
throw new RuntimeException(exp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user