12 September 2019

Eclipse MAT Classloaders


Network Troubleshooting

Summary of networking tools for troubleshooting.

  1. https://developer.ibm.com/articles/au-aixnetworkproblem1/
  2. https://www.tecmint.com/linux-network-configuration-and-troubleshooting-commands/


responsive ping

$ ping testhost
PING testhost: (10.217.1.206): 56 data bytes
64 bytes from 10.217.1.206: icmp_seq=0 ttl=253 time=0 ms
64 bytes from 10.217.1.206: icmp_seq=1 ttl=253 time=0 ms
64 bytes from 10.217.1.206: icmp_seq=2 ttl=253 time=0 ms


ping unresponsive:

$ ping testhost
PING testhost.testdomain.com: (10.216.122.12): 56 data bytes

‑‑‑‑testhost.testdomain.com PING Statistics‑‑‑‑
5 packets transmitted, 0 packets received, 100% packet loss


Displaying network adapter status

$ ifconfig en1
en1: flags=7e080863,40    CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
        inet 10.216.163.37 netmask 0xffffff00 broadcast 10.216.163.255
         tcp_sendspace 131072 tcp_recvspace 65536

$ifconfig ‑a
en2: flags=7e080863,40
      CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
        inet 10.203.35.14 netmask 0xffffff80 broadcast 10.203.35.127
en1: flags=7e080863,40
    CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
        inet 10.216.163.37 netmask 0xffffff00 broadcast 10.216.163.




Displaying Ethernet statistics for a network adapter
   
$ entstat ‑d en2
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
ETHERNET STATISTICS (en2) :
Device Type: 10/100/1000 Base‑TX PCI‑X Adapter (14106902)
Hardware Address: 00:02:55:d3:37:be
Elapsed Time: 114 days 22 hours 48 minutes 20 seconds

Transmit Statistics:           Receive Statistics:
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑           ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
Packets: 490645639             Packets: 3225432063
Bytes: 9251643184881           Bytes: 215598601362
Interrupts: 0                  Interrupts: 3144149248



Tracing a successful route to a host   

$ traceroute testhost
trying to get source for testhost
source should be 10.216.163.37
traceroute to testhost (10.217.1.206) from 10.216.163.37 (10.216.163.37), 30 hops max
outgoing MTU = 1500
 1  10.216.163.2 (10.216.163.2)  1 ms  0 ms  0 ms
 2  10.217.189.6 (10.217.189.6)  0 ms  0 ms  0 ms
 3  testhost (10.217.1.206)  1 ms  1 ms  1 ms

traceroute -p 40015 200.14.166.72


Testing port 80 (HTTP) on a host (successful)

$ telnet testhost 80
Trying...
Connected to testhost.
Escape character is '^]'.
^]
telnet> quit
Connection closed.


$ grep testhost /etc/hosts
10.217.1.206    testhost testhost.testdomain.com aixserver
 

$ curl 10.217.1.206:22
SSH-2.0-OpenSSH_7.4
curl: (56) Recv failure: Connection reset by peer




Resolving a host name via DNS

$ nslookup testhost
Server:  testdns.testdomain.com
Address:  158.177.79.90

Name:    testhost.testdomain.com
Address:  10.217.1.206

nslookup www.devweb.cl 1.1.1.1

Dig

dig @8.8.8.8 +trace stackoverflow.com

  1. https://www.digwebinterface.com/
  2. https://mxtoolbox.com/SuperTool.aspx
  3. https://dnschecker.org/#A/corporate.bcimiami.com



Get DNS Records Using dig and host Commands

You can use the dig command to verify DNS mappings, host addresses, MX records, and all other DNS records for a better understanding of DNS topography.

The dig command was developed to replace nslookup command.

$ dig google.com


Telnet without telnet:

curl -v telnet://127.0.0.1:22

cat < /dev/tcp/127.0.0.1/22


telnet: ctrl+] is an escape sequence that puts telnet into command mode,

curls cookies

curl -c - "http://127.0.0.1:7001/sample/deals-api-aggregator"

curl -c - "http://127.0.0.1:7001/sample/presentacion-0.0.1-SNAPSHOT/"

curl -v --cookie 'JSESSIONIDMULTIPRO=123' -c - "http://127.0.0.1:7001/sample/deals-api-aggregator/"


steroids:

mtr >> ping/traceroute
curl >> wget
htop >> ps/top
ncdu >> du
parallel >> xargs/ssh
rsync >> cp/scp
ag >> find/grep
dig >> nslookup


SSL test:

https://www.ssllabs.com/ssltest/analyze.html?d=github.com&s=192.30.255.112&hideResults=on

Misc

netstat -apn (linux)

nmap

netstat -apn | grep 8001

 

how to know IP :
ipconfig

ifconfig | grep "inet " | grep -v 127.0.0.1

linux:
ifconfig eth0

netstat cheat sheet 


Difference among JVM JRE JDK

JVM = responsible for executing the java program line by line hence it is also known as an interpreter.

JRE = JVM + Lib classes

JDK = JRE + Dev Tool


10 September 2019

Visitor Pattern

Two simple examples are taken from github repo about Visitor pattern:


The Visitor drops by:

  • The Visitor must visit each element of the Composite; that functionality is in a Traverser object.
  • The Visitor is guided by the Traverser to gather state from all of the objects in the Composite.
  • Once the state has been gathered, the Client can have the Visitor perform various operations on the state.
  • When new functionality is required, only the Visitor must be enhanced.

From: Head First Design Patterns.

1. https://github.com/devwebcl/simple_design_patterns/tree/master/visitor-pattern/src/main/java/com/iluwatar/visitor









2.  https://github.com/devwebcl/simple_design_patterns/tree/master/visitor-pattern/src/main/java/com/behavioural/visitor




References:


  1. https://github.com/chirey/designPatternsThoughtsCode
  2. https://github.com/iluwatar/java-design-patterns/tree/master/visitor



Java Threads API Evolution

After searching again for this cool article: https://howtodoinjava.com/java/multi-threading/java-multi-threading-evolution-and-topics/

Here there is a summary of Threads evolution through the years:

JDK 1.0

java.lang.Thread
java.lang.ThreadGroup
java.lang.Runnable
java.lang.Process
java.lang.ThreadDeath

JDK 1.1

The Thread.stop, Thread.suspend, and Thread.resume methods are deprecated as of JDK 1.1.

JDK 1.2 and JDK 1.3 

had no noticeable changes

JDK 1.4

There were few JVM level changes to suspend/resume multiple threads with single call.

JDK 1.5 

was first big release after JDK 1.x; and it had included multiple concurrency utilities. Executor/ExecutorService, semaphore, mutex, barrier, latches, concurrent collections and blocking queues;

JDK 1.6

was more of platform fixes than API upgrades.

JDK 1.7 

added support for ForkJoinPool which implemented a work-stealing technique to maximize the throughput. Also, Phaser class was added.

JDK 1.8 

is largely known for Lambda changes, but it also had few concurrency changes as well. Two new interfaces and four new classes were added in java.util.concurrent package e.g. CompletableFuture and CompletionException.

The Collections Framework has undergone a major revision in Java 8 to add aggregate operations based on the newly added streams facility and lambda expressions; resulting in a large number of methods added in almost all Collection classes, and thus in concurrent collections as well.

JDK 9

JEP 266: More Concurrency Updates defines an interoperable publish-subscribe framework for reactive streams, enhancements to the java.util.concurrent.CompletableFuture class, and various other improvements.



08 September 2019

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.