Skip to content
Snippets Groups Projects
Commit a504f3c6 authored by srosse's avatar srosse
Browse files

OO-613: adapt BPS code for Onyx to JBoss + close the consumer / queue to prevent stale Tomcat

parent d88a1941
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,8 @@ Configuration JBoss AS 7.1
jms.broker.jndi=java:/ConnectionFactory
sysbus.broker.jndi=java:jboss/exported/jms/topic/sysbus
search.broker.jndi=java:jboss/exported/jms/queue/searchQueue
index.broker.jndi=java:jboss/exported/jms/queue/indexQueue
exam.broker.jndi=java:jboss/exported/jms/queue/examQueue
Configuration Glassfish 3.1
......@@ -61,6 +63,8 @@ Configuration Glassfish 3.1
jms.broker.jndi=OpenOLATConnectionFactory
sysbus.broker.jndi=topic/sysbus
search.broker.jndi=queue/searchQueue
index.broker.jndi=queue/indexQueue
exam.broker.jndi=queue/examQueue
Features located on the application server
......
......@@ -197,6 +197,30 @@ public class ExamPoolManagerProvider implements MessageListener {
connection.start();
log.info("springInit: JMS connection started with connectionFactory=" + connectionFactory);
}
public void springStop() throws JMSException {
closeQueue();
}
private void closeQueue() {
if(consumer != null) {
try {
consumer.close();
System.out.println("Close consumer exam pool");
} catch (JMSException e) {
log.error("", e);
}
}
if(connection != null) {
try {
connection.close();
System.out.println("Close connection exam pool");
} catch (JMSException e) {
log.error("", e);
}
}
}
private synchronized Session acquireSession() throws JMSException {
if (sessions.size() == 0) {
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:property-placeholder location="classpath:serviceconfig/olat.properties, classpath:olat.local.properties" />
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- general reference-holder -->
<!-- ================================= -->
......@@ -18,7 +13,7 @@
<!-- SEARCH SERVICE SIDE CONFIGURATION -->
<!-- ================================= -->
<bean id="examControl.master.true" class="de.bps.onyx.util.ExamPoolManagerProvider" init-method="springInit" lazy-init="true">
<bean id="examControl.master.true" class="de.bps.onyx.util.ExamPoolManagerProvider" init-method="springInit" destroy-method="springStop" lazy-init="true">
<constructor-arg name="examPoolManager" ref="examPoolManagerServer"/>
<property name="connectionFactory" ref="examControlConnectionFactory"/>
<property name="searchQueue" ref="examControlQueue"/>
......@@ -37,19 +32,14 @@
<property name="timeToLive" value="45000"/>
</bean>
<!-- SEARCH COMMON CONFIGURATION (PROXY-SIDE AND SERVICE-SIDE) -->
<!-- ========================================================= -->
<!-- SEARCH COMMON CONFIGURATION (PROXY-SIDE AND SERVICE-SIDE) -->
<!-- ========================================================= -->
<!-- JMS Stuff -->
<bean id="examControlConnectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory" lazy-init="true">
<property name="brokerURL" value="${search.broker.url}" />
</bean>
<!-- used for sending the search requests -->
<bean id="examControlQueue" class="org.apache.activemq.command.ActiveMQQueue" lazy-init="true">
<constructor-arg value="olat/examQueue" />
</bean>
<import resource="classpath:de/bps/onyx/util/_spring/examControlJms_${jms.provider}.xml" />
</beans>
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- JMS Stuff -->
<bean id="examControlConnectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory" lazy-init="true">
<property name="brokerURL" value="${search.broker.url}" />
</bean>
<!-- used for sending the search requests -->
<bean id="examControlQueue" class="org.apache.activemq.command.ActiveMQQueue" lazy-init="true">
<constructor-arg value="olat/examQueue" />
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- JMS Stuff -->
<bean id="examControlConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName"><value>${jms.broker.jndi}</value></property>
</bean>
<!-- used for sending the search requests -->
<bean id="examControlQueue" class="org.apache.activemq.command.ActiveMQQueue" lazy-init="true">
<constructor-arg value="olat/examQueue" />
</bean>
<bean id="examControlQueue" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName"><value>${exam.broker.jndi}</value></property>
</bean>
<!-- JMS Stuff -->
<bean id="searchConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName"><value>${jms.broker.jndi}</value></property>
</bean>
<bean id="searchQueue" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName"><value>${search.broker.jndi}</value></property>
</bean>
<bean id="indexConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName"><value>${jms.broker.jndi}</value></property>
</bean>
<bean id="indexQueue" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName"><value>${index.broker.jndi}</value></property>
</bean>
</beans>
......@@ -211,6 +211,7 @@ public class JmsIndexer implements MessageListener, LifeFullIndexer {
if(consumer != null) {
try {
consumer.close();
System.out.println("Close consumer JMSINDEXER");
} catch (JMSException e) {
log.error("", e);
}
......@@ -219,6 +220,7 @@ public class JmsIndexer implements MessageListener, LifeFullIndexer {
try {
indexerSession.close();
connection.close();
System.out.println("Close connection JMSINDEXER");
} catch (JMSException e) {
log.error("", e);
}
......
......@@ -674,6 +674,7 @@ jms.broker.jndi=OpenOLATConnectionFactory
sysbus.broker.jndi=topic/sysbus
search.broker.jndi=queue/searchQueue
index.broker.jndi=queue/indexQueue
exam.broker.jndi=queue/examQueue
# enable/disable codepoint/breakpoint framework
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment