Is PHP has synchronize mechanism like Java? In my project different users can continue with same transaction.
As example, I send a mail with payment details page URL to different user. So they can view that page at same time. Also they can continue to same transaction. I want deny (Show message) that page for users when one user already view the page. In java we can use synchronize for object. How can i do it in php or zend framework?
PHP is NOT like Java.
Each request run in a separate stack with separate variables. You can share objects in PHP only using extension like memcache etc.
My advise is to use the locking mechanism of the file system. For example:
<?php
$fp = fopen( $filename,"w"); // open it for WRITING ("w")
if (flock($fp, LOCK_EX)) {
// do your stuf here
flock($fp, LOCK_UN); // unlock the file
} else {
// flock() returned false, no lock obtained
print "Could not lock $filename!\n";
}
?>
I'm struggling to understand what you're trying to achieve here - either in PHP or Java. It seems you want to apply a mutex to a dataset - however that's not a side effect of synchronized - not it's purpose. It shoudn't be necessary if you use the session id and a FSM to control access.