protected void startService() throws Exception {
Context ctx = new InitialContext();
// Bind the in VM UserTransaction interface
ctx.bind(JNDI_NAME, ClientUserTransaction.getSingleton());
// Get the UserTransactionSession proxy
txProxy = getServer().getAttribute(txProxyName, "Proxy");
// Build the UserTransactionSession interface method map
HashMap tmpMap = new HashMap(13);
Method[] methods = UserTransactionSession.class.getMethods();
for(int m = 0; m < methods.length; m ++)
{
Method method = methods[m];
Long hash = new Long(MarshalledInvocation.calculateHash(method));
tmpMap.put(hash, method);
}
// Add the UserTransactionSessionFactory interface method map
methods = UserTransactionSessionFactory.class.getMethods();
for(int m = 0; m < methods.length; m ++)
{
Method method = methods[m];
Long hash = new Long(MarshalledInvocation.calculateHash(method));
tmpMap.put(hash, method);
}
marshalledInvocationMapping = Collections.unmodifiableMap(tmpMap);
// Place our ObjectName hash into the Registry so invokers can resolve it.
// We need this for the HA Proxy case where the only the target service
// is added to the registry, which is how it should be.
// In the non HA Proxy case, JRMPProxyFactory acts both as a proxy factory
// and proxy which is conceptually wrong, hence this is an extra step in
// that case.
Registry.bind(new Integer(serviceName.hashCode()), serviceName);
}
|