小编Gau*_*rav的帖子

同一服务器中两个Web应用程序之间的通信

所有,

我有两个Web应用程序,Web1和Web2,部署在我的tomcat服务器上.我希望Web1中的类在Web2中调用类的方法.一种方法是使用webservice.有没有其他方法类似于在同一Web应用程序上调用类的方法?

谢谢.

java tomcat servlets tomcat6 cross-context

14
推荐指数
3
解决办法
2万
查看次数

Spring的DefaultMessageListenerContainer中taskExecutor属性的用途

Spring的DefaultMessageListenerContainer(DMLC)具有concurrentConsumertaskExecutor属性.taskExecutor bean可以给出corePoolSize属性.那么指定concurrentConsumer和corePoolSize之间的区别是什么?当concurrentConsumer属性被定义时,它意味着Spring将创建指定数量的consumer/messageListeners来处理消息.corePoolSize什么时候出现?

代码段

<bean id="myMessageListener"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="destination" ref="myQueue" />
    <property name="messageListener" ref="myListener" />
    <property name="cacheLevelName" value="CACHE_CONSUMER"/>
    <property name="maxConcurrentConsumers" value="10"/>
    <property name="concurrentConsumers" value="3"/>
    <property name="taskExecutor" ref="myTaskExecutor"/>
</bean>

 <bean id="myTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" >
    <property name="corePoolSize" value="100"/>
    <property name="maxPoolSize" value="100"/>
    <property name="keepAliveSeconds" value="30"/>
     <property name="threadNamePrefix" value="myTaskExecutor"/>
</bean>
Run Code Online (Sandbox Code Playgroud)

spring spring-jms

9
推荐指数
1
解决办法
3731
查看次数

使用Spring的CachingConnectionFactory时关闭会话

这里与Spring CachingConnectionFactory相关的java doc 有评论:

注意:此ConnectionFactory需要显式关闭从其共享Connection获取的所有Sessions.无论如何,这是本机JMS访问代码的通常建议.但是,使用此ConnectionFactory,必须使用它才能实际允许会话重用.

我不清楚如何使用我的应用程序中的以下给定配置来处理这个问题.

<bean id="springApp" class="com.codereq.springcore.jms.SpringJMSListenerApp"  />

<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <property name="destination" ref="destination"/>
    <property name="messageListener" ref="messageListener"/>
    <property name="sessionTransacted" value="true"/>
    <property name="concurrentConsumers" value="5" />
    <property name="maxConcurrentConsumers" value="15" />
</bean>

<bean id="messageListener" class="com.codereq.springcore.jms.MessageListenerApp" />

<bean id="jmsConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"
        p:targetConnectionFactory-ref="emsConnectionFactory"
        p:sessionCacheSize="100" 
        p:cacheConsumers="true" />

<bean id="emsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="GenericConnectionFactory"/>
    <property name="jndiTemplate" ref="jndiTemplate"/>
</bean>


<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">com.tibco.tibjms.naming.TibjmsInitialContextFactory</prop>
            <prop key="java.naming.provider.url">tibjmsnaming://localhost:7222</prop>
            <prop key="java.naming.security.principal">admin</prop>
            <prop key="java.naming.security.credentials">admin</prop>
        </props>
    </property>
</bean>

<bean id="destination" class="com.tibco.tibjms.TibjmsQueue">
    <constructor-arg value="com.sample.queue" />
</bean> …
Run Code Online (Sandbox Code Playgroud)

java spring jms spring-jms

8
推荐指数
1
解决办法
1万
查看次数

在wordpress帖子中格式化java代码

我即将写一些有一些java代码的帖子,我想通过着色java关键字来正确格式化.喜欢在日食中.我正在寻找一些使用主题/插件的建议.

谢谢,Tejas.

wordpress wordpress-plugin

4
推荐指数
1
解决办法
5562
查看次数