Applications interact with the work area partition service by using the work area partition manager interface. A user can retrieve an instance of the work area partition manager interface out of naming and use the methods that are defined in the following section. An implementation of the work area partition manager interface is bound in Java naming at java:comp/websphere/WorkAreaPartitionManager. This interface is responsible for creating, retrieving, and manipulating work area partitions:
package com.ibm.websphere.workarea; import com.ibm.websphere.workarea.UserWorkArea; import com.ibm.websphere.workarea.PartitionAlreadyExistsException; import com.ibm.websphere.workarea.NoSuchPartitionException; import java.util.Properties; public interface WorkAreaPartitionManager { public UserWorkArea getWorkAreaPartition(String partitionName) throws NoSuchPartitionException; public UserWorkArea createWorkAreaPartition(String partitionName, Properties props) throws PartitionAlreadyExistsException, java.lang.IllegalAccessException; }
EJB applications can use the work area partition manager interface only within the implementation of methods in the remote interface; likewise, servlets can use the interface only within the service method of the HTTPServlet class. Use of work areas within any life cycle method of a servlet or enterprise bean is considered a deviation from the work area programming model and is not supported.
Programmatically creating a work area partition through the createWorkAreaPartition method is only available on the Java 2 platform, Enterprise Edition (J2EE) client. To create a work area partition on the server, use the WebSphere administrative console. All partitions in a server process must be created before server startup is complete so that the work area service can register with the appropriate container collaborators. Therefore, calling the createWorkAreaPartition method in a server process after the server starts results in a java.lang.IllegalAccessException exception. The createWorkAreaPartition method can be called in a J2EE process at any time.
Exceptions
Related concepts
Work area partition service
Related tasks
Configuring work area partitions on the server
Related reference
Example: Work area partition manager