Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 87259 Details for
Bug 186080
JVMTI Profiler blocks JVM Initialization in "enabled" mode if the Agent Controller is not running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
patch10.txt (text/plain), 12.48 KB, created by
Alexander N. Alexeev
on 2008-01-18 09:33:45 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Alexander N. Alexeev
Created:
2008-01-18 09:33:45 EST
Size:
12.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.jvmti.runtime >Index: src-native/src/ACCollector/ACCollector.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/ACCollector/ACCollector.cpp,v >retrieving revision 1.15 >diff -u -r1.15 ACCollector.cpp >--- src-native/src/ACCollector/ACCollector.cpp 24 Aug 2007 17:29:24 -0000 1.15 >+++ src-native/src/ACCollector/ACCollector.cpp 18 Jan 2008 14:32:21 -0000 >@@ -1,5 +1,5 @@ > /************************************************************************ >- * Copyright (c) 2005, 2007 Intel Corporation. >+ * Copyright (c) 2005, 2008 Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -368,7 +368,7 @@ > //No command line args hence the env to be picked up. > this->processCommandLine(0, cargv); > >- this->registerAgent(); >+ this->asyncRegisterAgent(); > if (isControlled) { > while(m_isWaiting) { > Sleep(100); >#P org.eclipse.tptp.platform.agentcontroller >Index: src-native-new/include/tptp/agents/BaseAgentImpl.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/include/tptp/agents/BaseAgentImpl.h,v >retrieving revision 1.27 >diff -u -r1.27 BaseAgentImpl.h >--- src-native-new/include/tptp/agents/BaseAgentImpl.h 30 Mar 2006 19:49:30 -0000 1.27 >+++ src-native-new/include/tptp/agents/BaseAgentImpl.h 18 Jan 2008 14:32:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005-2006 Intel Corporation. >+ * Copyright (c) 2005-2008 Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -114,10 +114,12 @@ > BaseAgentImpl(char* name); > virtual ~BaseAgentImpl(); > int registerAgent(); >+ int asyncRegisterAgent(); > int deRegisterAgent(); > int initialize(); > virtual int preRegisterInitialization(); > void waitForTermination(); >+ static THREAD_USER_FUNC_RET_TYPE registerFunc(void* arg); > static THREAD_USER_FUNC_RET_TYPE handleMessages(void* args); > int processRecdMessages(char* buffer, int bytesRead); > int processOneMessage(char* buffer); >@@ -201,12 +203,13 @@ > tptp_int32 lineNum, > tptp_int32 severity, > tptp_string* event ); >+ int getAgentRegistrationStatus(); > > protected: > char* _serviceConfigFile; > char* _raMasterAddress; > char* _raShmBufNameRoot; >- >+ int registrationStatus; > }; > > #endif /* __BASEAGENTIMPL_H__ */ >Index: src-native-new/src/agents/agentBase/BaseAgentImpl.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/agents/agentBase/BaseAgentImpl.cpp,v >retrieving revision 1.66 >diff -u -r1.66 BaseAgentImpl.cpp >--- src-native-new/src/agents/agentBase/BaseAgentImpl.cpp 26 Jun 2007 18:34:43 -0000 1.66 >+++ src-native-new/src/agents/agentBase/BaseAgentImpl.cpp 18 Jan 2008 14:32:24 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 Intel Corporation. >+ * Copyright (c) 2005, 2008 Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -280,9 +280,22 @@ > return _serviceConfigFile; > } > >-// registerAgent() establishes a private connection with the Agent Controller >-// and creates a thread to get messages coming in from that connection. Does not >-// return until the AC's agentRegistered response is received. >+ >+// asyncRegisterAgent() establishes a private connection with the Agent Controller >+// and creates a thread to get messages coming in from that connection. It is >+// asynchronous method and returns immediately. >+// registerFunc executed in dedicated thread and waits until the AC's agentRegistered >+// response is received. >+int BaseAgentImpl::asyncRegisterAgent() >+{ >+ TPTP_HANDLE registerThreadHandle; >+ TID registerThreadID; >+ startNewThread(registerFunc, (void *) this, ®isterThreadID, ®isterThreadHandle); >+ return 0; >+} >+ >+// registerFunc register agent at AC. >+// Does not return until the AC's agentRegistered response is received. > // > // 1) Creates a named pipe which this agent will use to receive commands > // coming from the Agent Controller process. This pipe cannot be used to send >@@ -294,11 +307,10 @@ > // response being received on the handleMessages thread. > // 4) Sends a registerAgent command to the AC which will result in a agentRegistered response > // being received on the handleMessages thread. >-// >-// returns 0 if successful >-int BaseAgentImpl::registerAgent() >+THREAD_USER_FUNC_RET_TYPE BaseAgentImpl::registerFunc(void* arg) > { >- >+ BaseAgentImpl* agent = (BaseAgentImpl*)arg; >+ agent->registrationStatus = -1; > char commandFormat[] = "<Cmd src=\"%d\" dest=\"%d\" ctxt=\"%d\"> <registerAgent iid=\"org.eclipse.tptp.agentManager\"><agentID>%d</agentID><processID>%lu</processID><agentName>%s</agentName></registerAgent></Cmd>"; > char command[BUFFER_LENGTH]; > PID agentProcessID; >@@ -307,38 +319,38 @@ > > // Initialize semaphores that handleMessages() thread will use to let us know > // when replies arrive from the AC during this registration process. >- rc = tptp_initializeSemaphore(®isterAgentConnectedSem); >+ rc = tptp_initializeSemaphore(&(agent->registerAgentConnectedSem)); > if (rc != 0) > { >- TPTP_LOG_ERROR_MSG(this, "BaseAgent registerAgent: Error - Exiting, failed to create synch event for registerAgentConnected."); >+ TPTP_LOG_ERROR_MSG(agent, "BaseAgent registerFunc: Error - Exiting, failed to create synch event for registerAgentConnected."); > return -1; > } > >- rc = tptp_initializeSemaphore(®isterAgentCompletedSem); >+ rc = tptp_initializeSemaphore(&(agent->registerAgentCompletedSem)); > if (rc != 0) > { >- TPTP_LOG_ERROR_MSG(this, "BaseAgent registerAgent: Error - Exiting, failed to create synch event for registerAgentConnected."); >+ TPTP_LOG_ERROR_MSG(agent, "BaseAgent registerFunc: Error - Exiting, failed to create synch event for registerAgentConnected."); > return -1; > } > >- initializeAgentConfiguration(getServiceConfigFile()); >+ agent->initializeAgentConfiguration(agent->getServiceConfigFile()); > > // generate the unique id string for the pipe name > pUniqueId = generateUUID() ; > > //Create the named pipe that we will use to get msgs from the AC. >- agentPipeName = (char*)tptp_malloc(strlen(RA_PIPE_NAMESPACE) + strlen(pUniqueId) +1); >- sprintf(agentPipeName, "%s%s", RA_PIPE_NAMESPACE, pUniqueId); >- agentNamedPipeHandle = createReadOnlyNamedPipe(RA_PIPE_NAMESPACE, pUniqueId, FALSE) ; >- if (agentNamedPipeHandle != INVALID_HANDLE_VALUE) >+ agent->agentPipeName = (char*)tptp_malloc(strlen(RA_PIPE_NAMESPACE) + strlen(pUniqueId) +1); >+ sprintf(agent->agentPipeName, "%s%s", RA_PIPE_NAMESPACE, pUniqueId); >+ agent->agentNamedPipeHandle = createReadOnlyNamedPipe(RA_PIPE_NAMESPACE, pUniqueId, FALSE) ; >+ if (agent->agentNamedPipeHandle != INVALID_HANDLE_VALUE) > { >- TPTP_LOG_DEBUG_MSG1(this, "BaseAgent registerAgent: Created Agent Named Pipe - %s", agentPipeName); >+ TPTP_LOG_DEBUG_MSG1(agent, "BaseAgent registerFunc: Created Agent Named Pipe - %s", agent->agentPipeName); > } > else > { >- TPTP_LOG_ERROR_MSG1(this, "Error creating Named Pipe - %s", agentPipeName); >+ TPTP_LOG_ERROR_MSG1(agent, "Error creating Named Pipe - %s", agent->agentPipeName); > // TODO: Send ERROR response; do cleanup >- if (agentPipeName) {tptp_free(agentPipeName); agentPipeName=0;} >+ if (agent->agentPipeName) {tptp_free(agent->agentPipeName); agent->agentPipeName=0;} > return -1; > } > >@@ -346,59 +358,76 @@ > > > //Start Listening to the named pipe >- TPTP_LOG_DEBUG_MSG(this, "Starting the Listener thread..."); >- startNewThread(handleMessages, (void *) this, &msgHandlerThreadID, &msgHandlerThreadHandle); >+ TPTP_LOG_DEBUG_MSG(agent, "Starting the Listener thread..."); >+ startNewThread(handleMessages, (void *) agent, &(agent->msgHandlerThreadID), &(agent->msgHandlerThreadHandle)); > > // Tell the AC to connect to this pipe - it knows how to form the name of our pipe > // by using the unique id string we generated. >- rc = sendCONNECTCommand(pUniqueId) ; >+ rc = agent->sendCONNECTCommand(pUniqueId) ; > if (rc != 0) > { >- TPTP_LOG_ERROR_MSG1(this, "Error: Attempt to send CONNECT to AC failed (unique ID:""%s"")", pUniqueId ); >+ TPTP_LOG_ERROR_MSG1(agent, "Error: Attempt to send CONNECT to AC failed (unique ID:""%s"")", pUniqueId ); > //TODO: Send ERROR; do cleanup >- if (agentPipeName) {tptp_free(agentPipeName); agentPipeName=0;} >- CLOSE_TPTP_HANDLE(agentNamedPipeHandle); >+ if (agent->agentPipeName) {tptp_free(agent->agentPipeName); agent->agentPipeName=0;} >+ CLOSE_TPTP_HANDLE(agent->agentNamedPipeHandle); > return -1; > } > > // Wait for the handleMessages thread to get a response to the CONNECT request. >- rc = tptp_waitSemaphore(®isterAgentConnectedSem); >+ rc = tptp_waitSemaphore(&(agent->registerAgentConnectedSem)); > if (rc != 0) > { >- TPTP_LOG_ERROR_MSG(this, "BaseAgent registerAgent: Error - wait for registerAgentConnected failed."); >+ TPTP_LOG_ERROR_MSG(agent, "BaseAgent registerFunc: Error - wait for registerAgentConnected failed."); > return -1; > } > >- TPTP_LOG_DEBUG_MSG1(this, "BaseAgent registerAgent: Agent (%s) connected to AC ", agentName); >+ TPTP_LOG_DEBUG_MSG1(agent, "BaseAgent registerFunc: Agent (%s) connected to AC ", agent->agentName); > > // Do pre-registration initialization. That is, initialization > // that requires the AC communication path to be setup but before the agent advertises > // that it is here and ready to interact with others - which the registerAgent cmd > // will do. >- preRegisterInitialization(); >+ agent->preRegisterInitialization(); > > //Send a register message to the AC named pipe > agentProcessID = getCurrentlyRunningProcessId(); > >- sprintf( command, commandFormat, agentID, getAgentControllerID(), getNextContext(), agentID, agentProcessID, agentName); >+ sprintf( command, commandFormat, agent->agentID, agent->getAgentControllerID(), agent->getNextContext(), agent->agentID, agentProcessID, agent->agentName); > >- rc = sendCommand((char*)command); //TODO: Check return code >+ rc = agent->sendCommand((char*)command); //TODO: Check return code > > // Wait for a reply to the registerAgent command we just sent to the AC. > // When msg handling thread gets it, registration is complete. >- rc = tptp_waitSemaphore(®isterAgentCompletedSem); >+ rc = tptp_waitSemaphore(&(agent->registerAgentCompletedSem)); > if (rc != 0) > { >- TPTP_LOG_ERROR_MSG(this, "BaseAgent registerAgent: Error - wait for registerAgentCompleted failed."); >+ TPTP_LOG_ERROR_MSG(agent, "BaseAgent registerFunc: Error - wait for registerAgentCompleted failed."); > return -1; > } > >- TPTP_LOG_DEBUG_MSG1(this, "BaseAgent registerAgent: Agent register with AC completed (%s)", agentName); >- tptp_deleteSemaphore(®isterAgentConnectedSem); >- tptp_deleteSemaphore(®isterAgentCompletedSem); >+ TPTP_LOG_DEBUG_MSG1(agent, "BaseAgent registerFunc: Agent register with AC completed (%s)", agent->agentName); >+ tptp_deleteSemaphore(&(agent->registerAgentConnectedSem)); >+ tptp_deleteSemaphore(&(agent->registerAgentCompletedSem)); >+ agent->registrationStatus = 0; > return 0; > } > >+int BaseAgentImpl::getAgentRegistrationStatus() >+{ >+ return (registrationStatus); >+} >+ >+ >+// registerAgent() establishes a private connection with the Agent Controller >+// and creates a thread to get messages coming in from that connection. Does not >+// return until the AC's agentRegistered response is received. >+// returns 0 if successful >+int BaseAgentImpl::registerAgent() >+{ >+ registerFunc(this); >+ return getAgentRegistrationStatus(); >+} >+ > int BaseAgentImpl::deRegisterAgent() > { > char commandFormat[] = "<Cmd src=\"%d\" dest=\"%d\" ctxt=\"%d\"> <deregisterAgent iid=\"org.eclipse.tptp.agentManager\"><agentID>%d</agentID></deregisterAgent></Cmd>";
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 186080
: 87259 |
87629