tailieunhanh - Design ejb design patterns phần 2

Khi thực hiện phương pháp trên đường về nhà đậu thực thể và giao diện từ xa, phương pháp này sẽ không quy mô dưới tải nghiêm trọng, bởi vì toàn bộ kịch bản đòi hỏi phải có ít nhất sáu cuộc gọi mạng: ba cho việc tìm kiếm đậu thực thể thích hợp, và thêm ba để thực sự chuyển giao các quỹ. | 6 Chapter One When executing methods on the entity beans home and remote interface this approach will not scale under serious loads because the whole scenario requires at least six network calls three for finding the appropriate entity beans and three more for actually transferring the funds. Furthermore since entity beans are transactional creatures each method call on an entity will require a separate transaction on the server side requiring synchronization of the remote entity with its underlying data store and maintenance on behalf of the application server. What s worse is that this approach won t guarantee the safety of the client s money. If something goes wrong with the deposit the client s money will have already been withdrawn and his money will be lost. The user authorization check the withdrawal and the deposit all run completely separately and if the deposit fails the withdrawal will not be rolled back resulting in an inconsistent state. The problem here is that when calling an entity bean s methods directly each method call is a separate unit of work and a separate transaction. One solution is to push extra logic into our entity beans to perform many operations on behalf of a single client call. This solution introduces maintenance problems because our entity bean layer will likely be used in many different ways over time. If we add application logic to our entity beans each time we need a performance enhancement our entity beans will quickly become very bloated and difficult to understand maintain and reuse. We are effectively merging our application logic verbs with our persistence logic nouns which is poor application design. Another approach is for our client to demarcate an aggregate large transaction via the Java Transaction API JTA . This would make each entity bean method call operate under the same transaction in an all-or-nothing fashion. If the deposit fails then the withdrawal will be rolled back and the users money will be safe. However .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.