避免使用已淘汰的指令管理程式方法

此規則會標示下列已淘汰的方法:

CommandMgrInitializer 方法在 WebSphere Application Server 6.0 版中已淘汰,CommandMgr 方法在 7.0 版中已淘汰。 它們可能在將來的版本中移除。

對於這四個方法,請全部改用 CommandMgr.getCommandMgr(AdminClient)

在原始檔掃描器中,快速修正程式會將已淘汰的方法變更為偏好的方法。 如果有 com.ibm.websphere.management.cmdframework.CommandMgr 類別的匯入項目,快速修正程式會在取代項目中使用簡式類別名稱 (CommandMgr)。 如果找不到匯入項目,就會使用完整名稱 (com.ibm.websphere.management.cmdframework.CommandMgr)。

範例:

import com.ibm.websphere.management.cmdframework.*;
public class MyClass {
// some code
CommandMgrInitializer.initializeLocalMode();
// some code
}

前述範例將變更成:

import com.ibm.websphere.management.cmdframework.*;
public class MyClass {
// some code
CommandMgr.getCommandMgr();
// some code
}

如果前述範例中的 import 陳述式為 import com.ibm.websphere.management.cmdframework.CommandMgrInitializer;,則更新的程式碼將是:
import com.ibm.websphere.management.cmdframework.CommandMgrInitializer;
public class MyClass {
// some code
com.ibm.websphere.management.cmdframework.CommandMgr.getCommandMgr();
// some code
}

如需類別的相關資訊,請參閱

在 說明文件中。

完整 已淘汰的 API 清單位於說明文件中。