|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
wt.method.MethodContext
Context corresponding to an active method invocation in the method server. This class maintains an association between threads and resources currently assigned to the threads such as a database connections.
This class extends java.util.Hashtable
so it can be used to maintain thread
local storage that pertains to a particular method invocation. Methods are free to store
whatever values they need under unique keys with confidence that the references will be
freed when this context is unregistered.
For RMI calls, it is created immediately before argument unmarshaling begins and is
unregisted after the reply has been marshaled back to the client. For non-RMI contexts
(CORBA or internal), the context must be explicitly constructed and unregistered.
Supported API: true
Extendable: false
Nested Class Summary |
Nested classes inherited from class java.util.Hashtable |
|
Field Summary | |
private String |
accessLogDetail
|
private MethodArgs |
args
|
private Object |
authentication
|
private static int |
boostedCount
|
private PropertyChangeSupport |
changeSupport
|
private String |
clientHost
|
private Object |
connection
|
private static Hashtable |
contexts
|
private static POMHandlerIfc |
defaultPomHandler
|
Object |
effectivePrincipal
Convenience slot for efficient per-thread retrieval of effective principal. |
private static MethodContext |
head
|
private long |
id
|
private static MethodContext |
lastBoosted
|
private static boolean |
MANAGE_THREAD_PRIORITIES
|
private MethodContext |
next
|
private static long |
nextId
|
private static boolean |
NOT_UNREGISTERED_TRACEBACK
|
private static int |
NUMBER_PRIORITY_THREADS
|
private static String |
POM_HANDLER
|
private static Object |
POM_HANDLER_KEY
|
private POMHandlerIfc |
pomHandler
|
private MethodContext |
prev
|
private static MethodContext |
previous
|
static String |
REGISTERED
Key for property reflecting whether the context is registered (active). |
private Exception |
registerTraceback
|
private static String |
RESOURCE
|
private ObjectOutput |
resultOutputStream
|
Object |
sessionContext
Convenience slot for efficient per-thread retrieval of session context. |
private static int |
SYNCH_VERBOSE_THRESHOLD
|
private static MethodContext |
tail
|
(package private) Thread |
thread
|
private static int |
total
|
private static String |
USER_NAME_KEY
|
private static boolean |
VERBOSE
|
Fields inherited from class java.util.Hashtable |
|
Constructor Summary | |
private |
MethodContext()
|
(package private) |
MethodContext(MethodArgs method_args)
Constructor used while RMI method arguments are being unmarshaled. |
|
MethodContext(String client_host,
Object authentication)
Public constructor for use by non-RMI threads Associates the current thread with a new context. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
clearConnection()
Clear datastore connection associated with this context without returning it to free pool. |
void |
freeConnection()
Free datastore connection associated with this context, making it available for other threads. |
String |
getAccessLogDetail()
Get detail message for access log. |
static int |
getActiveCount()
Get the total number of currently active method contexts. |
Object[] |
getArgObjects()
Get the argument array for the method invoked by this context. |
Class[] |
getArgTypes()
Get the argument class array for the method invoked by this context. |
Object |
getAuthentication()
Get the authentication object associated with this context. |
String |
getClientHost()
Get the client host name for this context. |
Object |
getConnection()
Get datastore connection associated with this method context. |
static MethodContext |
getContext()
Get the current thread's method context. |
static MethodContext |
getContext(long id)
Get the method context with the given id. |
static MethodContext |
getContext(Thread thread)
Get the method context for the given thread. |
private POMHandlerIfc |
getCurrentPomHandler()
|
static POMHandlerIfc |
getDefaultPomHandler()
Get default POM handler. |
long |
getId()
Get the id of this context. |
static Enumeration |
getKeys()
Get an Enumeration of all MethodContext keys. |
MethodArgs |
getMethodArgs()
Get the RMI method arguments associated with this context. |
Object |
getPom()
Get PersistentObjectManager associated with this context. |
static POMHandlerIfc |
getPomHandler()
Get POM handler for the current WTContext . |
(package private) ObjectOutput |
getResultOutputStream()
Get the result marshalling object output stream. |
String |
getTargetClassName()
Get the name of the target class invoked by this context. |
String |
getTargetMethodName()
Get the name of the target method invoked by this context. |
Object |
getTargetObject()
Get the target object of the method invoked by this context. |
static int |
getTotalConnections()
Get the total number of datastore connections associated with the POM handler for the current WTContext . |
static int |
getTotalCount()
Get the total number of method contexts that have existed. |
String |
getUserName()
|
void |
interrupt()
Interrupt thread corresponding to this context Supported API: false |
Object |
put(Object key,
Object value)
Override Hashtable.put to add property change support. |
private void |
register()
|
Object |
remove(Object key)
Override Hashtable.remove to add property change support. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
boolean |
sendFeedback(MethodFeedback feedback)
Send feedback objects to RMI client while call is being processed A return value of false indicates that the client has disconnected. |
void |
setAccessLogDetail(String detail)
Set detail message for access log. |
void |
setAllowRedirect(boolean flag)
Set whether or not the call corresponding to this context can be redirected for load leveling purposes. |
void |
setAuthentication(Object auth)
Set the authentication object associated with this context. |
void |
setConnection(Object connection)
Set datastore connection associated with this context. |
static void |
setDefaultPomHandler(POMHandlerIfc pom_handler)
Set default POM handler that applies to all WTContext . |
static void |
setPomHandler(POMHandlerIfc pom_handler)
Set POM handler for the current WTContext . |
private static void |
setPriority(Thread thread,
int priority)
|
(package private) void |
setResultOutputStream(ObjectOutput output_stream)
Set the result marshalling object output stream for use when sending feedback. |
void |
setThread(Thread thread)
Set the thread associated with this context. |
void |
unregister()
Unregister this method context. |
static void |
unregisterDeadContexts()
Unregister any method contexts corresponding to terminated threads. |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final boolean VERBOSE
private static final boolean MANAGE_THREAD_PRIORITIES
private static final int NUMBER_PRIORITY_THREADS
private static final String POM_HANDLER
private static final boolean NOT_UNREGISTERED_TRACEBACK
private static final MethodContext head
private static final MethodContext tail
private static MethodContext lastBoosted
private static int boostedCount
private static final String USER_NAME_KEY
private static int SYNCH_VERBOSE_THRESHOLD
public static String REGISTERED
private static final Object POM_HANDLER_KEY
private static POMHandlerIfc defaultPomHandler
private static final Hashtable contexts
private static int total
private static MethodContext previous
private static long nextId
private long id
Thread thread
private MethodArgs args
private String clientHost
private Object authentication
private ObjectOutput resultOutputStream
private POMHandlerIfc pomHandler
private Object connection
private PropertyChangeSupport changeSupport
private String accessLogDetail
private MethodContext prev
private MethodContext next
private Exception registerTraceback
public Object sessionContext
public Object effectivePrincipal
Constructor Detail |
private MethodContext()
MethodContext(MethodArgs method_args) throws ServerNotActiveException
method_args
- the RMI MethodArgs object being unmarshalledpublic MethodContext(String client_host, Object authentication)
client_host
- calling client hostname - may be needed to validate authenticationauthentication
- opaque authentication objectAuthenticator
Method Detail |
private void register()
public void unregister()
private static void setPriority(Thread thread, int priority)
public static void unregisterDeadContexts()
public void setThread(Thread thread)
thread
- the thread for this contextpublic static MethodContext getContext()
public static MethodContext getContext(long id)
public static MethodContext getContext(Thread thread)
public long getId()
public MethodArgs getMethodArgs()
public String getTargetMethodName()
public String getTargetClassName()
public Object getTargetObject()
public Object[] getArgObjects()
public Class[] getArgTypes()
public String getClientHost()
public Object getAuthentication()
public void setAuthentication(Object auth)
void setResultOutputStream(ObjectOutput output_stream)
ObjectOutput getResultOutputStream()
public static int getActiveCount()
public static int getTotalCount()
public boolean sendFeedback(MethodFeedback feedback)
feedback
- the feedback object
public void interrupt()
public void setAllowRedirect(boolean flag)
public String getAccessLogDetail()
public void setAccessLogDetail(String detail)
detail
- messagepublic static POMHandlerIfc getPomHandler()
WTContext
.
The POM handler is responsible for getting and freeing database
connections on behalf of a WTContext
. If not explicitly
set for the current WTContext
, the default handler is
returned.
public static void setPomHandler(POMHandlerIfc pom_handler)
WTContext
.
The POM handler is responsible for getting and freeing database
connections. Setting to null causes use of default POM handler.
public static POMHandlerIfc getDefaultPomHandler()
public static void setDefaultPomHandler(POMHandlerIfc pom_handler)
WTContext
.
Setting to null causes class default to be used.
private POMHandlerIfc getCurrentPomHandler()
public Object getPom() throws Exception
Exception
- any exception thrown by POMHandler.getPom
public Object getConnection() throws Exception
Exception
- any exception thrown by POMHandler.getConnection
public void freeConnection()
public void setConnection(Object connection)
public void clearConnection()
public static int getTotalConnections()
WTContext
.
public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to the listener list.
Property change events will be fired to all registered listeners whenever a
value in this hashtable is added, changed, or removed.
listener
- the PropertyChangeListener
to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener list.
listener
- the PropertyChangeListener
to be removedpublic Object put(Object key, Object value)
Hashtable.put
to add property change support.
key
- the hashtable keyvalue
- the value
Hashtable
public Object remove(Object key)
Hashtable.remove
to add property change support.
key
- the key that needs to be removed
Hashtable
public String getUserName()
public static Enumeration getKeys()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |