classFab.addField("_inner", serviceInterface);
classFab.addField("_shutdown", boolean.class);
classFab.addInterface(RegistryShutdownListener.class);
classFab.addMethod(Modifier.PUBLIC | Modifier.FINAL, new MethodSignature(void.class,
"registryDidShutdown", null, null), "{ _shutdown = true; }");
classFab.addMethod(
Modifier.PUBLIC | Modifier.SYNCHRONIZED | Modifier.FINAL,
new MethodSignature(void.class, "_setInner", new Class[]
{ serviceInterface }, null),
"{ _inner = $1; }");
BodyBuilder builder = new BodyBuilder();
builder.begin();
builder.addln("if (_shutdown)");
builder.begin();
builder.addln("_inner = null;");
builder.addln("throw org.apache.hivemind.HiveMind#createRegistryShutdownException();");
builder.end();
builder.addln("return _inner;");
builder.end();
classFab.addMethod(Modifier.PRIVATE, new MethodSignature(serviceInterface, "_getInner",
null, null), builder.toString());
proxyBuilder.addServiceMethods("_getInner()");
return classFab.createClass();