org.objectweb.speedo.runtime
Class SpeedoProxyManagerSwitch
java.lang.Object
|
+--org.objectweb.speedo.runtime.SpeedoProxyManagerSwitch
- All Implemented Interfaces:
- ProxyManagerSwitch
- public class SpeedoProxyManagerSwitch
- extends java.lang.Object
- implements ProxyManagerSwitch
This class is an implementation of the ProxyManagerSwitch based on the use
of a ThreadLocal field. This field contains an instance of ProxyManager of an
ArrayList of ProxyManager. Only bind method is synchronized in order to be
thread safe. The lookup method is not synchronized in order to increase the
efficiency. Indeed it is not necessary to synchronize the read/write
accesses. A SpeedoProxyManagerSwitch is a fractal component which have no
bindings.
- Author:
- S.Chassande-Barrioz
Field Summary |
static java.lang.String |
BIND_ERROR_MSG
|
protected java.lang.ThreadLocal |
pms
|
Method Summary |
void |
bind(ProxyManager pm)
It assignes a ProxyManager to the current context. |
void |
clear()
It clears the list of ProxyManager for the current context. |
java.util.Collection |
entries()
|
ProxyManager |
lookup(javax.jdo.PersistenceManagerFactory pmf)
|
boolean |
remove(ProxyManager pm)
It clears a ProxyManager for the current context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pms
protected java.lang.ThreadLocal pms
BIND_ERROR_MSG
public static final java.lang.String BIND_ERROR_MSG
SpeedoProxyManagerSwitch
public SpeedoProxyManagerSwitch()
lookup
public ProxyManager lookup(javax.jdo.PersistenceManagerFactory pmf)
- Specified by:
lookup
in interface ProxyManagerSwitch
- Parameters:
pmf
- is persistent manager factory which manages the returned
proxy manager.- Returns:
- the ProxyManager managed by the given persistence manager factory
and bound to current the context, or the null value if there is no
ProxyManager.
bind
public void bind(ProxyManager pm)
throws SpeedoException
- It assignes a ProxyManager to the current context.
- Specified by:
bind
in interface ProxyManagerSwitch
- Parameters:
pm
- is the ProxyManager- Throws:
SpeedoException
- is thrown when a proxy manager which has the
same PersistentManagerFactory is already bound to the current context.
clear
public void clear()
- It clears the list of ProxyManager for the current context.
- Specified by:
clear
in interface ProxyManagerSwitch
remove
public boolean remove(ProxyManager pm)
- It clears a ProxyManager for the current context.
- Specified by:
remove
in interface ProxyManagerSwitch
entries
public java.util.Collection entries()
- Specified by:
entries
in interface ProxyManagerSwitch
- Returns:
- all ProxyManager instances bound with the current context