Skip to content

Instantly share code, notes, and snippets.

@nyg
nyg / FreeSwap.java
Created January 20, 2024 10:22
Display available free Swap memory using JMX
package edu.self.nyg.example.jmx.app;
import java.lang.management.ManagementFactory;
import java.text.NumberFormat;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectInstance;
import lombok.extern.slf4j.Slf4j;
@nyg
nyg / AllJCAServices.java
Last active April 2, 2024 11:09
List all JCA security provider services and export them to a CSV file.
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.security.Provider;
import java.security.Security;
import java.util.Arrays;
import java.util.Collection;