Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save local connector address in Attach API code #2951

Merged
merged 1 commit into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ static Properties getAgentProperties() {
"sun.jvm.flags", //$NON-NLS-1$
"sun.java.command" //$NON-NLS-1$
};
Attachment.saveLocalConnectorAddress();
//If we don't have a local connector address, just continue and get the others
Properties agentProperties = new Properties();
for (String pName: agentPropertyNames) {
String pValue = com.ibm.oti.vm.VM.getVMLangAccess().internalGetProperties().getProperty(pName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,14 @@ private static String startLocalAgent() throws IbmAttachOperationFailedException
throw new IbmAttachOperationFailedException("startLocalManagementAgent error starting agent:" + e.getClass() + " " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
}

String addr = saveLocalConnectorAddress();
if (Objects.isNull(addr)) {
throw new IbmAttachOperationFailedException("startLocalManagementAgent: " + LOCAL_CONNECTOR_ADDRESS + " not defined"); //$NON-NLS-1$ //$NON-NLS-2$
}
return addr;
}

static String saveLocalConnectorAddress() {
Properties systemProperties = com.ibm.oti.vm.VM.getVMLangAccess().internalGetProperties();
String addr;
synchronized (systemProperties) {
Expand All @@ -419,9 +427,9 @@ private static String startLocalAgent() throws IbmAttachOperationFailedException
}
}
if (Objects.isNull(addr)) {
/* startLocalAgent() should have set the property. */
/* property should be set at this point */
IPC.logMessage(LOCAL_CONNECTOR_ADDRESS + " not set"); //$NON-NLS-1$
throw new IbmAttachOperationFailedException("startLocalManagementAgent: " + LOCAL_CONNECTOR_ADDRESS + " not defined"); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
IPC.logMessage(LOCAL_CONNECTOR_ADDRESS + "=", addr); //$NON-NLS-1$
return addr;
Expand Down