应用observer 模式的一个好处是,处理定时触发的业务逻辑可以分散放在各个模块内部。
SessionJob 一定要声明在SessionScheduler 类外面。 如果用作SessionScheduler的内部类会产生莫名其妙的错误。
执行java程序时传入的系统参数可以通过以下方式在程序中获取: java -D参数1=值1 java程序名 Properties props = new Properties(System.getProperties()); String outputMode = props.getProperty("参数1");
异步log to file 1. 启动一个多线程,维护一个List列表。List中存放的是需要log的字符串。早期用Vector来考虑同步的问题,甚至可以包装Vector。加入wait/notify机制。 2. 主程序启动时打开文件,主程序结束时关闭文件。其他还有异常,rotate file时也需要关闭文件。 // Open the file output stream logOutputStream = new FileOutputStream(this.fileName); &nbs
#install ldap 1. install BerkeleyDB.4.6 2. add /usr/local/BerkeleyDB.4.6/lib to /etc/ld.so.conf, then execute ldconfig 3. env CPPFLAGS="-I/usr/local/BerkeleyDB.4.6/include" LDFLAGS="-L/usr/local/BerkeleyDB.4.6/lib" ./configure --prefix /usr/local/openldap 4. make depend 5. make 6. make install 7. go to /usr/local/openldap/libexec execute ./slapd 8. ps -aux | grep slapd verify LDAP server is up #install ldap browser #for error:Can't connect to X11 windo
RMI provides the solution of communication between Java processes. For building a RMI Server/Client Application, below steps are considered: 1. define the Remote interfaces extends from java.rmi.Remote these interfaces will also be provided to client. note: all remote interfaces throw java.rmi.RemoteException 2. implement the remote interfaces, the implementation classes also extend java.rmi.server.UnicastRemoteObject to export the remote objects. 3. use java
In DB2, e.g if you issue below sql statement 100 times, insert into TableA (id , fields) values (1, 'val1'); insert into TableA (id , fields) values (2, 'val2'); insert into TableA (id , fields) values (3, 'val3'); ......................... insert into TableA (id , fields) values (100, 'val100'); if you set jdbc batch_size to 50, it could be only issue two sql to db instead as below: insert into TableA (id , fields) values (1, 'val1') , (2, 'val2') ,(3, 'val3') ,(4, 'val4') ,......,(50, 'val50') insert into TableA (id , fields) values (51, 'val51') , (52, 'val52') ,(53, 'val53') ,(54, 'val54'),...... ,(100, 'val100')
Message Broker based on RMI