Skip to content

solven-eu/pepper

Repository files navigation

pepper

Various Java utilities

Build Status Coverage Status Maven Central Quality Gate Technical debt ratio javadoc.io Issues Forks Stars MIT License

Maven

Add pepper as dependency to your project through:

    <dependency>
         <groupId>io.github.solven-eu.pepper</groupId>
         <artifactId>pepper</artifactId>
         <version>${pepper.version}</version>
    </dependency>

pepper-java

Various utilities helping operating in Java on a daily basis.

Standard helpers

GCInspector is drop-in class providing standard logs related to GC activity

@Bean
	public IPepperThreadDumper pepperThreadDumper() {
		return new PepperThreadDump(ManagementFactory.getThreadMXBean());
	}

	@Bean
	public GCInspector gcInspector(IpepperThreadDumper pepperThreadDumper) {
		return new GCInspector(pepperThreadDumper);
	}

PepperLogHelper helps publishing relevant logs regarding memory and timings

Assert.assertEquals("0.09%", pepperLogHelper.getNicePercentage(123, 123456).toString());


Assert.assertEquals("9sec 600ms", pepperLogHelper.getNiceTime(9600).toString());
Assert.assertEquals("2min 11sec", pepperLogHelper.getNiceTime(131, TimeUnit.SECONDS).toString());


Assert.assertEquals("789B", pepperLogHelper.getNiceMemory(789L).toString());
Assert.assertEquals("607KB", pepperLogHelper.getNiceMemory(789L * 789).toString());
Assert.assertEquals("468MB", pepperLogHelper.getNiceMemory(789L * 789 * 789).toString());
Assert.assertEquals("360GB", pepperLogHelper.getNiceMemory(789L * 789 * 789 * 789).toString());
Assert.assertEquals("278TB", pepperLogHelper.getNiceMemory(789L * 789 * 789 * 789 * 789).toString());
Assert.assertEquals("214PB", pepperLogHelper.getNiceMemory(789L * 789 * 789 * 789 * 789 * 789).toString());

Fancy helpers

ObjectInputHandlingInputStream enables transmitting a raw InputStream through an ObjectInput

CartesianProductHelper helps computing covering cartesian products over sets defined by Collections and Maps.

PepperProcessHelper enables tracking the memory consumption of a process (would it be current JVM, a forked Process or any other process).

PepperProcessHelper.getProcessResidentMemory(processPID)

It were useful to investigate memory issues in Heroku.

MapPath

This module inspires itself from xpath and jsonPath to manipulate standard java.util.Map.

See map-path

<dependency>
	<groupId>io.github.solven-eu.pepper</groupId>
	<artifactId>map-path</artifactId>
	<version>4.4</version>
</dependency>

Upgrade from 2.X to 3.X

Change groupId from <groupId>com.github.cormoran-io.pepper</groupId> to <groupId>io.github.solven-eu.pepper</groupId> Change imported package from import cormoran.pepper.X to import eu.solven.pepper.X

Deprecated

MAT

We use to maintain a fork of MAT, dedicated to huge Heap-Analysis. This is still available in 4.x MAT

Spark

We use to maintain a set of projects demonstrating how to prepare a Spark-based job, as a SpringBoot application, workarounding various issues like excluding some libraries already provided by the Hadoop ecosystem. This is still available in 4.x Spark