我们使用weblogic jar(j2ssh是用于连接安全外壳的外部jar )在我们的webapp.The We应用中运行在weblogic服务器上。
我像这样打开连接
SshClient ssh = new SshClient();
SessionChannelClient session=null;
session = ssh.openSessionChannel();在finally块中,我像这样关闭会话。
finally
{
System.out.println("disconnecting from ssh");
try
{
session.close();
}
catch(IOException ioe)
{
theOutput = ioe.getMessage();
System.out.println("IOException="+ioe);
}
}我的疑问是我是否正确地关闭了连接?它会清除Weblogic堆栈吗,因为我们经常收到用户因为内存溢出而得到异常的抱怨,这基本上意味着垃圾收集没有发生,我们重新启动服务器,它会自动solved.Is,有一种方法可以定期清除weblogic内存,以避免内存溢出异常?
发布于 2011-10-04 13:56:37
您应该在关闭会话后尝试释放会话和ssh对象。
在catch块之后类似这样的代码,
finally {
session = null;
ssh = null;
}https://stackoverflow.com/questions/7643533
复制相似问题