If I have an Application like this:
Class Application {
List state1 = new ArrayList();
Map state2 = new HashMap();
}
And I have a RPC service run in an other thread that uses to report the state of Application(such as: how many item in state1, which are containing in state2 keys). What's the best way to do that? I'm finding the way to avoid using synchronize when access to state1 and state2 fields(which maybe slow down performance of application).