BOOKJAVA Telegram 4033
Deprecated Event

В статье рассматривается новое событие в JDK 22 для JFR, позволяющее отслеживать вызовы устаревших методов. Это полезно для определения зависимостей в сторонних библиотеках, которые используют методы, планируемые к удалению, такие как методы Security Manager. Такое отслеживание позволяет заранее обновить библиотеки, что может сократить технический долг и упростить переход на актуальные версии библиотек и инструментов.


public class API {
public static void enableLogging(boolean enable) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
System.setProperty("log", String.valueOf(enable));
return null;
}
});
}
public static void runTask(Runnable task) {
try {
task.run();
} catch (ThreadDeath td) {
System.out.println("Task stopped.");
}
}
}

public class Service {
public static void log(String message) {
String shouldLog = System.getProperty("log", "true");
if (new Boolean("log")) {
System.out.print(message);
}
}
}


https://egahlin.github.io/2024/05/31/deprecated-event.html

Мы в MAX

👉@BookJava
👍3👎2



tgoop.com/BookJava/4033
Create:
Last Update:

Deprecated Event

В статье рассматривается новое событие в JDK 22 для JFR, позволяющее отслеживать вызовы устаревших методов. Это полезно для определения зависимостей в сторонних библиотеках, которые используют методы, планируемые к удалению, такие как методы Security Manager. Такое отслеживание позволяет заранее обновить библиотеки, что может сократить технический долг и упростить переход на актуальные версии библиотек и инструментов.


public class API {
public static void enableLogging(boolean enable) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
System.setProperty("log", String.valueOf(enable));
return null;
}
});
}
public static void runTask(Runnable task) {
try {
task.run();
} catch (ThreadDeath td) {
System.out.println("Task stopped.");
}
}
}

public class Service {
public static void log(String message) {
String shouldLog = System.getProperty("log", "true");
if (new Boolean("log")) {
System.out.print(message);
}
}
}


https://egahlin.github.io/2024/05/31/deprecated-event.html

Мы в MAX

👉@BookJava

BY Библиотека Java разработчика




Share with your friend now:
tgoop.com/BookJava/4033

View MORE
Open in Telegram


Telegram News

Date: |

Telegram desktop app: In the upper left corner, click the Menu icon (the one with three lines). Select “New Channel” from the drop-down menu. The creator of the channel becomes its administrator by default. If you need help managing your channel, you can add more administrators from your subscriber base. You can provide each admin with limited or full rights to manage the channel. For example, you can allow an administrator to publish and edit content while withholding the right to add new subscribers. Clear Avoid compound hashtags that consist of several words. If you have a hashtag like #marketingnewsinusa, split it into smaller hashtags: “#marketing, #news, #usa. With the sharp downturn in the crypto market, yelling has become a coping mechanism for many crypto traders. This screaming therapy became popular after the surge of Goblintown Ethereum NFTs at the end of May or early June. Here, holders made incoherent groaning sounds in late-night Twitter spaces. They also role-played as urine-loving Goblin creatures.
from us


Telegram Библиотека Java разработчика
FROM American