I've been using PAS for some time and have often made use of the "resource timeout" to kill my _mproapsv.exe after a specified number of seconds so that it will pick up new r-code.
In prior posts (by Irfan and David Cleary?) I had heard some hints of a feature whereby the jconsole (via JMX) would allow us to manage PAS agents and clear out the cached r-code. However, I'm not finding anything that appears to be a direct match for that feature. Below is the list of API methods.
As best I can tell, the only way to clear out the cached r-code is to run stopAgent on it. Is that the recommended approach?
I just tried to create a class file with a property to get the value on the property 'test1' and deployed it in PASOE PROPATH.
define public static property test1 as int init 1
END CLASS.Make multiple calls over a APSV to that class from a procedure and it worked fine. Changed the property INIT to a different value and then executed'terminateFreeABLSessions' API , observed that the sessions got terminated and then on a new request I see that the changed property INIT value is reflected correctly.So I think 'terminateFreeABLSessions' would be a better API to refresh the rcode.
As far as I can tell, the REST URL that you gave me didn't have harmful side effects. I've never seen it terminate sessions that are "active" (which was my main fear - the REST URL itself doesn't seem to indicate one way or another if it will disconnect/terminate active sessions). REST API's aren't very self-descriptive and unfortunately they seem to require quite a lot of guess-work. I haven't fully convinced myself that REST is better than SOAP.
For now I'll assume that this REST request does NOT impact active sessions and is SAFE for production (ie. if we swap out the r-code during a mid-day deployment to production, then we consider using this REST API as a mechanism for ensuring that the new code gets applied to all idle appserver sessions). Here is the start of another powershell script:
[string]$ablapp = "abl_application",
$response = $null
$response2 = $null
# Store credentials
$pass="tomcat" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PsCredential('tomcat',$pass)
# Retrieve available agents
$response = Invoke-RestMethod -Uri (hddp://localhost:' + $portnumber.ToString() + '/oemanager/applications/' + $ablapp + '/agents') -Credential $cred
# Parse out the results into JSON
$jsonstring = ConvertTo-Json -InputObject $response -Depth 3
$json = ConvertFrom-Json -InputObject $jsonstring
# Retrieve an available agent
$agent = $json.result.agents | Where-Object -Property 'state' -EQ 'AVAILABLE'
# Delete the agent sessions
$response2 = Invoke-RestMethod -Method Delete -Uri (hddp://localhost:' + $portnumber.ToString() + '/oemanager/applications/' + $ablapp + '/' + $agent.agentId + '/sessions') -Credential $cred # Display summary Write-Output "Delete sessions operation was sent to oemanager REST URI" Write-Output ("Deleted ID : " + $agent.agentId + " - " + $response2.outcome + " " + $response2.result )
As I noted earlier, this works pretty well for swapping out the r-code that was previously loaded by a session. I was pleasantly surprised that even MS-agent processes started with "-q" will be able to receive refreshed code, without the need to restart the entire process. It appears that r-code must be independently maintained for each session within the agent process.
Thanks for the help with this.