Aujourd'hui j'ai du debug un bout d'app Java bien ancienne. Toujours du pur bonheur, ça me rappelle le Master :)
Bon, c'est bien comme je pensais, ça ne sert plus à grand chose en 2016.
JBoss provides a simple command line tool that allows for interaction with a remote JMX server instance. This tool is called twiddle (for twiddling bits via JMX) and is located in the bin directory of the distribution. Twiddle is a command execution tool, not a general command shell.
framework java utilisé pour le projet en RIE
[Summary, full note in Shaarli]
Comment créer un script d'init (/etc/init.d) pour une application Java (java -jar).
Structure du script (sh) :
- check_status : trouve le PID de l'appli ; renvoie 0 si elle ne tourne pas.
- start : si déjà lancée, "already started" et exit 1 ; sinon
java -jar /path/to/application.jar >> /path/to/logfile 2>&1 &
- stop : si arrêtée, "already stopped" et exit 1 ; sinon kill -9 $pid
- status : "Application is started" / "stopped".
- case "$1" in start|stop|status|restart|reload (= stop puis start), sinon usage : $0 {start|stop|restart|reload|status}.
EDIT : la recherche de PID de l'article ne marchait pas pour moi :
s=ps -C 'java -jar /path/to/application.jar' -o pid h
remplacée par :
s=$(pgrep --full 'une string unique qui identifie la command line pour lancer mon jar')
Attention : check_status fait "return $s", donc un PID passe par le code retour (limité à 0-255) ; à corriger si on réutilise le script.
Tool pour monitorer des values exposées en jmx
$>beans
$>bean java.lang:name=G1\ Eden\ Space,type=MemoryPool
$> info
$> get XXX
echo "beans" | java -jar jmxterm-1.0-alpha-4-uber.jar --url localhost:9010 -n|grep -i garbage
echo "get -b java.lang:type=Memory HeapMemoryUsage" | java -jar jmxterm-1.0-alpha-4-uber.jar --url localhost:9010 -n
echo "get -b java.lang:name=G1\ Eden\ Space,type=MemoryPool CollectionUsage" | java -jar jmxterm-1.0-alpha-4-uber.jar --url localhost:9010 -n
or use input file
pid=$(ps...)
java -jar jmxterm-1.0-alpha-4-uber.jar -n <<EOF
open $pid
beans
EOF
ArrayList reslist = new ArrayList();
reslist.add....
return reslist.toArray(new DeviceId[reslist.size()]);
Comment empecher le browser de mettre en cache le contenu d'une response.
How to run a jar the daemon way under linux
Comment créer un timestamp de l'heure actuelle en Java
type "netstat -a -n -o" to find out which PID is using this port. Then find the PID in the TaskManager... Then kill the process :)
Presentation des buffer en java du package nio
Bon cours simple sur socket, voir partie UDP
Java : Comment itérer sur une hashmap
Map items = new HashMap();
//fill map with String, String values
…
for (Map.Entry entry : items.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
//do stuff here
}
cours de java de l'upmf avec des schémas qui ont l'air bien clair