Basics of clipboard structure and management
A developer asks: We would like to know more about the clipboard, especially how it is organized and managed within Process Commander.
The clipboard is a memory resource that is managed by the Process Commander servlet.
The clipboard is collections of Java objects in the JVM. The clipboard is managed as a group of pages, which are arranged into sets of decreasing scope.
System Pages have the widest scope. In V3.2, there is only one such page, pxProcess. System pages are created at the startup of the application server, and live until the application server is shut down. This page contains system-wide state and configuration information at runtime. The properties on this page are not intended to be modified by user applications.
Requestor Pages form the next, narrower scope. A requestor is the process and data associated with a user (guest or authenticated) of your Process Commander system, or the processing and data associated with a request into your system started by an outside system, such as a Web Applications Server or an Active Server Page on a Web site. Requestor pages exist for the lifetime of the requestor. In V3.2, typically only a single requestor clipboard page, pxRequestor, is created for each requestor. This page contains user and connection specific state and configuration information to Process Commander at runtime.
The set of Thread Pages consists of a pxThread page, anonymous (unnamed) pages, and Named pages.
- The pxThread page contains information at the thread level, and contains user and connection specific state and configuration information to Process Commander at run time.
- The memory for anonymous pages is managed automatically according to Java rules (when the JVM senses that there are no longer any references to this memory, it is marked for garbage collection).
- The memory for Named pages is allocated and freed by Process Commander or your application.
Coding conventions dictate that Pegasystems reserves the pages that begin with px, py, and pz as names that Process Commander manages internally. Rules in your application should not attempt to manage these pages in any way.
Whenever a requestor terminates (either explicitly by the user or implicitly via timeout), all references to all allocated Requestor, Thread, and User pages are freed and therefore marked for garbage collection by the JVM.
When a service request arrives in Process Commander from another system, a Requestor page is created that corresponds to this requestor. As your program executes, Thread and User pages will typically be created. After your application has successfully returned a response to the service request, references to Requestor, Thread, and User pages are freed and therefore are marked for garbage collection unless the Rule-Service- record for this service indicates that the Requestor is to be reused for subsequent requests. In this case, the Requestor, Thread, and User pages remain in memory, awaiting the next request.
Note that invoking Process Commander from another program as a servlet via HTTP is considered an interactive request, not a service request. Pages created during such requests exist until they are explicitly removed, a logout request is received, or until the requestor implicitly terminates via timeout.
User Pages appear in the Clipboard display tool in the section labeled User Pages. A user page is a top-level clipboard page that an activity creates using any of several methods, such as the Page-New method. If you log out, any user pages not saved to the PegaRULES database (through an Obj-Save method) are gone from memory.