Skip to main content

Trigger a full Java garbage collection

Project description

A command to trigger a full java garbage collection via the jcmd tool. On systems which use the systemd init system, you can specify the service name as the program argument. The -r option can also be used on systemd based systems to allow have this utility attempt to automatically restart the service if the jcmd garbage collection fails.

Requirements

  • Tested on python 2.7 and python 3

  • No 3rd party libraries required

Installation

Using pip is the preferred method to install this tool, and will install the package from pypi. pip install java-gc

It can also be installed via pip from a local copy of the source repo, pip install . from the repo directory should do the trick. Running make install should also work as well.

Usage

usage: java-gc [-h] [-u USER] [-t T] [-r]
[-l {debug,info,warning,error,critical}] [-v]
proc

Trigger a full GC on a java process

positional arguments:
proc The service name, or pid, to trigger the GC on

optional arguments:
-h, –help show this help message and exit
-u USER, –user USER User owning the process (default to current user)
-t T, –timeout T seconds to wait for GC before raising error
-r, –restart restart the service if timeout occurred, else exit
with error
-l {debug,info,warning,error,critical}, –loglevel {debug,info,warning,error,critical}
set log level
-v, –version print program version and exit

Contributing

The usual github model for forking the repo and creating a pull request is the preferred way to contribute to this tool. Bug fixes, enhancements, doc updates, translations are always welcomed.

Building from source

A Makefile has been included in the repository to handle the steps of creating the package and uploading it to pypi. If you don’t have the make utility installed, the contents of the Makefile should be instructive (and simple) enough to execute manually.

The following targets are available in the Makefile:

  • package - the default target, calls the setup.py script to create the package to upload to pypi.

  • upload - depends on the package target, and uploads the generated package archive to pypi.

  • install - use pip to install the package locally

  • clean - clean up the artifacts left by the package step.

  • distclean - depends on the clean target, and additionally cleans up misc. files.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

java_gc-0.0.4-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file java_gc-0.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for java_gc-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 77ddea2c8b2ddc623a831f147763007473c336c3aef09e4fa51ba8047abb238d
MD5 77e24b52ccf5d7b0e2ae850129b756bf
BLAKE2b-256 4327fa76680363b6980938346e3a2c57b5e2205f83b8495931d2b03e7eb00659

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page