How to implement cache in ejb 3.0?

I have a client that is stuck in an EJB 3.0 environment. No @Singleton, no bean -managed concurrency: - (

Given that flow control and synchronization are prohibited by the ejb specification, how to implement the cache? Essentially, I want an unsynchronized object cache for some expensive operations.

+4
source share
4 answers

The limitation of static field usage and synchronization is specified in chapter 21.1.2 of the EJB 3.0 specification. It also explains why.

• bean /. . , bean .

, EJB JVM bean, JVM.

• bean .

, . EJB bean JVM.

POJO, , JVM , EJB- EJB JVM, , .

,

  • , . , WebLogic GlassFish JVM.
  • , . "".

, , EJB, . Redis Hazelcast.

+1

, ! weblogic eclipselink.

eclipselink JPA EJB, :

@Entity
@Cache(type=CacheType.SOFT)

, persistence.xml. ( oracle doc):

<persistence-unit name="XYZ">
...
    <class>com.stack.Test</class>
    <properties>
        ...
        <property name="toplink.cache.type.default" value="Soft"/>
        ...
    </properties>
</persistence-unit>

Soft, Hard, Weak, Full .. . .

0

EJB? int , . , , , .

@Stateful bean, ( ). .

0
source

Well, I think ConcurrentSkipListMap might be the solution: no synchronization, but still unsafe.

0
source

All Articles