package LockAPPC; public abstract class LockComponent { boolean lock; // classes to be defined by the extending inner class public abstract Object get_host(); public abstract void expected_pushOp(Object passed); public abstract Object expected_popOp(); // real component methods public void pushOp(Object passed) { if (!lock) { System.out.println("Locking"); actual_pushOp(passed); System.out.println("Unlocking"); } } public Object popOp() { if (!lock) { System.out.println("Locking"); Object pop = actual_popOp(); System.out.println("Unlocking"); return pop; } return null; } public abstract void actual_pushOp(Object passed); public abstract Object actual_popOp(); }