Паттерн: Одиночка (Singleton)
Фрагмент: SingletonSub, через стат-инициализатор [java]
  1. package singleton;
  2.  
  3. public class SingletonSub extends RegSingleton {
  4. // It's the only time and place when
  5. // its constructor invokes
  6. static {
  7. new SingletonSub();
  8. }
  9.  
  10. protected SingletonSub() {
  11. // put this subclass in common register with
  12. // this class name
  13. RegSingleton.Register(this.getClass().getName(), this);
  14. }
  15.  
  16. }