首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >PostgreSQL 或 SQL Server (SQL Server 2012+)

PostgreSQL 或 SQL Server (SQL Server 2012+)

原创
作者头像
用户7737280
发布2024-08-20 10:21:19
发布2024-08-20 10:21:19
1.1K00
代码可运行
举报
运行总次数:0
代码可运行
代码语言:javascript
代码运行次数:0
运行
复制
java -server
-XX:MaxDirectMemorySize=2g # 直接内存的大小为 2GB
-Xms3g -Xmx3g # Java 堆内存的大小为 3GB
-XX:NewSize=1g # 新生代的大小为 1GB
-XX:MetaspaceSize=128m # 元空间为 128MB
-XX:+UseParNewGC -XX:+UseConcMarkSweepGC # 新生代使用 ParNewGC,老年代使用 CMS
-xx:+HeapDumponCutOfMemoryError # 在发生 OOM 时打印日志
-XX:HeapDumpPath=dump.log # OOM 日志存储地址
-XX:+PrintGC # 输出 GC 日志
-XX:+PrintGCDetails # 输出 GC 的详细日志
-XX:+PrintGCDatestamps # 输出 GC 的时间戳
-XX:+PrintHeapAtGC # JVM 在执行 GC 操作的前后打印堆的信息
-Xlogge:../gc/gc.log # GC日志的输出地址
-jar start.jar

class Myresources1 implements AutoCloseable {

@Override

public void close() throws Exception {

System.out.println("资源1关闭方法执行");

throw new Exception("资源1关闭异常");

}

}

class laipuhuo.com\ Myresources2 implements AutoCloseable {

@Override

public void close() throws Exception {

System.out.println("资源2关闭方法执行");

throw new Exception(laipuhuo.com "资源2关闭异常");

}

}

Myresources1 myresources1 =null;

Myresources2 myresources2 = null;

try{

myresources1 = new Myresources1();

myresources2 = new Myresources2();

System.out.println("hello");

}catch (Exception e){

e.printStackTrace();

}finally {

if (myresources1!=null){

try {

myresources1.close();

}catch (Exception e){

e.printStackTrace();

}finally {

if (myresources2!=null){

try {laipuhuo.com

myresources2.close();

}catch (Exception e){

e.printStackTrace();

}

}

}

}

}

Myresources1 myresources1 = null;

try{

myresources1 = new Myresources1();

//算数异常laipuhuo.com

System.out.println(10/0);

}finally {

if (myresources1!=null)

myresources1.close();

}

//myresources1类

class Myresources1 implements AutoCloseable {

@Override

public void close(laipuhuo.com) throws Exception {

System.out.println("资源1关闭方法执行");

throw new Exception("资源1关闭异常");

}

} try(FileWriter fw = new FileWriter("a.txt")){

fw = new FileWriter("b.txt"); //报错

}catch (Exception e){

e.printStackTrace(laipuhuo.com

);

}

//此时会编译出错:The resource is1 of a try-with-resources statement cannot be assigned

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档