The WebSphere Work Area APIs and SPIs are unavailable

The following WebSphere Work Area APIs and SPIs are not available on Liberty:

This rule flags any instance of these packages once per Java class. You must modify the application so that it can run on Liberty.

Although no exact alternatives exist, review the following migration suggestions.

Evaluate usage

Take note which features of Work Area APIs and SPIs are used in your code and consider which features are needed. Refer to the com.ibm.websphere.workarea Javadoc.

Some of the more difficult features to migrate from are:

Potential alternatives

com.ibm.websphere.appserver.api.DistributedMap

java.lang.ThreadLocal

java.lang.InheritableThreadLocal

Database

DistributedMap example

This example shows how you can migrate to DistributedMap if your application does not need any of the difficult features to migrate from, which are listed in the Evaluate usage section.

The default WebSphere Dynamic Cache instance is created when the cache is enabled in the administrative console and is bound into the global JNDI namespace with the name services/cache/distributedmap. More cache instances can be created by using a properties file cacheinstances.properties or by defining a resource-ref for in cache in your module's deployment descriptor.

Read more and see example code in the Open Liberty Documentation for DistributedMap:

UserWorkArea

DistributedMap

begin(java.lang.String name)

InitialContext ic = new InitialContext();

DistributedMap distributedMap = (DistributedMap)ic.lookup("services/cache/customObjCache");

complete()

Mostly not applicable, but consider invalidating keys in a DistributedMap if you no longer need them

distributedMap.addChangeListener(...)

distributedMap.invalidate(key)

get(java.lang.String key)

distributedMap.get(Object key) // returns Object

getMode(java.lang.String key)

Not applicable

getName()

Not applicable

remove(java.lang.String key)

distributedMap.addChangeListener(InvalidationListener listener)

distributedMap.invalidate(Object key)

Alternatively, you can set timeToLive or inactivityTime when you set or update an Object in DistributedMap.

distributedMap.put(Object key, Object value, int priority, int timeToLive, int inactivityTime, int sharingPolicy, Object[] dependencyIds)

retrieveAllKeys()

Set dmSet = distributedMap.keySet(boolean includeDiskCache); // returns Set

String[] keys = dmSet.toArray(new String[0]);

set(java.lang.String key, java.io.Serializable value)

distributedMap.put(Object key, Object value)

distributedMap.put(Object key, Object value, int priority, int timeToLive, int inactivityTime, int sharingPolicy, Object[] dependencyIds)

distributedMap.put(Object key, Object value, int priority, int timeToLive, int sharingPolicy, Object[] dependencyIds)

set(java.lang.String key, java.io.Serializable value, PropertyModeType mode)

Not applicable

For information about other APIs and SPIs that are not supported on Liberty, see Some APIs and SPIs are not available on Liberty.