Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.common.io.xfile.ftp
Class FtpSessionPool  view FtpSessionPool download FtpSessionPool.java

java.lang.Object
  extended bycom.flexstor.common.io.xfile.ftp.FtpSessionPool

public class FtpSessionPool
extends java.lang.Object


Field Summary
private static java.util.Hashtable hashAvailableSessions
          Collection of available ftp sessions.
private static java.util.Hashtable hashBusySessions
          Collection of busy ftp sessions.
static int nSessionCount
          Keep a count of all sessions, user called as wel as intermidiatory.
private static int sessionId
          Id to be assigned to every new session created.
static java.lang.String strFTPPassword
          FTP password which is stored as user preference.
static java.lang.String strFTPUserId
          FTP user id which is stored as user preference.
 
Constructor Summary
FtpSessionPool()
           
 
Method Summary
static void closeAllSessions()
          Must be called when the client shuts down.
private static void closeAllSessions(java.lang.String strServerName, java.lang.String strServerPort)
          Remember this this ID represents collection of sessions not just one session.
static void closeSession(FtpSession ftpSession)
          Its a single specific ftp session.
static FtpSession getNewSession(java.lang.String serverName, int serverPort)
          Creates, connects and returns a new ftp session.
static FtpSession getSession(java.lang.String serverName, int serverPort)
          Creates, Connects and returns a ftp session.
static int getTotalAvailableSessions()
          Returns total number of available sessions.
static int getTotalBusySessions()
          Returns total number of busy sessions.
static int getTotalSessions()
          Returns total number of sessions.
private static FtpSession makeNewSession(java.lang.String serverName, int serverPort)
          Creates a new session, connects it and returns it.
static void releaseSession(FtpSession ftpSesstion)
          It would just free the session, and NOT log out, so that it can be reused.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionId

private static int sessionId
Id to be assigned to every new session created.


hashAvailableSessions

private static java.util.Hashtable hashAvailableSessions
Collection of available ftp sessions.


hashBusySessions

private static java.util.Hashtable hashBusySessions
Collection of busy ftp sessions.


nSessionCount

public static int nSessionCount
Keep a count of all sessions, user called as wel as intermidiatory.


strFTPUserId

public static java.lang.String strFTPUserId
FTP user id which is stored as user preference.


strFTPPassword

public static java.lang.String strFTPPassword
FTP password which is stored as user preference.

Constructor Detail

FtpSessionPool

public FtpSessionPool()
Method Detail

getSession

public static FtpSession getSession(java.lang.String serverName,
                                    int serverPort)
                             throws java.net.UnknownHostException,
                                    java.io.IOException
Creates, Connects and returns a ftp session. If it is not found in available pool a new ftp session is created and returned.


releaseSession

public static void releaseSession(FtpSession ftpSesstion)
It would just free the session, and NOT log out, so that it can be reused.


getTotalBusySessions

public static int getTotalBusySessions()
Returns total number of busy sessions.


getTotalAvailableSessions

public static int getTotalAvailableSessions()
Returns total number of available sessions.


getTotalSessions

public static int getTotalSessions()
Returns total number of sessions.


closeSession

public static void closeSession(FtpSession ftpSession)
                         throws java.io.IOException
Its a single specific ftp session.


closeAllSessions

public static void closeAllSessions()
                             throws java.io.IOException
Must be called when the client shuts down.


getNewSession

public static FtpSession getNewSession(java.lang.String serverName,
                                       int serverPort)
                                throws java.net.UnknownHostException,
                                       java.io.IOException
Creates, connects and returns a new ftp session. Note that this kind of session would not be maintained by the pool. The caller should be responsible to maintain and close it.


makeNewSession

private static FtpSession makeNewSession(java.lang.String serverName,
                                         int serverPort)
                                  throws java.net.UnknownHostException,
                                         java.io.IOException
Creates a new session, connects it and returns it.


closeAllSessions

private static void closeAllSessions(java.lang.String strServerName,
                                     java.lang.String strServerPort)
                              throws java.io.IOException
Remember this this ID represents collection of sessions not just one session.