2013-03-11 89 views
1

我使用「antcall」腳本併發調用,但出現「javax.mail。Management InstanceNotFoundException」。我設置了10個併發,有時可以是10個,有時候只有幾個可以上升。scriptlla併發問題?

<target name="PAIR_CONN"> 
     <etl debug="true"> 
      <fileset file="Pair_Conn.xml" /> 
     </etl> 
    </target> 
    <target name="pair_conn_mult"> 
     <parallel threadCount='5'> 
      <antcall target="PAIR_CONN"> 
       <param name="g_flag" value="1" /> 
      </antcall> 
      <antcall target="PAIR_CONN"> 
       <param name="g_flag" value="2" /> 
      </antcall> 
      <antcall target="PAIR_CONN"> 
       <param name="g_flag" value="3" /> 
      </antcall> 
      <antcall target="PAIR_CONN"> 
       <param name="g_flag" value="4" /> 
      </antcall> 
      <antcall target="PAIR_CONN"> 
       <param name="g_flag" value="0" /> 
      </antcall> 
     </parallel> 
    </target> 

無法註銷的mbean scriptella:類型= ETL,URL = 「文件:/informatica/infa861/oss_etl_523/src/ElectricCable/Pair_Conn.xml」 javax.management.InstanceNotFoundException:scriptella:類型= ETL, URL = 「文件:/informatica/infa861/oss_etl_523/src/ElectricCable/Pair_Conn.xml」

我認爲scriptella源代碼,該代碼已經同步,

public synchronized void register() { 
    if (name != null) { 
     throw new IllegalStateException("MBean already registered"); 
    } 
    server = getMBeanServer(); 
    String url = ctx.getScriptFileURL().toString(); 
    System.out.println("LM:"+url); 
    boolean registered = false; 
    for (int i = 0; i < 1000; i++) { 
     if (name == null || server.isRegistered(name)) { 
      registered = true; 
      name = toObjectName(url, i); 
      System.out.println("LM:"+name); 
     } else { 
      registered = false; 
      break; 
     } 
    } 
    etlThread = Thread.currentThread(); 
    if (!registered) { 
     try { 
      server.registerMBean(this, name); 
      started = new Date(); 
      LOG.info("Registered JMX mbean: " + name); 
     } catch (Exception e) { 
      throw new SystemException("Unable to register mbean " + name, e); 
     } 
    } else { 
     throw new SystemException("Unable to register mbean for url " + url + ": too many equal tasks already registered"); 
    } 
} 

什麼建議給你做這個情況?我應該嘗試什麼,或者我應該閱讀什麼才能找到解決方案?

回答

0

感謝您指出一個嚴重的錯誤。我已打開JavaForge ticket來跟蹤此問題。

正如你可以切換到<java fork="true">任務在分叉虛擬機上運行Scriptella一種解決方法,所以Ant腳本會變成這樣的事情:

<path id="scriptella.class.path"> 
    <pathelement location="../../build/scriptella.jar"/> 
</path> 
<taskdef resource="antscriptella.properties" classpathref="scriptella.class.path"/> 

<target name="PAIR_CONN"> 
    <java fork="yes" classname="scriptella.tools.launcher.EtlLauncher" classpathref="scriptella.class.path"> 
     <arg value="Pair_Conn.xml"/> 
     <arg value="-d"/> 
     <sysproperty key="g_flag" value="${g_flag}"/> 
    </java> 
</target> 


<target name="pair_conn_mult"> 
    <parallel threadCount='5'> 
     <antcall target="PAIR_CONN"> 
      <param name="g_flag" value="1" /> 
     </antcall> 
     <antcall target="PAIR_CONN"> 
      <param name="g_flag" value="2" /> 
     </antcall> 
     <antcall target="PAIR_CONN"> 
      <param name="g_flag" value="3" /> 
     </antcall> 
     <antcall target="PAIR_CONN"> 
      <param name="g_flag" value="4" /> 
     </antcall> 
     <antcall target="PAIR_CONN"> 
      <param name="g_flag" value="0" /> 
     </antcall> 
    </parallel> 
</target> 
+0

感謝您的答覆。 – 2013-03-12 05:38:46

+0

順便說一句。這個問題現在應該已經解決了。您可以通過輸入'mvn clean package'或'ant zip',從http://javaforge.com/svn/scriptella構建一個svn版本。 – ejboy 2013-03-12 07:59:02