|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.tentackle.db.rmi.RemoteDbSessionImpl
public class RemoteDbSessionImpl
User session within the application server.
| Field Summary | |
|---|---|
protected static Set<WeakReference<RemoteDbSessionImpl>> |
sessions
We keep an internal set of all sessions via WeakReferences, so the sessions still will be finalized when the session isn't used anymore. |
| Fields inherited from class java.rmi.server.RemoteObject |
|---|
ref |
| Constructor Summary | |
|---|---|
RemoteDbSessionImpl(RemoteDbConnectionImpl con,
UserInfo clientInfo,
UserInfo serverInfo)
Creates a session on a given connection. |
|
| Method Summary | |
|---|---|
protected void |
cleanup(boolean crashed)
Cleanup the session. |
static void |
cleanupSessions()
Cleans up the sessions. |
void |
close()
Closes a session. |
protected void |
closeDb()
Closes the database connection (and thus rolls back any pending transaction). |
void |
finalize()
Cleanup in case someone forgot to logoff() |
RMIClientSocketFactory |
getClientSocketFactory()
Gets the default client socket factory for all delegates. |
RMIClientSocketFactory |
getClientSocketFactory(int socketConfig)
Gets the csf for a given socket type. |
UserInfo |
getClientUserInfo()
Gets the client user info. |
RemoteDbConnectionImpl |
getConnection()
Gets the server connection. |
Db |
getDb()
Gets the session db connection |
Class |
getDbObjectClass(int delegateId)
gets the DbObject class by delegateId. |
DbRemoteDelegate |
getDbRemoteDelegate()
Gets the delegate for the remote db-connection. |
int |
getPort()
Gets the default port for all delegates. |
int |
getPort(int socketConfig)
Gets the predefined port for a given socket type. |
RemoteDelegate |
getRemoteDelegate(String classname,
int delegateId)
Gets the delegate for a given classname. Per class the rmi-clients request a remote access there must be a RemoteDelegate. |
RMIServerSocketFactory |
getServerSocketFactory()
Gets the default server socket factory for all delegates. |
RMIServerSocketFactory |
getServerSocketFactory(int socketConfig)
Gets the ssf for a given socket type. |
UserInfo |
getServerUserInfo()
Gets the server user info. |
boolean |
isOpen()
Determines whether the session is open. |
void |
log(Logger.Level level,
String message)
Sends text based logging infos to the RMI-Server. |
protected Db |
openDb()
Opens a new Db. |
static void |
startCleanupThread(long ms)
Starts the optional cleanup thread that will monitor the sessions for db-activity. |
String |
toString()
Returns a String that represents the value of this remote object. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|---|
clone, exportObject, exportObject, exportObject, unexportObject |
| Methods inherited from class java.rmi.server.RemoteServer |
|---|
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
|---|
equals, getRef, hashCode, toStub |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Set<WeakReference<RemoteDbSessionImpl>> sessions
| Constructor Detail |
|---|
public RemoteDbSessionImpl(RemoteDbConnectionImpl con,
UserInfo clientInfo,
UserInfo serverInfo)
throws RemoteException
con - the connectionclientInfo - the UserInfo from the clientserverInfo - the UserInfo to establish the connection to the database server
RemoteException - if the session could not initiated.| Method Detail |
|---|
public static void cleanupSessions()
public static void startCleanupThread(long ms)
ms - is the interval in mspublic Class getDbObjectClass(int delegateId)
delegateId - the class for the delegate id
public Db getDb()
public RemoteDbConnectionImpl getConnection()
public UserInfo getClientUserInfo()
public UserInfo getServerUserInfo()
public int getPort()
public RMIClientSocketFactory getClientSocketFactory()
public RMIServerSocketFactory getServerSocketFactory()
public int getPort(int socketConfig)
socketConfig - is of SOCKETCONFIG_...
public RMIClientSocketFactory getClientSocketFactory(int socketConfig)
socketConfig - is of SOCKETCONFIG_...
public RMIServerSocketFactory getServerSocketFactory(int socketConfig)
socketConfig - is of SOCKETCONFIG_...
protected Db openDb()
throws LoginFailedException
LoginFailedException - if opening the db failedprotected void cleanup(boolean crashed)
The method is invoked whenever the session is closed due to an ordinary logout or client crash. The default implementation rolls back any pending transaction.
crashed - true if client crashed, else regular logoutprotected void closeDb()
public String toString()
java.rmi.server.RemoteObject
toString in class RemoteObjectpublic boolean isOpen()
public void finalize()
finalize in class Object
public void close()
throws RemoteException
RemoteDbSession
close in interface RemoteDbSessionRemoteException
public void log(Logger.Level level,
String message)
throws RemoteException
RemoteDbSession
log in interface RemoteDbSessionRemoteException
public RemoteDelegate getRemoteDelegate(String classname,
int delegateId)
throws RemoteException
RemoteDbSession
getRemoteDelegate in interface RemoteDbSessionclassname - is the name of classdelegateId - is the client-side ID of the delegate
RemoteException
public DbRemoteDelegate getDbRemoteDelegate()
throws RemoteException
RemoteDbSession
getDbRemoteDelegate in interface RemoteDbSessionRemoteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||