Governors on Java Code

From AgileApps Support Wiki
(Redirected from Governors)

Java code running in a tenancy is subject to strict limits--or governors:

  • Some settings put limits on the number of resources that tenants can use, to prevent infinite loops and other kinds of runaway programs. The limits apply to each tenant execution interval--from the time that the platform application instance gives control to tenant code, until the time that control returns to the platform. Up to that limit, an application can use as many resources as it wants. But once a constraint is exceeded, the executing code aborts with an exception.
  • Other settings restrict the kinds of Java classes that can be used, to prevent unwarranted access to the server and/or security violations.

The Service Provider Settings can be used to tighten those restrictions, ameliorate them, or lift them entirely.

Considerations
  • Settings are global. They apply to all tenants in the platform instance.
  • Settings apply to scheduled (background) jobs, as well as foreground applications.
  • The minimum for all numeric settings is "1".
  • Changes to these settings take effect only when the platform application instance is restarted.

Here are the default settings:

Parameter Description Default Value
Apply Governors in Java Code? Whether or not governors are applied to this platform instance. A development instance may want to turn them off, in some cases. Any multi-tenant production instance will want them on, to ensure that a runaway program in one tenant does not interfere with other tenants.

Notepad.png

Note: Currently, the code governance is available for Linux installations only.

Yes
Max Number of Statements allowed The maximum number of Java code statements that can be run during an execution interval. 10000


Maximum String Length allowed The total size of all strings allocated in the Java heap space during an execution interval. 30000


Maximum CPU Time allowed (milliseconds) The maximum number of CPU milliseconds that can be consumed during an execution interval. 60000


Java classes not allowed in code There are certain Java classes which are disallowed in tenant classes, to prevent access to the server and any compromise of server security. (They are, however, allowed in global classes developed by the ISV for use by all tenants.)

In order to protect the security of the server, enter a comma-separated list of fully qualified Java Class Names for this option. At compile time, application will check if any of these classes are referenced in the user code and throw an exception if they are. Note that this will take effect only after the server is restarted.

java.lang.System, 
java.lang.Runtime,
java.lang.Class, 
java.lang.ClassLoader, 
java.lang.Thread, 
java.lang.ThreadGroup, 
java.lang.ThreadLocal, 
java.lang.Runnable, 
java.lang.Compiler, 
java.lang.RuntimePermission, 

java.lang.reflect.AccessibleObject, 
java.lang.reflect.Array, 
java.lang.reflect.Constructor, 
java.lang.reflect.Field, 
java.lang.reflect.Method, 
java.lang.reflect.Modifier, 
java.lang.reflect.Proxy, 
java.lang.reflect.ReflectPermission, 

java.io.FileReader,
java.io.FileWriter, 
java.io.FileInputStream, 
java.io.FileOutputStream, 

java.net.DatagramSocket, 
java.net.DatagramSocketImpl, 
java.net.HttpURLConnection, 
java.net.Inet4Address, 
java.net.Inet6Address, 
java.net.InetAddress, 
java.net.InetSocketAddress, 
java.net.JarURLConnection, 
java.net.MulticastSocket, 
java.net.ServerSocket, 
java.net.Socket, 
java.net.URL, 
java.net.URI, 
java.net.URLClassLoader, 
java.net.URLConnection, 
java.net.URLStreamHandler,
java.lang.Process,
java.lang.ProcessBuilder
Libraries supported in Java Code

When compiling user-defined code, the platform allows certain libraries like jars or internal java packages:

  • If a custom library is required, the jar can be placed in the ../tomcat/lib folder of the Apache Tomcat installation
  • To include these library files, enter a comma-separated list of such jar files for this option
  • Note that this will take effect only after the server is restarted.
Empty


No. of Objects in Database Views

Database Views allow the creation of custom categories that join multiple objects

  • These database views can be used as the base category for a Report
  • The maximum number of tables that are allowed is five (5), with a default value of three (3)
  • The number of joins in these tables is restricted to the maximum number + 1
Default: 3, Range is 3-5
Maximum rows in a List View

Maximum number of rows that are fetched in a List View for an object is defined by this option

  • This number is limited by the maximum int value supported by Java/MySQL i.e. 2^16 = 4G
10000
Maximum rows in a report
  • Maximum number of rows that are fetched in a report
  • This number is limited by the maximum int value supported by Java/MySQL i.e. 2^16 = 4G
5000
Maximum rows in a Scheduled Report
  • Maximum number of rows that are fetched in a report that runs in the background queue.
  • This number is limited by the maximum int value supported by Java/MySQL i.e. 2^16 = 4G
5000
Maximum Savepoints Intermediate placemarks, which identify points at which the data fields contain intact, legitimate values 5
Maximum Recursions in Java API Allow a function to call itself the specified number of times 10