Posts

Showing posts from December, 2020

Java 8 Concepts with Examples

Java 8 new features  1. Lambda Expressions A lambda expression is an anonymous function. A function that doesn’t have a name and doesn’t belong to any class.   so compiler does not create .class file. Used to provide the implementation of an interface which has functional interface      //Syntax of lambda expression ( parameter_list ) -> { function_body }      Example: Creating Thread with Lambda  package com.vasanth.java8; public class ThreadWithLambda { public static void main (String args[]){ //Traditional approach Runnable r1= new Runnable() { @Override public void run() { System. out .println( "Thread 1 started" ); } }; Thread t1= new Thread(r1); t1.start();                                        //With Lambda Runnable r2=()->{ System. out .println( "Thread 2 started" ); }; Thread t2= new Thread(r2); t2.start();

Thread Dump / Heap Dump

  Thread Dump Command:  kill -QUIT <java pid>  - Use   http://fastthread.io/  to analyze the output Heap Dump Command : jmap -dump:format=b,file=<file-path> <pid>  Eg: /opt/perfMon/java/bin ./jmap -dump:live,format=b,file=/opt/xxx/heapdump.hrof 10759  - Use the " Eclipse Memory Analyzer " (MAT) to load the heap dump and analyze further

PCAP / TCP DUMP

  tcpdump  -s0  -w <FileName> host <IPAddress> Eg: tcpdump  -s0  -w Test.pcap host 10.141.128.33

SNMP GET / Walk - CLI commands

  SNMP GET / Walk - CLI commands: v2:  snmpwalk -v2c -c <community> <ipaddress>[:<dest_port>] [oid] snmpget -v2c -c <community> <ipaddress>[:<dest_port>] [oid] V3: snmpwalk -v3 -l authPriv -u snmp-poller -a SHA -A "PASSWORD1" -x AES -X "PASSWORD1" 10.10.60.50 snmpget -v3 -l authPriv -u snmp-poller -a SHA -A "PASSWORD1" -x AES -X "PASSWORD1" 10.10.60.50 sysName.0