小编Ram*_*mki的帖子

使用Ehcache的WebApp会话管理

在我的项目中,我使用ehcache存储登录的用户详细信息和一些其他信息(哪个应用程序将在运行时使用它而不是从db获取).以下是我的ehcache配置:

<cache 
    name="normalCache"
    maxElementsInMemory="50000" 
    eternal="false"
    timeToIdleSeconds="1800" 
    timeToLiveSeconds="0"
    overflowToDisk="false"
    memoryStoreEvictionPolicy="LRU"
/>
Run Code Online (Sandbox Code Playgroud)

但问题是会话超时发生的大部分时间(即使用户不是非活动状态> 30).有时会发生10分钟,......

所有操作都将尝试从ehcache的每个请求中检索用户对象.

我不确定ehcache将如何确定到期时间.

java session web-applications ehcache session-management

6
推荐指数
2
解决办法
3687
查看次数

Apache Camel concurrentConsumers vs threads

i spent almost two days to understand the concept concurrentConsumers vs threads in Apache Camel. but i really don't understand the concept. could anyone help me to understand the concept. I am using camel 2.12.0.

   from("jms:queue:start?concurrentConsumers=5")
   .threads(3, 3, "replyThread")
   .bean(new SomeBean());

   pom.xml
   ==========================================  
   <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <camel.version>2.12.0</camel.version>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>

    <!-- required by both client and server -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jms</artifactId>
        <version>${camel.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-test</artifactId> …
Run Code Online (Sandbox Code Playgroud)

apache-camel

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

事务方法中的显式flush()将更新数据库

在我的应用程序中,我有一个服务层,其中为此服务中的所有方法声明了spring事务边界.服务层内部联系dao.这里我的问题是如果在dao方法中指定getHibernateTemplate.flush(),它会立即更新数据库,或者直到服务层方法完成,它不会提交更改.请帮帮我.

class someservice{
   public void somemethod(){
     activitydao.save(domainobj);
   }
}
class ActivityDAO extends HibernateDaoSupport{
public void save(domainobj){
  getHibernateTemplate().save(domainobj);
  getHibernateTemplate().flush(); ----> will it update db immediately ?
}
}
Run Code Online (Sandbox Code Playgroud)

谢谢,拉姆基.

hibernate

2
推荐指数
1
解决办法
6193
查看次数

密码规则的正则表达式

我需要密码规则.以下是规则.

密码必须遵循以下准则:

  • 至少八个字符
  • 包含以下4个选项中的3个:小写字母,大写字母,数字或特殊字符
  • 当用户指定不符合上述规则的密码时,请返回以下消息:

    密码长度必须至少为8个字符,并包含以下4个选项中的3个:

    • 小写字母(az)
    • 大写字母(AZ)
    • 号码(0-9)
    • 特殊字符(!@#$%^&')

请帮我得到一个正则表达式来处理上述条件.

我感谢你的帮助.以下是我的要求的解决方案

if(password.matches("^(?=.*[0-9]).{1,}$")){
validCount++;
}
if(password.matches("^(?=.*[a-z]).{1,}$")){
validCount++;
}
if(password.matches("^(?=.*[A-Z]).{1,}$")){
validCount++;
}
if(password.matches("^(?=.*[@#$%^&+=]).{1,}$")){
validCount++;
}
return validCount >= 3 ? true : false;
Run Code Online (Sandbox Code Playgroud)

谢谢,拉姆基

regex

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