Package uk.co.blackpepper.shadowtail

Examples of uk.co.blackpepper.shadowtail.StatisticException


        }
      }
      return value;
    }
    catch (ParseException x) {
      throw new StatisticException("Attribute could not be parsed as a number.", x);
    }
    catch (AttributeNotFoundException x) {
      throw new StatisticException("Attribute was not found.", x);
    }
    catch (InstanceNotFoundException x) {
      throw new StatisticException("MBean instance was not found.", x);     
    }
    catch (ReflectionException x) {
      throw new StatisticException("Could't get attribute value.", x);
    }
    catch (IOException x) {
      throw new StatisticException("Couldn't access the MBean.", x);
    }
    catch (MBeanException x) {
      throw new StatisticException("MBean's getter threw an exception.", x);
    }   
  }
View Full Code Here


   * @return value The resolved value.
   * @throws StatisticException if the object could not be resolved.
   */
  private Object resolveData(final CompositeData object, final int index) {
    if (compositeNames == null || compositeNames.size() <= index) {
      throw new StatisticException("Couldn't resolve object.");
    }
    final String name = compositeNames.get(index);
    Object value = object.get(name);
    if (value instanceof CompositeData) {
      value = resolveData((CompositeData)value, index + 1);
View Full Code Here

    assert objectName != null : "Object name cannot be null.";
    try {
      this.objectName = new ObjectName(objectName);
    }
    catch (MalformedObjectNameException x) {
      throw new StatisticException("Invalid object name.", x);
    }
  }
View Full Code Here

            candidate = null;
          }
        }
      }
      catch (IOException x) {
        throw new StatisticException("Couldn't get the file to write the statistics to.", x);
      }
      // Increment the sequence number.
      if (candidate == null) {
        // Check that we haven't exceeded the max sequence number. Prevents run away file creation.
        // For example where the stats generator is repeatedly stopped and started between each stats gathering.
        // This defaults to 999 but can be overriden. Note: we check the greater than or equal to rather than
        // just equal to since max may be changed.
        if (sequence >= maxSequenceNumber) {
          throw new StatisticException(
              "Couldn't get the file to write the statistics to. The sequence number grew too large.");
        }
        sequence++;
      }
    }
View Full Code Here

      writeStats(out);
      out.flush();
      out.close();
    }
    catch (IOException e) {
      throw new StatisticException("Couldn't write to file.", e);
    }
  }
View Full Code Here

        }
      }
      return value;
    }
    catch (ParseException x) {
      throw new StatisticException("Attribute could not be parsed as a number.", x);
    }
    catch (AttributeNotFoundException x) {
      throw new StatisticException("Attribute was not found.", x);
    }
    catch (InstanceNotFoundException x) {
      throw new StatisticException("MBean instance was not found.", x);     
    }
    catch (ReflectionException x) {
      throw new StatisticException("Could't get attribute value.", x);
    }
    catch (IOException x) {
      throw new StatisticException("Couldn't access the MBean.", x);
    }
    catch (MBeanException x) {
      throw new StatisticException("MBean's getter threw an exception.", x);
    }   
  }
View Full Code Here

   * @return value The resolved value.
   * @throws StatisticException if the object could not be resolved.
   */
  private Object resolveData(final CompositeData object, final int index) {
    if (compositeNames == null || compositeNames.size() <= index) {
      throw new StatisticException("Couldn't resolve object.");
    }
    final String name = compositeNames.get(index);
    Object value = object.get(name);
    if (value instanceof CompositeData) {
      value = resolveData((CompositeData)value, index + 1);
View Full Code Here

    assert objectName != null : "Object name cannot be null.";
    try {
      this.objectName = new ObjectName(objectName);
    }
    catch (MalformedObjectNameException x) {
      throw new StatisticException("Invalid object name.", x);
    }
  }
View Full Code Here

            candidate = null;
          }
        }
      }
      catch (IOException x) {
        throw new StatisticException("Couldn't get the file to write the statistics to.", x);
      }
      // Increment the sequence number.
      if (candidate == null) {
        // Check that we haven't exceeded the max sequence number. Prevents run away file creation.
        // For example where the stats generator is repeatedly stopped and started between each stats gathering.
        // This defaults to 999 but can be overriden. Note: we check the greater than or equal to rather than
        // just equal to since max may be changed.
        if (sequence >= maxSequenceNumber) {
          throw new StatisticException(
              "Couldn't get the file to write the statistics to. The sequence number grew too large.");
        }
        sequence++;
      }
    }
View Full Code Here

      writeStats(out);
      out.flush();
      out.close();
    }
    catch (IOException e) {
      throw new StatisticException("Couldn't write to file.", e);
    }
  }
View Full Code Here

TOP

Related Classes of uk.co.blackpepper.shadowtail.StatisticException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.