How to use Identity Map in distribution enviroment
Identity map ensure that each object only loads one from db.
It creates a map to store each object before others use this. I make this map as static for that class.
Then how could I use it in distribution enviroment. As this class in another server doesn't have this record.
[301 byte] By [
icey_h] at [2007-9-30 12:33:17]

You're quite right - each node in a distributed environment will have it's own copy. So you'll end up with the initial load-up of each map to be pretty close to the same as if it were a single server. However, soon all the nodes will reach a steady-state and, depending upon your load-balancing mechanism, all the maps will probably contain roughly the same data.
At this time (in distributed computing technology), it's pretty difficult to build-your-own distributed cache and the good one(s) are extremely expensive. So you have this trade-off that you have to evaluate: a very large chunk of cash or take the "hit" of the map(s) loading up as the system gets under load.
Identity Map used for load only one object and keep it in one place. whenever you use this object, you get this object's reference not its copy, right?
Then if one user changed its value, it also effected two another's record. How it control the concurrency problem?
What's really usage for identity Map?
I am a new one for study pattern. and I haven't clearly picture for these things. especially in work..
Thanks All.
> How it control the concurrency
> problem?
Obviously, that is an implementation issue. And not an easy one to solve.
> What's really usage for identity Map?
Probably in a non-distributed, low-thread environment. Especially one where the developer has some control over the threads, which is not found in distributed environments.
> I am a new one for study pattern. and I haven't
> clearly picture for these things. especially in
> work..
Oh, you've probably used them - you just didn't know you did. My favorite pattern: StateMachine. I have absolutely no idea how many times I implemented that particular pattern before I even knew what it was called.
A "StateMachine" is a piece of code that maintains a "state" of itself and, when invoked, makes "choices" (usually a switch/case) statement based on the current state as to the next phase of operations. Think of it as a very simple rules-engine.
There's plenty of material on Patterns available on the Web and more books published than you can imagine. The "definitive" book is commonly referred to as "The Gang of Four" or "GoF" book - heck, I can't even remember it's real name! Type either of those items into Google and you'll get plenty of hits...