class ExportTracker extends java.lang.Object implements SessionListener
Modifier and Type | Field and Description |
---|---|
private static java.util.HashMap<java.net.URL,java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.reflect.Method,java.util.Set<Session>>>> |
data
The tracked data.
|
private static ExportTracker |
tracker
The tracker instance, we need only one; needed to notify the tracker
when a session is closed, to remove it.
|
Modifier | Constructor and Description |
---|---|
private |
ExportTracker()
C'tor, forces a singleton.
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
extractJarName(java.net.URL url)
Extract the jar name from the given URL.
|
(package private) static ExportTracker |
getTracker()
Get the singleton tracker instance.
|
(package private) static boolean |
hasActiveSessions(java.lang.Class<?> iface)
Check if there are active sessions which have invoked an exported method
in the given class.
|
(package private) static boolean |
hasActiveSessions(java.lang.Class<?> iface,
java.lang.reflect.Method method)
Check if there are active sessions which have invoked the given method.
|
void |
initialize(Session session)
This method is called when the session is starting.
|
(package private) static java.util.Set<Session> |
listSessions(java.lang.Class<?> iface)
List the active sessions which have invoked exported methods in the
given class.
|
(package private) static java.util.Set<Session> |
listSessions(java.lang.Class<?> iface,
java.lang.reflect.Method method)
List the active sessions which have invoked the given exported method.
|
(package private) static java.util.Set<Session> |
listSessions(java.lang.String jar,
java.lang.String iface)
List the active sessions which have invoked APIs in the given jar.
|
void |
terminate(Session session)
This method is called when the session is ending.
|
(package private) static void |
trackRequest(java.lang.Class<?> iface,
java.lang.reflect.Method method,
Session session)
Track the request to the given method.
|
private static final ExportTracker tracker
private static final java.util.HashMap<java.net.URL,java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.reflect.Method,java.util.Set<Session>>>> data
static java.util.Set<Session> listSessions(java.lang.String jar, java.lang.String iface)
null
, list all active tracked sessions.jar
- The jar name; if null
, list all active tracked
sessions.iface
- The interface for which we need the sessions;
if null
, search through the entire jar.static ExportTracker getTracker()
static boolean hasActiveSessions(java.lang.Class<?> iface, java.lang.reflect.Method method)
iface
- The interface used to register the method as an API.method
- The exported method.static boolean hasActiveSessions(java.lang.Class<?> iface)
iface
- The interface used to register the method as an API.static java.util.Set<Session> listSessions(java.lang.Class<?> iface)
iface
- The interface used to register the method as an API.static java.util.Set<Session> listSessions(java.lang.Class<?> iface, java.lang.reflect.Method method)
iface
- The interface used to register the method as an API.method
- The exported method.static void trackRequest(java.lang.Class<?> iface, java.lang.reflect.Method method, Session session)
iface
- The interface used to register the method as an API.method
- The invoked exported method.session
- The sessions which is invoking the exported method.private static java.lang.String extractJarName(java.net.URL url)
url
- The jar URL.public void initialize(Session session)
initialize
in interface SessionListener
session
- The session that is starting.public void terminate(Session session)
terminate
in interface SessionListener
session
- The session that is ending.