public static Service install(Service self)
{
try
{
List types = FanObj.@typeof(self).inheritance();
lock (m_lock)
{
// if already installed, short circuit
if (self.isInstalled()) return self;
// add to byService map
byService[self] = new State(self);
// add to map for each type service implements
for (int i=0; i<types.sz(); ++i)
{
Type t = (Type)types.get(i);
if (!isServiceType(t)) continue;
Node node = new Node(self);
Node x = (Node)byType[t.qname()];
if (x == null) byType[t.qname()] = node;
else
{
while (x.next != null) x = x.next;
x.next = node;
}
}
}
}
catch (System.Exception e)
{
Err.dumpStack(e);
}
return self;
}