public class ISeriesNetServerSession
extends java.lang.Object
implements java.io.Serializable
Note: A session (represented by this class) corresponds to a workstation. A workstation could be a Windows Terminal Server or it could be a single PC on someone's desktop. A connection (represented by class NetServerConnection) corresponds to a specific user who has mapped a drive and has files opened or spooled output on a print queue. Since a session can have multiple users, a connection shows a particular user's statistics on that session.
ISeriesNetServerSession objects are created and returned by listSessions() and listSessionsForWorkstation().
import com.ibm.as400.access.*;
// Create an ISeriesNetServer object for a specific system.
AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");
ISeriesNetServer ns = new ISeriesNetServer(system);
try
{
// List all current sessions.
System.out.println("Sessions:");
ISeriesNetServerSession[] sessionList = ns.listSessions();
for (int i=0; i<sessionList.length; i++)
{
ISeriesNetServerSession session = sessionList[i];
System.out.println(session.getName() + ": " +
session.getUserName() + "; " +
session.getAge() + "; " +
session.isGuest() );
}
}
catch (AS400Exception e) {
AS400Message[] messageList = e.getAS400MessageList();
for (int i=0; i<messageList.length; i++) {
System.out.println(messageList[i].getText());
}
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (system != null) system.disconnectAllServices();
}
| Modifier and Type | Method and Description |
|---|---|
int |
getAge()
Returns the number of seconds that the session has been active.
|
long |
getID()
Returns the unique identifier for the system session.
|
int |
getIdleTime()
Returns the number of seconds the session has been idle.
|
java.lang.String |
getName()
Returns the name of the workstation from which the session to the system was established.
|
int |
getNumberOfConnections()
Returns the number of connections made during the session.
|
int |
getNumberOfFilesOpen()
Returns the number of files that are currently open for the session.
|
java.lang.String |
getUserName()
Returns the name of the user that is associated with the session.
|
boolean |
isGuest()
Indicates whether or not the session is a guest session.
|
boolean |
isPasswordEncrypted()
Indicates whether or not the encrypted password was used to establish the session.
|
public java.lang.String getName()
public long getID()
public int getNumberOfConnections()
public int getAge()
public int getNumberOfFilesOpen()
public int getIdleTime()
public boolean isPasswordEncrypted()
public boolean isGuest()
public java.lang.String getUserName()