Proactive insights, news and tips from Oracle WebLogic Server Support. Learn Oracle from Oracle.

How to Use Java EL to Write WLDF Policy Expressions

WLDF provides specialized functions, called Smart Rules that encapsulate complex logic for looking at metric trends in servers and clusters over a recent time interval. If these prove insufficient, you have the option to write policy expressions directly using the beans and functions provided by WLDF and Java Expression Language (Java EL).

Java EL is the recommended language for creating policy expressions in Oracle WebLogic Server 12c. Java EL has many powerful capabilities built into it, but they can make it more complex to work with. However, to make it easier, WLDF provides a set of EL extensions consisting of beans and functions that you can use in your policy expressions that access WebLogic data and events directly.

You can write simple or complex policy expressions using the beans and functions. However, you must have good programming skills and experience using Java EL.

For example, a relatively simple policy expression to check if the average HeapFreePercent over a 5-minute window is less than 20 can be written as:

wls:extract("wls.runtime.serverRuntime.JVMRuntime.heapFreePercent", "30s", "5m").tableAverages().stream().anyMatch(hfp -> hfp < 20)

A more complex policy expression to check the average value of the attribute PendingUserRequestCount across all servers in "cluster1" over a 5 minute interval and trigger if 75% of the nodes exceed an average of 100 pending requests can be written as:

wls:extract(wls.domainRuntime.query({"cluster1"},"com.bea:Type=ThreadPoolRuntime,*", "PendingUserRequestCount"), "30s", "2m").tableAverages().stream().percentMatch(pendingCount -> pendingCount > 100) > 0.75

For more information and examples of using Java EL in policy expressions, see Creating Complex Policy Expressions Using WLDF Java EL Extensions in Configuring and Using the Diagnostics Framework for Oracle WebLogic Server.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.