Interface ICounterDelegator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deleteCounter​(java.lang.String counterName, boolean perforceCounter)  
      java.lang.String getCounter​(java.lang.String counterName)  
      java.lang.String getCounter​(java.lang.String counterName, CounterOptions opts)
      Get the value of a named Perforce counter from the Perforce server.
      void setCounter​(java.lang.String counterName, java.lang.String value, boolean perforceCounter)  
      java.lang.String setCounter​(java.lang.String counterName, java.lang.String value, CounterOptions opts)
      Create, set or delete a counter on a Perforce server.
    • Method Detail

      • getCounter

        java.lang.String getCounter​(java.lang.String counterName,
                                    CounterOptions opts)
                             throws P4JavaException
        Get the value of a named Perforce counter from the Perforce server. Note that this method will return a zero string (i.e. "0") if the named counter doesn't exist (rather than throw an exception); use getCounters to see if a counter actually exists before you use it.

        Note that despite their name, counters can be any value, not just a number; hence the string return value here.

        Parameters:
        counterName - non-null counter name.
        opts - CounterOptions object describing optional parameters; if null, no options are set.
        Returns:
        non-null (but possibly empty or useless) counter value associated with counterName.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.
        Since:
        2012.2
      • setCounter

        java.lang.String setCounter​(java.lang.String counterName,
                                    java.lang.String value,
                                    CounterOptions opts)
                             throws P4JavaException
        Create, set or delete a counter on a Perforce server. This method can be used to create, set, increment, or delete a counter according to the specific options set in the associated options object. Note that the increment operation does not work on servers earlier than 10.1, and that the return value is never guaranteed to be non-null -- use with caution.
        Parameters:
        counterName - non-null counter name.
        value - value the counter should be set to; can be null if the set operation is an increment.
        opts - CounterOptions object describing optional parameters; if null, no options are set.
        Returns:
        possibly-null current (post-set, post-increment) value; may be zero if the operation was a delete; may not be reliable for pre 10.1 servers.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.