Honestly you don't have 2 sub-domains. From DNS point of view you have two hosts 'app1' and 'app2' in DNS 2nd level domain 'example.com'. The tech overview for OpenSSO is still valid for OpenAM and there is quite a lot of documentation. The J2EE agents have a sample app with a nice step-by-step readme.
The default config is quite simple, or as simple as other software with comparable complexity.
-Bernhard