View Single Post
  #8 (permalink)  
Old 05-23-2008, 03:48 PM
sajdutt sajdutt is offline
Member
 
Join Date: May 2008
Posts: 4
sajdutt is on a distinguished road
Thanks for your replies Daniel.

It's just that the coding for adding the user and the comparison process involves several Java classes and JSP pages. Let me go through the steps.

It's a huge Financial System where you can add a Trader (a new user), include him with other employees who belong to the same company who are already registered in the system.

When you add an user, the JSP calls a certain Java class (Cache.java) to do that which also involves other java classes to complete the task. Cache class assigns the id (an object - ID class) of the company to the newly created user.

When we make a Trade (A contract between two traders), we search for his colleagues( Other traders/brokers from his company).

//Get the cache
ICache cache = (ICache) session.getAttribute("cache");

//Get the newly created trader
IUser trader = cache.getUser(userName);

//get the colleagues. It's in a loop of Traders
IUser ccUser = (IUser) cache.getUser((ID) iter.next());

//Compare the traders to see if they belong to the same company
if (toIncludeUser.getClientId() == mainUser.getClientId()) {...}

The comparison above returns true when the Trader is not a newly created trader. And also it returns true when servers are not synced. Moreover, it returns true if the server is the elected server.

Elected Server: When multiple servers are synced, Cache checks what server is elected. The election is done randomly. When we add a new user, we first add that user in the elected server. Then we add it in the other servers.

Last edited by sajdutt : 05-23-2008 at 03:54 PM.
Reply With Quote