Methods Summary |
---|
public org.jboss.aop.joinpoint.InvocationResponse | dynamicInvoke(org.jboss.aop.joinpoint.Invocation invocation)
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
EJBContainerInvocation newSi = null;
pushEnc();
try
{
Thread.currentThread().setContextClassLoader(classloader);
MethodInvocation si = (MethodInvocation) invocation;
MethodInfo info = (MethodInfo) methodInterceptors.get(si.getMethodHash());
if (info == null)
{
throw new RuntimeException("Could not resolve beanClass method from proxy call");
}
newSi = new EJBContainerInvocation(info);
newSi.setArguments(si.getArguments());
newSi.setMetaData(si.getMetaData());
newSi.setAdvisor(this);
InvocationResponse response = new InvocationResponse(newSi.invokeNext());
response.setContextInfo(newSi.getResponseContextInfo());
return response;
}
finally
{
Thread.currentThread().setContextClassLoader(oldLoader);
popEnc();
}
|
public java.util.Map | getActivationConfigProperties()
HashMap result = new HashMap();
Consumer annotation = (Consumer) resolveAnnotation(Consumer.class);
for (ActivationConfigProperty property : annotation.activationConfig())
{
addActivationSpecProperty(result, property);
}
DefaultActivationSpecs defaultSpecsAnnotation = (DefaultActivationSpecs)resolveAnnotation(DefaultActivationSpecs.class);
if (defaultSpecsAnnotation != null)
{
for (ActivationConfigProperty property : defaultSpecsAnnotation.value())
{
addActivationSpecProperty(result, property);
}
}
return result;
|
public java.lang.Class | getMessagingType()
return javax.jms.MessageListener.class;
|
public org.jboss.aop.MethodInfo | getMethodInfo(java.lang.reflect.Method method)
MethodInfo info = new MethodInfo();
info.setAdvisor(this);
info.setAdvisedMethod(method);
info.setUnadvisedMethod(method);
return info;
|
protected java.lang.reflect.Method | getOnMessage()
if (ON_MESSAGE != null)
return ON_MESSAGE;
try
{
final Class arg = Message.class;
ON_MESSAGE = javax.jms.MessageListener.class.getMethod("onMessage", new Class[]{arg});
}
catch (Exception e)
{
e.printStackTrace();
throw new ExceptionInInitializerError(e);
}
return ON_MESSAGE;
|
public java.lang.Class[] | getProducerInterfaces(org.jboss.ejb3.Container container1)
Class beanClass = container1.getBeanClass();
Class[] interfaces = beanClass.getInterfaces();
if (interfaces.length == 0) throw new RuntimeException("Bean class must implement at least one interface: " + beanClass.getName());
if (interfaces.length == 1)
{
return interfaces;
}
ArrayList localInterfaces = new ArrayList();
for (int i = 0; i < interfaces.length; i++)
{
if (interfaces[i].isAnnotationPresent(Producer.class))
{
localInterfaces.add(interfaces[i]);
}
}
Producer annotation = (Producer)resolveAnnotation(Producer.class);
if (annotation != null)
{
Class producer = annotation.producer();
if (producer != null)
localInterfaces.add(producer);
}
Producers producersAnnotation = (Producers)resolveAnnotation(Producers.class);
if (producersAnnotation != null)
{
for (Producer producerAnnotation : producersAnnotation.value())
{
Class producer = producerAnnotation.producer();
if (producer != null)
localInterfaces.add(producer);
}
}
if (localInterfaces.size() == 0) return null;
interfaces = (Class[]) localInterfaces.toArray(new Class[localInterfaces.size()]);
return interfaces;
|
public java.lang.Object | localInvoke(org.jboss.aop.MethodInfo info, java.lang.Object[] args)
if (info.getAdvisedMethod().equals(getOnMessage()))
{
ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
pushEnc();
try
{
Message message = (Message)args[0];
MethodInvocation invocation = (MethodInvocation) ((ObjectMessage) message).getObject();
invocation.getMetaData().addMetaData(CONSUMER_MESSAGE, CONSUMER_MESSAGE, message, PayloadKey.TRANSIENT);
return this.dynamicInvoke(invocation);
}
finally
{
Thread.currentThread().setContextClassLoader(oldLoader);
popEnc();
}
}
else
return super.localInvoke(info, args);
|
protected void | populateActivationSpec()
DefaultActivationSpecs defaultSpecs = (DefaultActivationSpecs) resolveAnnotation(DefaultActivationSpecs.class);
if (defaultSpecs != null)
{
activationSpec.merge(defaultSpecs.value());
}
Consumer md = (Consumer) resolveAnnotation(Consumer.class);
activationSpec.merge(md.activationConfig());
|
protected void | registerProducers()
Destination dest = (Destination) getInitialContext().lookup(getDestination());
Class[] producers = getProducerInterfaces(this);
MessageProperties props = (MessageProperties) resolveAnnotation(MessageProperties.class);
if (props == null) props = new MessagePropertiesImpl();
for (Class producer : producers)
{
log.debug("Producer: " + producer.getName());
ProducerFactory producerFactory = null;
if (producer.isAnnotationPresent(Local.class))
{
producerFactory = new LocalProducerFactory(this, producer, props, dest, getInitialContext(), initialContextProperties);
}
else
{
producerFactory = new RemoteProducerFactory(this, producer, props, dest, getInitialContext(), initialContextProperties);
}
this.producers.add(producerFactory);
producerFactory.start();
}
|
public void | start()Initialize the container invoker. Sets up a connection, a server session
pool and a connection consumer for the configured destination.
Any JMSExceptions produced while initializing will be assumed to be
caused due to JMS Provider failure.
super.start();
registerProducers();
|
public void | stop()
unregisterProducers();
super.stop();
|
protected void | unregisterProducers()
for (ProducerFactory factory : producers)
{
factory.stop();
}
|