Effective Java
Chapter2 Create and Destroy Object 1 use static factory method to replace constructor Advantage: has name to describe the return object. don鈥檛 need create a new object every times. can return any subclass. change the return object according to the parameter. class returned by method needn鈥檛 exist when write class including the static factory method. Disadvantage: class cannot be extended, if it doesn鈥檛 have a public or protected constructor. programmer cannot find a static factory method....
Docker
Commands docker version view version docker info view docker system info docker images view local images -a view all images docker search [images] search images docker pull [image:tag] download image docker rmi [image ID] delete image docker run [image:tag] [command] create a container -i interactive operation -t terminal -d run in backend -P random map network port -p [external port]:[internal port] map port --name [container name] docker ps show all running containers...
Maven
add dependencies to jar package <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin>
JVM
Java Memory Runtime Data Field Program Counter Register. Thread private. Save current executed bytecode address. If program is executing Java method, the counter record virtual machine bytecode address. Else if native method, the counter鈥檚 value is Undefined. Java Virtual Machine Stack. Thread private. Every time executing a method, JVM create a Stack Frame saving local variable table, operator number stack, dynamic link, method out, and so on. Local variable table save JVM basic data type in compile time, object reference....
HTTP
content from Diagram HTTP Web and network basics URI protocol://user:pass@server address:port/path?search string#fragment identifier Simple HTTP Request structure method URI version headers content Response structure version status code reason-phrase headers body HTTP is a kind of stateless protocol. HTTP/1.1 use Cookie to control status. HTTP method GET get resource POST transfer entity body PUT transfer file (unsafe) HEAD get message header DELETE delete file OPTIONS query URI supporting methods TRACE trace path CONNECT requires a tunneling protocol to connect to the proxy HTTP Persistent Connection Keep the TCP connection state as long as either end does not explicitly propose to disconnect....