What are the basic principles of how two separable computers connected within the same network running the same Java application maintain the same state by syncing their heap be
Terracotta can indeed handle that if you tell it to - see the description of its DSO - Distributed Shared Objects.
It sounds cool but I would prefer something like EHcache (can be backed by Terracotta again) which functions on a bit more high level.