1. JSF Lifecycle

      The life cycle handles both kinds of requests: initial requests and postbacks. When a user makes an initial request for a page, he or she is requesting the page for the first time. When a user executes a postback, he or she submits the form contained on a page that was previously loaded into the browser as a result of executing an initial request. When the life cycle handles an initial request, it only executes the restore view and render response phases because there is no user input or actions to process. Conversely, when the life cycle handles a postback, it executes all of the phases.   Restore View builds the view root and saves to FacesContext, includes event handlers and validators if it is the initial reqeust, empty view created and life cycle advances to render response directly. Apply Request Value component extracts its new value from the request parameters. Type conversion occurs in this phase.   if renderResponse called on FacesContext, skip to the render response phase.    FacesContext.responseComplete can be called, and redirect to a different web app   if immediate set to true, the validation, conversion,events will be processed in the phase.   Process Validations process validators registered on the components. if any error message, the life cycle advances directly to the render response phase.   if FacesContext.renderResponse called, skip to the render response phase   if FacesContext.responseComplete called, redirect to a different web app   Update Model value update component value to manage bean property   similarily for FacesContext.responseComplete similarily for FacesContext.renderResponse   Invoke Application handle application-level events   similarily for FacesContext.responseComplete Render Response if JSP pages used, the components will render themselves as the JSP container traverses the tags in the page.   if this is the initial request, the components represented on the page will be added to the component tree as the JSP container executes the page.  

    2017/02/12 iteye

  2. API 层事务策略

    API Layer 事务策略的命名基于这样一个事实:所有事务逻辑包含在逻辑应用程序架构的 API 层。这个层是一个逻辑层 — 有时也被称为应用程序的域层(domain layer)或 facade 层,它以公共方法或接口的形式向客户机(或表示层)公开功能。之所以说是逻辑 层,是因为可以从本地访问域层(通过直接实例化和调用),或通过 HTTP、远程方法调用(RMI)、通过 EJB 使用 RMI over Internet Inter-Orb Protocol (RMI-IIOP),甚至通过 Java Message Service (JMS) 进行远程访问。       只有包含在应用程序架构的 API 层中的公共方法包含事务逻辑。其他方法、类或组件都不应包含事务逻辑(包括事务注释、编程式事务逻辑和回滚逻辑)。 API 层中的所有公共写方法(包括插入、更新和删除)都应当使用事务属性 REQUIRED 加以标记。 API层中的所有公共写方法(包括插入、更新和删除)都应当包含回滚逻辑,以标记对检查出的异常执行回滚的事务。 API 层中的所有公共读方法默认情况下都应使用事务属性 SUPPORTS 加以标记     对于 LUW (Logic Unit of Work)请求,应用程序使用 85% 的单 API 层调用和 15% 的多 API 层调用。对于多API层调用解决的方法是使用一个聚合 API 层方法将多个 API 调用重构为一个单一的 API 调用。

    2017/02/12 iteye

  3. CMMI

    CMMI Maturity Levels: Level-1:  Chaotic, individual heroics   Level-2: Managed processes are planned, documented, monitored, and controlled at the project level   Level-3: Defined  processes are described in standards, procedures, tools and methods   Level-4: Quantitatively Managed Processes are controlled using quantitative techniques   Level-5: Optimizing Continually improving process performance

    2017/02/12 iteye

  4. 数据库表设计

    Q: 如何在开发后期修改表结构对现有程序影响最小 表设计是预留一个无任何业务意义的字段,比如userFiled1,userField2,....方便以后与具体业务字段映射 设计一个特殊的字段存放XML文件,XML文件中存放自定义的结构,方便系统扩充。存取是需要解析XML字符串   通过象Hibernate这种物理表结构和对象逻辑结构的映射。修改发生在物理表结构和hibernate mapping 文中   在java类中,用不可变的字符串定义了表名和字段名。如            public const String CUSTOMERS_TABLE = "Customers";     public const String EMAIL_FIELD     = "Email";     public const String NAME_FIELD      = "Name";     这样修改只发生在少量的地方。 Q:如何提高性能 为特殊的业务需求,比如支付平台的reconciliation和settlement,建一张影子表(比如paymentShadow),冗余其他相关表的字段。通过这种手段减少关联查询提高效率。 不设外键甚至主键,这种方式有点像No SQL的方式,但确实在商业应用系统中碰到过。

    2017/02/12 iteye

  5. session 实现

    我们知道session 实现有好几种机制,比如cookie, url-rewriting, etc.   When cookie is disabled on client side, most of time we can refer to use response.encodeURL or encodeRedirectURL to add a param jsessionid to identify the client and context.

    2017/02/12 iteye

  6. portlet lifecycle

    processAction processEvent render serveResource    

    2017/02/12 iteye

  7. java 常见排序算法

    摘自http://deng5566.iteye.com/blog/678817,仅供自学。      

    2017/02/12 iteye

  8. 高性能数据库设计

    字段冗余   Sharding   水平切分:分库,分表 根据一个标志字段如user id   问题:如何路由?   集群(Cluster),负载均衡(找到集群中的DB)   读写DB分离 Master DB(写),Slave DB(读),一般读写比例是10:1  

    2017/02/12 iteye