| java.lang.Object org.objectweb.jonas_ejb.container.JFactory org.objectweb.jonas_ejb.container.JEntityFactory
All known Subclasses: org.objectweb.jonas_ejb.container.jorm.JormFactory,
JEntityFactory | public class JEntityFactory extends JFactory implements TimerService(Code) | | author: coqp author: TODO To change the template for this generated type comment go to author: Window - Preferences - Java - Code Style - Code Templates |
Method Summary | |
public synchronized void | bindEJB(Object pk, JEntitySwitch bs) | public int | calculateAutomaticPk() | public void | checkTransaction(RequestCtx rctx) Check Transaction before calling a method on a bean. | protected JEntityContext | createNewContext(EntityBean bean) | protected JEntityContext | createNewInstance(JEntitySwitch es) Create a new instance of the bean and its EntityContext
In case of CMP, the bean class is derived to manage entity persistence. | public Timer | createTimer(long arg0, Serializable arg1) | public Timer | createTimer(long arg0, long arg1, Serializable arg2) | public Timer | createTimer(Date arg0, Serializable arg1) | public Timer | createTimer(Date arg0, long arg1, Serializable arg2) | public Serializable | decodePK(Serializable strpk) Decode PK. | public boolean | dirtyInstances() | public void | dummyFinderException(boolean dummy) | public Serializable | encodePK(Serializable pk) Encode PK. | public synchronized JEntitySwitch | existEJB(Object pk, JEntitySwitch bs) get EJB by its PK. | public int | getCacheSize() | public int | getCurrentWaiters() | public Object | getDataSource() | public int | getDeadlockTimeout() | public synchronized JEntitySwitch | getEJB(Object pk) get EJB by its PK
Creates if not exist yet. | public synchronized EntityCounters | getEntityCounters() | public JHome | getHome() | public int | getInactivityTimeout() | public JEntityContext | getJContext(JEntitySwitch es) Get a Context from the pool, or create a new one if no more
available in the pool. | public JEntitySwitch | getJEntitySwitch() This method allocates a new JEntitySwitch. | public JLocalHome | getLocalHome() | public int | getLockPolicy() | public int | getMaxWaitTime() | public int | getPassivationTimeout() | public int | getPoolSize() | public int | getReadTimeout() | public boolean | getSelectForUpdate() | public TimerService | getTimerService() | public Collection | getTimers() | public void | init(EntityDesc dd, JContainer cont) | public void | initInstancePool() | public boolean | isCMP2() | public boolean | isDeadLocked(Transaction suspect) | public boolean | isHardLimit() | public boolean | isPrefetch() | public boolean | isReentrant() | public boolean | isShared() | public boolean | rebindEJB(Transaction tx, JEntityContext bctx, Object pk) | public void | reduceCache() | public boolean | registerContext(Transaction tx, JEntityContext ec) Register a Context/Instance in the transaction. | public synchronized void | registerEJB(JEntitySwitch ejb) Register an EntitySwitch in the dirty list. | public void | releaseJContext(JContext ctx, int poolaction) | public void | releaseJContext(JContext ctx) | public synchronized void | removeEJB(Object pk) | public void | removeTxListener(Transaction tx) Remove a Transaction Listener from the list. | public void | setDeadlockTimeout(int i) | public void | setInactivityTimeout(int i) | public void | setMaxWaitTime(int sec) | public void | setPassivationTimeout(int i) | public void | stop() stop this EJB. | public void | storeInstances(Transaction tx) | public void | syncDirty(boolean alwaysStore) Synchronize all dirty instances
Does nothing if not CS policy. | public void | syncForFind(Transaction tx) synchronize data modified in this transaction. | public void | syncForSelect() synchronize data modified in the current transaction. | public void | synchronizeEntities() | public boolean | tooManyInstances() | public void | unregisterContext(Transaction tx, JEntityContext ec) Unregister a Context/Instance in the transaction. |
bctxlist | protected List bctxlist(Code) | | freelist of JEntityContext's
|
cmp2 | protected boolean cmp2(Code) | | True if CMP2 container
|
datasource | protected Object datasource(Code) | | Datasource in case of CMP
|
hardLimit | protected boolean hardLimit(Code) | | True if cannot overtake max-cache-size
|
instanceCount | protected int instanceCount(Code) | | Current number of instances in memory
|
lockPolicy | protected int lockPolicy(Code) | | lock policy
|
prefetch | protected boolean prefetch(Code) | | enable the prefetch for CMP2 bean
|
readTimeout | protected int readTimeout(Code) | | Number of seconds before reading again instances for read-only.
|
reentrant | protected boolean reentrant(Code) | | reentrant if instance can be used concurrently
|
shared | protected boolean shared(Code) | | shared if the EJB container is not the only one to modify
the bean state on the database, or if a cluster of container
access the bean concurrently.
|
txlist | protected HashMap txlist(Code) | | List of Transaction Listeners.
At each Transaction is associated a TxListener object
|
JEntityFactory | public JEntityFactory()(Code) | | constructor must be without parameters (required by Jorm)
|
bindEJB | public synchronized void bindEJB(Object pk, JEntitySwitch bs)(Code) | | Bind a PK with a JEntitySwitch
Parameters: pk - The Primary Key Object Parameters: bs - The JEntitySwitch |
calculateAutomaticPk | public int calculateAutomaticPk()(Code) | | Calculate a new uid for automatic pk creation Used by JEntityCmpJdbc.vm
int (unique pk) |
checkTransaction | public void checkTransaction(RequestCtx rctx)(Code) | | Check Transaction before calling a method on a bean. For Entity beans,
the only possible case is "Container Managed Tx"
Parameters: rctx - The Request Context |
createNewInstance | protected JEntityContext createNewInstance(JEntitySwitch es) throws Exception(Code) | | Create a new instance of the bean and its EntityContext
In case of CMP, the bean class is derived to manage entity persistence.
JEntityContext throws: Exception - cannot instantiate bean |
dirtyInstances | public boolean dirtyInstances()(Code) | | true if dirty list is not emptyOnly used for CS policy (non transacted modifying methods) |
dummyFinderException | public void dummyFinderException(boolean dummy) throws FinderException(Code) | | Dummy method that defines the FinderException in the throws clause
to can catch this exception in any case in the JentityHome.vm
Parameters: dummy - if true do nothing, else throw the FinderException throws: FinderException - if dummy is false |
existEJB | public synchronized JEntitySwitch existEJB(Object pk, JEntitySwitch bs)(Code) | | get EJB by its PK. If not exist yet, map the EntitySwitch to the PK.
Parameters: pk - The Primary Key Object Parameters: bs - the Entityswitch The JEntitySwitch matching the PK, or null if none exist. |
getCacheSize | public int getCacheSize()(Code) | | current cache size |
getCurrentWaiters | public int getCurrentWaiters()(Code) | | current number of instance waiters |
getDataSource | public Object getDataSource()(Code) | | the Datasource used for CMP |
getDeadlockTimeout | public int getDeadlockTimeout()(Code) | | deadlock timeout in sec. |
getEJB | public synchronized JEntitySwitch getEJB(Object pk)(Code) | | get EJB by its PK
Creates if not exist yet.
Parameters: pk - The Primary Key Object The JEntitySwitch matching the PK. |
getEntityCounters | public synchronized EntityCounters getEntityCounters()(Code) | | Take a dump of current entity counters and return them
EntityCounters |
getHome | public JHome getHome()(Code) | | the home if it exists |
getInactivityTimeout | public int getInactivityTimeout()(Code) | | inactivity timeout in sec. |
getJContext | public JEntityContext getJContext(JEntitySwitch es)(Code) | | Get a Context from the pool, or create a new one if no more
available in the pool.
This JContext must be initialized then by the caller.
a JEntityContext, not initialized. |
getJEntitySwitch | public JEntitySwitch getJEntitySwitch()(Code) | | This method allocates a new JEntitySwitch. But no association has been
done between the primary key and the new JEntitySwitch. Therefore the
initialisation is not done.
The JEntitySwitch. |
getLockPolicy | public int getLockPolicy()(Code) | | lockPolicy |
getMaxWaitTime | public int getMaxWaitTime()(Code) | | waiter timeout in seconds |
getPassivationTimeout | public int getPassivationTimeout()(Code) | | passivation timeout in sec. |
getPoolSize | public int getPoolSize()(Code) | | the Instance pool size for this Ejb |
getReadTimeout | public int getReadTimeout()(Code) | | read timeout in sec. |
getSelectForUpdate | public boolean getSelectForUpdate()(Code) | | true if the bean is shared |
getTimerService | public TimerService getTimerService()(Code) | | Obtains the TimerService associated for this Bean
a JTimerService instance. |
init | public void init(EntityDesc dd, JContainer cont)(Code) | | Init this object
Parameters: dd - the deployment descriptor Parameters: cont - the Container |
initInstancePool | public void initInstancePool()(Code) | | Init the pool of instances
|
isCMP2 | public boolean isCMP2()(Code) | | true if CMP2 container |
isDeadLocked | public boolean isDeadLocked(Transaction suspect)(Code) | | Search if this transaction is blocked in a deadlock
Parameters: suspect - Transaction suspected to block everybody True if a deadlock has been detected. |
isHardLimit | public boolean isHardLimit()(Code) | | true if hard limit for max-cache-size |
isPrefetch | public boolean isPrefetch()(Code) | | true if prefetch enable |
isReentrant | public boolean isReentrant()(Code) | | true if reentrant |
isShared | public boolean isShared()(Code) | | true if shared |
rebindEJB | public boolean rebindEJB(Transaction tx, JEntityContext bctx, Object pk)(Code) | | rebind a PK with a JEntitySwitch (called by create methods)
Parameters: tx - current Transaction Parameters: bctx - The EntityContext Parameters: pk - The Primary Key Object true if bs has been added to the PK list. |
reduceCache | public void reduceCache()(Code) | | Reduce number of instances in memory
passivate all instances that are not busy and not used very recently
|
registerContext | public boolean registerContext(Transaction tx, JEntityContext ec) throws IllegalStateException(Code) | | Register a Context/Instance in the transaction.
Parameters: tx - current Transaction Parameters: ctx - JEntityContext to be registered true if instance has been registered. |
registerEJB | public synchronized void registerEJB(JEntitySwitch ejb)(Code) | | Register an EntitySwitch in the dirty list.
should be called each time a new instance is modified outside transaction
Parameters: ejb - The Entity Switch to be registered |
releaseJContext | public void releaseJContext(JContext ctx, int poolaction)(Code) | | Release a Context
Parameters: ctx - - The JContext to release. Parameters: poolaction - 0=never pool, 1=pool if < MinPoolSize, 2=pool if < MaxCacheSize |
releaseJContext | public void releaseJContext(JContext ctx)(Code) | | Release a Context [deprecated]
Parameters: ctx - - The JContext to release. |
removeEJB | public synchronized void removeEJB(Object pk)(Code) | | remove an EJB by its PK
Parameters: pk - The Primary Key Object |
removeTxListener | public void removeTxListener(Transaction tx)(Code) | | Remove a Transaction Listener from the list.
Parameters: tx - the Transaction to remove |
setDeadlockTimeout | public void setDeadlockTimeout(int i)(Code) | | Set the deadlock timeout (jonas admin)
Not used today
|
setInactivityTimeout | public void setInactivityTimeout(int i)(Code) | | Set the inactivity timeout (jonas admin)
Not used today
|
setMaxWaitTime | public void setMaxWaitTime(int sec)(Code) | | Parameters: sec - max time to wait for a connection, in seconds |
setPassivationTimeout | public void setPassivationTimeout(int i)(Code) | | Set the passivation timeout (jonas admin)
Not used today
|
stop | public void stop()(Code) | | stop this EJB.
Mainly unregister it in JNDI.
|
syncDirty | public void syncDirty(boolean alwaysStore)(Code) | | Synchronize all dirty instances
Does nothing if not CS policy.
Parameters: alwaysStore - True if we want to store modify instanceseven if passivation timeout is not reached. |
syncForFind | public void syncForFind(Transaction tx)(Code) | | synchronize data modified in this transaction.
this is necessary in case of finder method, because
ejb-ql looks for on disk.
Parameters: tx - the Transaction |
syncForSelect | public void syncForSelect()(Code) | | synchronize data modified in the current transaction.
this is necessary in case of select method, because
ejb-ql looks for on disk.
|
synchronizeEntities | public void synchronizeEntities()(Code) | | Ask swapper to synchronize all dirty EntitySwitch
Only used for container-serialized policy
|
tooManyInstances | public boolean tooManyInstances()(Code) | | true if max-cache-size has been reached |
unregisterContext | public void unregisterContext(Transaction tx, JEntityContext ec) throws IllegalStateException(Code) | | Unregister a Context/Instance in the transaction.
Parameters: tx - current Transaction Parameters: ctx - JEntityContext to be registered |
|
|