com.ibm.as400.access

Class AS400JPing



  • public class AS400JPing
    extends Object
    Determines if services are running on the IBM i system.

    Here is an example of calling AS400JPing within a Java program to ping the Remote Command Service:

     AS400JPing pingObj = new AS400JPing("myAS400", AS400.COMMAND, false);
     if (pingObj.ping())
         System.out.println("SUCCESS");
     else
         System.out.println("FAILED");
     
    See Also:
    JPing
    • Field Detail

      • ALL_SERVICES

        public static final int ALL_SERVICES
        Constant for pinging all the services.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AS400JPing

        public AS400JPing(String systemName)
        Constructs an AS400JPing object with the specified systemName. A JPing object created with this constructor will ping all of the services when ping() is called.
        Parameters:
        systemName - The system to ping. The systemName string can be in 3 forms: shortname (eg. "myAS400"), longname (eg. "myAS400.myCompany.com"), or IP address (eg. "9.1.2.3").
        See Also:
        AS400.getSystemName()
      • AS400JPing

        public AS400JPing(String systemName,
                  int service)
        Constructs an AS400JPing object with the specified systemName and service.
        Parameters:
        systemName - The system to ping. The systemName string can be in 3 forms: shortname (eg. "myAS400"), longname (eg. "myAS400.myCompany.com"), or IP address (eg. "9.1.2.3").
        service - The service to ping. Valid services are:
        See Also:
        AS400.getSystemName()
      • AS400JPing

        public AS400JPing(String systemName,
                  int service,
                  boolean useSSL)
        Constructs an AS400JPing object.
        Parameters:
        systemName - The system to ping. The systemName string can be in 3 forms: shortname (eg. "myAS400"), longname (eg. "myAS400.myCompany.com"), or IP address (eg. "9.1.2.3").
        service - The service to ping. Valid services are:
        useSSL - true if the pinging the SSL port for the service, false otherwise. The default is false.
        See Also:
        AS400.getSystemName()

    • Method Detail

      • ping

        public boolean ping()
        Ping the system.
        Returns:
        true if all of the services (or, if a service was specified on the constructor, the specified service) can be pinged successfully; false otherwise.
        See Also:
        pingAllServices()
      • ping

        public boolean ping(int service)
        Ping a specific service.
        Parameters:
        service - The service to ping. Valid services are:
        Returns:
        true if the service can be pinged successfully, and false otherwise.
      • pingAllServices

        public boolean pingAllServices()
        Ping all services. This method differs from ping() in that it doesn't immediately return when a failed ping is encountered, but rather continues until all services have been pinged.
        Returns:
        true if all of the services can be pinged successfully; false if at least one service cannot be pinged.
      • setPrintWriter

        public void setPrintWriter(OutputStream stream)
                            throws IOException
        Set the PrintWriter to log ping information to.
        Parameters:
        stream - The OutputStream.
        Throws:
        IOException - If an error occurs while accessing the stream.
      • setTimeout

        public void setTimeout(long time)
        Set the timeout period in milliseconds. The default timeout period is 20000 (20 seconds).
        Parameters:
        time - The timeout period.