Transaction & SecurityChuyên đề Lập trình Java & J2EE Chương 16 Biên soạn: Th.S Nguyễn văn Lành... Motivation for Transactions Atomic Operations Recovery after Network or Machine Fail
Trang 1Transaction & Security
Chuyên đề Lập trình Java & J2EE
Chương 16
Biên soạn: Th.S Nguyễn văn Lành
Trang 2Motivation for Transactions
Atomic Operations
Recovery after Network or Machine Failure
Multiple Users Sharing Data
avoid those problems by properly using
Trang 3The ACID Properties
Atomicity guarantees that many operations are
bundled together and appear as one contiguous unit
of work
Consistency guarantees that a transaction leaves
the system’s state to be consistent after a
transaction completes
Isolation protects concurrently executing
transactions from seeing each other’s incomplete
results
Durability guarantees that updates to managed
resources, such as database records, survive failures
Trang 4Transactional Models
Flat transaction is a series of
operations that are performed
atomically as a single unit of work
Nested transaction allows to embed atomic units of work within other units
of work.
Trang 8Required
Trang 9Requires New
Trang 10Mandatory
Trang 11Never
Trang 12Bean Managed Transaction
Trang 14Java Transaction API (JTA)
JTA can be used in client & bean code
to programmatically control
transactional boundaries.
The interface you use to
programmatically control transactions is
Trang 15UserTransaction interface
Trang 16Code sample
Trang 17Transactional Isolation
Concurrency Control
locking on the database to prevent the two components
from reading data
Four transaction isolation levels:
Trang 18Distributed Transactions
Distributed flat transactions allow multiple
transaction participants, written by different vendors , to collaborate under one
transactional context.
Two-Phase Commit Protocol
Phase One begins by sending a before commit
message to all resources involved in the transaction
Phase Two occurs only if Phase One completed
Trang 192PC protocol
Trang 20EJB Security
Authentication verifies that the client
is who he claims to be.
Authorization checks to see if an
already authenticated client is allowed
to perform a task.
Trang 21 Basic authentication
The Web client supplies a username and password
to the Web server
Form-based authentication.
uses a customizable form, login screen
Digest authentication
Web client supplies a special message digest to
the Web server
Certificate authentication
The client can establish an identity with X.509