相关疑难解决方法(0)

如何提高JAXB性能?

这是我的转换代码.当我们处理大数据时,这需要很长时间......调用方法几乎一百万次......我们可以清楚地看到它持有一段时间的线程.

请建议我一些提高性能的方法!

public class GenericObjectXMLConverter<T> {

  private T t = null;
  private static JAXBContext jaxbContext =null;
  public GenericObjectXMLConverter() {

  }
  public GenericObjectXMLConverter(T obj){
    t = obj;
  }

  protected final Logger  log = Logger.getLogger(getClass());

  /**
   * Converts the java Object and into a xml string message type.
   * @param object the object to convert
   * @return String the converted xml message as string
   */
  public String objectToXMLMessage(T object) {
    StringWriter stringWriter = new StringWriter();
    //JAXBContext jaxbContext=null;
    try {
      jaxbContext = JAXBContext.newInstance(object.getClass()); …
Run Code Online (Sandbox Code Playgroud)

jaxb

3
推荐指数
2
解决办法
9579
查看次数

标签 统计

jaxb ×1