    All Examples  This Package

# Class examples.workspace.datacache

    java.lang.Object
       |
       +----examples.workspace.datacache

public class datacache
extends Object

This code example shows how a T3Client can cache arbitrary data in its workspace on the WebLogic Server. This example uses a very simple piece of data -- a cookie -- to show how to set up data for caching on the WebLogic Server. Any data that you can add to a ParamSet can be cached.

### To set up this example:

1. Set up your development shell as described in Setting up your environment.

2. Compile this example by executing the following command in your development shell:

   $ javac -d %CLIENT_CLASSES% datacache.java

3. Start WebLogic Server in a separate shell.

4. Run this example by executing the following command in your development shell:

   $ java examples.workspace.datacache t3://hostname:port

   Where hostname:port is the host name and port number of your WebLogic Server.

Author:
  Copyright (c) 1996-2000 by BEA Systems, Inc. All Rights Reserved.

##

datacache()

##

main(String[])
  In the main, the T3Client connects to the WebLogic Server and sets its soft disconnect timeout to "never." Setting the soft disconnect to "never" prevents the WebLogic Server from cleaning up (or destroying) a T3Client's resource in the WebLogic Server even if the T3Client goes away.

##

datacache

     public datacache()

##

main

     public static void main(String argv[]) throws Exception

  In the main, the T3Client connects to the WebLogic Server and sets its soft disconnect timeout to "never." Setting the soft disconnect to "never" prevents the WebLogic Server from cleaning up (or destroying) a T3Client's resource in the WebLogic Server even if the T3Client goes away. We get the T3Client's Workspace ID, which we will use as a token to identify our Workspace when reconnecting after a disconnect. Then the T3Client is disconnected.

  The ParamSet that we will save into the T3Client's Workspace is created. We use a loop to create, connect, and disconnect the T3Client, each time connecting to the original T3Client Workspace by supplying the Workspace ID when the T3Client is created. Within the loop, we set a different ParamValue and store the ParamSet in the Workspace; then we disconnect and connect again, and retrieve the data that we stored in the previous session.

  Finally, we connect one last time and set the soft disconnect timeout to zero. This forces an immediate clean up of the T3Client's resources in the WebLogic Server after we've finished with this client's Workspace.

    All Examples  This Package