pm2和nodejs
nodejs是javascript的运行环境,异步IO,支持高并发。
PM2 (Process Manager 2) 是JavaScript运行时Node.js的进程管理器。
private、protected、public、static、final
对任何类、方法、参数、变量,严格控制访问范围,这样有利于模块解耦。
private
should be used when something is not used outside of a given class- for methods and fields - when they are used only within the same class
- for classes - only on nested classes, when used in the same class
protected
should be used when- for methods and field - when you need to make them accessible to subclasses only
- for classes - again only nested classes, accessible by subcalsses
public
is used when something is accessible by every other classstatic
is used when you don’t need an instance of a class (i.e. object) to use it:- for fields - when you want to have a global field
- for methods - when you need utility functions that do not depend on object state
- for nested classes - when you want to access them without an instance of the enclosing class.
abstract
when you don’t want to provide implementations in the current class:- on methods - when subclasses have to provide the actual implementation, but you want to invoke these methods (no matter how they are implemented) in this class.
- on classes - to denote that the class may have abstract methods.
final
when you don’t want something to change.- on fields, when you want to assign the value only once. It is useful when you want to pass a local variable to an inner class - you have to declare it final.
- on classes and methods - when you don’t want subclasses to be able to extend / override them.
方法的访问修饰符: