Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

mahajan amit

+ Follow
since Oct 16, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mahajan amit

And here is the solution
Million dollar proof that i was wrong

output is strangely not 2
a: 902+b: 910is 1812
a: 903+b: 911is 1814
a: 904+b: 912is 1816
a: 895+b: 903is 1798
a: 898+b: 906is 1804
a: 900+b: 908is 1808
a: 903+b: 911is 1814

i was (900 times ) wrong about static
Thanks Jeff and Steve, i got some clarity, but i will definitely write one program to check if i can corrupt one variable by many threads.

Something that will do 2 + 2 and may result 5

Thanks a lot...
Static Method + Data -> Stack

Objects -> Heap

Thread 1 -> Read static -> copy stack static value to Heap
-> perform Read Write

-> Save changes to stack

Thread 2 -> Read static -> copy stack static value to Heap
-> perform Read Write

-> Save changes to stack

Thread 3 -> Read static -> copy stack static value to Heap
-> perform Read Write

-> Save changes to stack

In case all methods are also static they will always be copied to heap and get new memory.

Does it makes my Question clearer?

Any program some one can write to deny it?
Actually the question i am asking is if all the methods accessing this static variable are also static.

these static methods and variables will be stored in class memory right?

Does it gives any advantage for thread safety. I have seen one application where this feature is used for skipping synchronization.

Anyways what was the result of your testing.
Can you test with static methods?

Seetharaman Venkatasamy wrote:

mahajan amit wrote:
Is this static variable thread safe?

No, it is not thread safe. you can see this behavior to write one java program
1.start two thread on single object
2. declare one static int in that object
3. and loop like below in your run()

you need proper synchronization for above code.

<edit>William beaten me ;)</edit>

Hi All

I checked the internal code of hashmap and found that it uses & operator on table length-1 and hashCode and generates one index.

All the values that are common are stored in same index in linked list.

My question to advanced users is why all this is done?

Why not to use simply based on hashCode and having auto incrementing index, for example if hashcode is 100 and current index is 5, then store hashcode 100 to next available index by ordering to hashcode.

this way avoiding bucket storage and parsing.
5 years ago

We know that it is mandatory to override hashcode if equals method is overriden.

Is the reverse also true?

5 years ago

I have a static variable and few static methods are accessing it from different threads.
As designed, there is no non static method that is going to access it.

Is this static variable thread safe?

Thanks in advance,


Paul Sturrock wrote:Hibernate works from a static model, it is not designed to handle dynamic classes (in its released and supported versions anyway). 3.3 has added some support for dynamic models but (as the documentation states) this is experimantal and can change at any time.

Is this the feature you were looking for?


Thanks for replying, i am looking for this feature which means putting <dynamic-class> inside mapping xml.

I think this is working in version 3.2+ as i am able to use <dynamic-component> right now, although i am not sure.

Is it possible?

Please explain what this means


Please anyone explain step wise how to use this dynamic-class, in hibernate.

I think this is some new feature in hibernate. I did not found much help on Google guru.

I am new to hibernate and my requirement is to map DTO at runtime and persist them.

For example at run time i should be able to create mapping of any DTO(s) as required and
using dynamic-class. it should be persisted.

boss is surely gona kill me

Thanks all

earlier posted How to use the HTTPClient of t3 configuration in apache HTTP server
9 years ago
you seems to enter some blank xml fields like if you dont want to enter value of say some value
insted of using , remove the whole tag. thus the validation will not fail.


---------------> <root>...something</root>
9 years ago
Hi all

I have done configuring t3 on apache HTTP, using below settings, and this is working fine when i access a weblogic application with apache url.

here the prot 8004 is of a channel that i created on weblogic using t3 protocol.

My question is what is the use of <Location /HTTPClnt> and how can i test this configuration (eg something like ~http://localhost/HTTPClient prot=?)

what is the use of the t3 settings in Apache HTTP.


LoadModule weblogic_module modules/

<IfModule mod_weblogic.c>
WebLogicPort 8004
Debug ON
WLLogFile D:/amit/HTTP/proxy.log
WLTempDir "d:/amit/HTTP/temp"
DebugConfigInfo On
KeepAliveEnabled ON
KeepAliveSecs 14
MatchExpression *.jsp

<Location /weblogic/fcrappweb>
SetHandler weblogic-handler
PathTrim /weblogic

<Location /HTTPClnt>
SetHandler weblogic-handler
9 years ago