我在我的程序上运行了一个堆转储.当我在内存分析器工具中打开它时,我发现java.lang.ref.Finalizerfor org.logicalcobwebs.proxool.ProxyStatement占用了大量内存.为什么会这样?

异常堆栈是
java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:327)
at java.nio.ByteBuffer.put(ByteBuffer.java:813)
mappedByteBuffer.put(bytes);
Run Code Online (Sandbox Code Playgroud)
代码:
randomAccessFile = new RandomAccessFile(file, "rw");
fileChannel = randomAccessFile.getChannel();
mappedByteBuffer = fileChannel.map(MapMode.READ_WRITE, 0, file.length());
Run Code Online (Sandbox Code Playgroud)
并打电话 mappedByteBuffer.put(bytes);
是什么原因 mappedByteBuffer.put(bytes)抛出BufferOverflowException
如何查找原因?
Map<String,Object> map = Maps.newHashMap();
map.put("test","123");
map.put("fuyou001","456");
map.put("id",145);
List<Map<String,Object>> list = Lists.newArrayList();
list.add(map);
Lists.transform(list, new Function<Map<String, Object>, Object>() {
@Override
public Object apply(@Nullable Map<String, Object> input) {
System.out.println("test:" + input);
return input;
}
});
System.out.println(list);`
Run Code Online (Sandbox Code Playgroud)
控制台不显示"test ...."
如何避免懒惰应用
我也试试
List<Map<String,Object>> newList = new ArrayList<Map<String, Object>>(list.size());
Collections.copy(newList,list);
Run Code Online (Sandbox Code Playgroud)
但没有效果
在阅读源代码时ArrayBlockingQueue,我发现了一条评论,说明它使用了" 任何教科书中的经典双条件算法 ":
/*
* Concurrency control uses the classic two-condition algorithm
* found in any textbook.
*/
/** Main lock guarding all access */
private final ReentrantLock lock;
/** Condition for waiting takes */
private final Condition notEmpty;
/** Condition for waiting puts */
private final Condition notFull;
Run Code Online (Sandbox Code Playgroud)
为什么它使用经典的双条件(notEmpty,notFull)算法?
在一个Web项目中。
我看到日志:
hadoop.hbase.zookeeper.ZKConfig - java.net.UnknownHostException: example.com
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:850)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201)
at java.net.InetAddress.getAllByName0(InetAddress.java:1154)
at java.net.InetAddress.getAllByName(InetAddress.java:1084)
at java.net.InetAddress.getAllByName(InetAddress.java:1020)
at java.net.InetAddress.getByName(InetAddress.java:970)
Run Code Online (Sandbox Code Playgroud)
但是当我ping example.com时,没关系,我也成功telnet example.com 2181!我发现了类似的问题,
所以我在服务器Java DomainResolutionTest example.com中
运行DomainResolutionTest,
但是没关系!
环境:
java -version
Run Code Online (Sandbox Code Playgroud)
Java版本“ 1.6.0_25”
Java™SE运行时环境(内部版本1.6.0_25-b06)
Java HotSpot(TM)64位服务器VM(内部版本20.0-b11,混合模式)
os:Red Hat Enterprise Linux Server release 5.7
我很好奇为什么是Inet6AddressImpl,我想可能是Inet4AddressImpl
怎么解决呢?
是什么原因?
我发生锁定等待超时超出错误。以下是例外:
org.springframework.dao.CannotAcquireLockException:
### Error updating database. Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
### The error may involve commManager.updateOrderHotelInfo-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
; SQL []; Lock wait timeout exceeded; try restarting transaction; nested exception is java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:261)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
at $Proxy21.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:246)
Run Code Online (Sandbox Code Playgroud)
春季交易配置
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" /> …