BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.common
Class T3Client

java.lang.Object
  |
  +--weblogic.common.T3Client

public class T3Client
extends java.lang.Object
implements weblogic.rjvm.PeerGoneListener, ClientCallback, weblogic.rmi.extensions.InitialReferenceConstants

Class for creating and managing T3Clients. A T3Client must be constructed with the URL of the WebLogic Server that it will connect to. A T3Client may access many services within WebLogic.

The URL for constructing the T3Client follows the pattern:

  scheme://WebLogicHost:port
The scheme identifies the client access. Valid schemes are currently:

A T3Client has a Workspace inside the WebLogic Server that can be named and saved, so that the T3Client can disconnect and then return later to the same Workspace. The T3Client Workspace is at the lowest level of a hierarchy of Workspaces that exist for WebLogic Clusters, WebLogic Servers, T3Users and groups, and T3Clients. T3Clients can set various timeouts to control disconnects from the WebLogic Server; a T3Client can also add entries to the WebLogic logfile, and can store and fetch arbitrary objects from its own Workspace or the other Workspaces within its access.

Author:
Copyright (c) 1996-1998 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1998-2000 BEA Systems, Inc. All Rights Reserved.
See Also:
T3ServicesDef

Field Summary
static int DISCONNECT_TIMEOUT_DEFAULT
          The default DISCONNECT_TIMEOUT value set in the server configuration.
static int DISCONNECT_TIMEOUT_NEVER
          Disables disconnect altogether.
static int INVALID_CALLBACK_ID
           
 T3ServicesDef services
          Defines the WebLogic services that a T3Client can access.
 
Constructor Summary
T3Client(java.lang.String url)
          Constructs a T3Client.
T3Client(java.lang.String url, java.lang.String workspace)
          Constructs a T3Client.
T3Client(java.lang.String url, java.lang.String workspace, UserInfo t3u)
          Constructs a T3Client.
T3Client(java.lang.String url, UserInfo t3u)
          Constructs a T3Client.
T3Client(T3Connection conn)
          Constructs a T3Client over the specified T3Connection.
T3Client(T3Connection conn, java.lang.String workspace)
           
 
Method Summary
 void addDisconnectListener(DisconnectListener dl)
          Adds a T3Client to the list of those clients listening for a DisconnectEvent.
 T3Client connect()
          Connects the T3Client to a WebLogic Server.
 T3Client disconnect()
          Disconnects a T3Client from the WebLogic Server.
 void dispatch(java.lang.Throwable problem, java.lang.Object msg)
           
 int getHardDisconnectTimeoutMins()
          Gets the value for a T3Client's hard disconnect timeout in minutes.
 int getIdleDisconnectTimeoutMins()
          Gets the value for a T3Client's idle disconnect timeout in minutes.
 java.lang.String getServerName()
          Gets the name of the WebLogic Server to which the T3Client is currently connected.
 int getSoftDisconnectTimeoutMins()
          Gets the value for a T3Client's soft disconnect timeout in minutes.
 T3Connection getT3Connection()
          Returns the T3Connection object by which a T3Client is connected to a WebLogic Server.
 T3ServicesDef getT3Services()
          Returns the WebLogic services that a T3Client can access.
 boolean getVerbose()
          Gets the verbose setting for a T3Client.
 java.lang.String getWorkspaceID()
          Deprecated. Use t3.services.workspace().getID();
 java.lang.String getWorkspaceName()
          Deprecated. Use t3.services.workspace().getName();
protected  java.lang.String getWSID()
           
 boolean isConnected()
          Determines whether the T3Client is connected to a WebLogic Server, that is, whether the connect() method has been called for this T3Client and the T3Client is currently connected.
 java.lang.Class loadClass(java.lang.String className)
           
 void peerGone(weblogic.rjvm.PeerGoneEvent pge)
           
 int registerCallback(ClientCallback c, boolean orderingIsCrucial)
          Registers a callback.
 void removeDisconnectListener(DisconnectListener dl)
          Removes a T3Client from the list of those clients listening for a DisconnectEvent.
 void sendOneWay(java.lang.String clss, java.lang.Object o)
           
 java.lang.Object sendRecv(java.lang.String clss, java.lang.Object o)
           
 weblogic.rjvm.Response sendRecvAsync(java.lang.String clss, java.lang.Object o)
          Replaces sendRecv and sendLazy/recv, because it is non-blocking.
 T3Client setHardDisconnectTimeoutMins(int minutes)
          Sets the value for a T3Client's hard disconnect timeout in minutes.
 T3Client setIdleDisconnectTimeoutMins(int minutes)
          Sets the value for a T3Client's idle disconnect timeout in minutes.
 T3Client setSoftDisconnectTimeoutMins(int minutes)
          Sets the value for a T3Client's soft disconnect timeout in minutes.
 T3Client setVerbose(boolean verbose)
          Sets the verbose setting for a T3Client.
 boolean timeTraceEnable(java.io.PrintStream ps)
          Enables time tracing to the specified print stream.
 boolean timeTraceEnabled()
          Determines whether time tracing has been enabled.
 java.lang.String toString()
          Returns a string representation of the T3Client, including the name of the host, the port to which it is connected, and its Workspace ID.
 void unregisterCallback(int callbackID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISCONNECT_TIMEOUT_DEFAULT

public static final int DISCONNECT_TIMEOUT_DEFAULT
The default DISCONNECT_TIMEOUT value set in the server configuration.

DISCONNECT_TIMEOUT_NEVER

public static final int DISCONNECT_TIMEOUT_NEVER
Disables disconnect altogether. Setting a soft disconnect timeout of "never" keeps WebLogic from cleaning up (destroying) a T3Client's resources in the WebLogic Server, including its Workspace.

services

public T3ServicesDef services
Defines the WebLogic services that a T3Client can access. It is used to access the object factory for a WebLogic service or facility. This example shows how a T3Client accesses WebLogic Remote computing services (T3Servlets). First the client requests a T3Servlet object from the object factory for that facility. Then it executes it inside WebLogic. In this example, the class pathname of the T3Servlet is "tutorial.t3client.StartupQuery" and the T3Client is "t3". The ParamSet for the T3Servlet is "ps".
   T3ServletDef t3s =
     t3.services.remote().getT3Servlet("tutorial.t3client.StartupQuery");
   t3s.execute(ps);
 

INVALID_CALLBACK_ID

public static final int INVALID_CALLBACK_ID
Constructor Detail

T3Client

public T3Client(T3Connection conn,
                java.lang.String workspace)

T3Client

public T3Client(T3Connection conn)
Constructs a T3Client over the specified T3Connection. The T3Connection represents other information necessary for the client to gain access to the WebLogic Server, including the WebLogic host and port and a UserInfo username and password.

Parameters:
conn - T3Connection to a WebLogic Server

T3Client

public T3Client(java.lang.String url,
                java.lang.String workspace,
                UserInfo t3u)
         throws java.net.UnknownHostException,
                T3Exception,
                java.io.IOException
Constructs a T3Client. The WebLogic URL should follow the pattern "t3://WebLogicHost:port", where the WebLogicHost is the host name of the WebLogic Server, and the port is the TCP port over which the WebLogic Server is listening for T3Client connections (defaults to port 80, if no port number is provided).

The Workspace is the name or ID of an existing Workspace; if there is no Workspace on the WebLogic Server with that name or ID, the argument is assumed to be the name of a new T3Client Workspace that is to be created. When you specify the name of a Workspace on WebLogic, that name is implicitly qualified on the left by the UserInfo's username, after the pattern "username:workspaceName".

Parameters:
url - URL for the WebLogic Server
workspace - Name or ID of a client Workspace
t3u - A UserInfo that has access to the WebLogic Server
Throws:
java.net.UnknownHostException - if the URL for the WebLogic Server is invalid
T3Exception - if there is an error creating the T3Client
java.io.IOException - if there is an IO error with the connection

T3Client

public T3Client(java.lang.String url,
                java.lang.String workspace)
         throws java.net.UnknownHostException,
                T3Exception,
                java.io.IOException
Constructs a T3Client. The WebLogic URL should follow the pattern "t3://WebLogicHost:port", where the WebLogicHost is the host name of the WebLogic Server, and the port is the TCP port over which WebLogic is listening for T3Client connections (defaults to port 80, if no port number is provided).

The Workspace is the name or ID of an existing Workspace; if there is no Workspace on the WebLogic Server with that name or ID, the argument is assumed to be the name of a new T3Client Workspace that is to be created. When you specify the name of a Workspace on WebLogic, that name is implicitly qualified on the left by the UserInfo's username, after the pattern "username:workspaceName". The default UserInfo is "T3User.GUEST".

Parameters:
url - URL for the WebLogic Server
workspace - Name or ID of a client workspace
Throws:
java.net.UnknownHostException - if the URL for the WebLogic Server is invalid
T3Exception - if there is an error creating the T3Client
java.io.IOException - if there is an IO error with the connection

T3Client

public T3Client(java.lang.String url)
         throws java.net.UnknownHostException,
                T3Exception,
                java.io.IOException
Constructs a T3Client. The WebLogic URL should follow the pattern "t3://WebLogicHost:port", where the WebLogicHost is the host name of the WebLogic Server, and the port is the TCP port over which WebLogic is listening for T3Client connections (defaults to port 80, if no port number is provided).

Parameters:
url - URL for the WebLogic Server
Throws:
java.net.UnknownHostException - if the URL for the WebLogic Server is invalid
T3Exception - if there is an error creating the T3Client
java.io.IOException - if there is an IO error with the connection

T3Client

public T3Client(java.lang.String url,
                UserInfo t3u)
         throws java.net.UnknownHostException,
                T3Exception,
                java.io.IOException
Constructs a T3Client. The WebLogic URL should follow the pattern "t3://WebLogicHost:port", where the WebLogicHost is the host name of WebLogic, and the port is the TCP port over which the WebLogic Server is listening for T3Client connections (defaults to port 80, if no port number is provided).

Parameters:
url - URL for the WebLogic Server
t3u - A UserInfo that has access to the WebLogic Server
Throws:
java.net.UnknownHostException - if the URL for the WebLogic Server is invalid
T3Exception - if there is an error creating the T3Client
java.io.IOException - if there is an IO error with the connection
Method Detail

getT3Services

public T3ServicesDef getT3Services()
Returns the WebLogic services that a T3Client can access.

Returns:
T3Services object that gives a T3Client access to WebLogic services

isConnected

public boolean isConnected()
Determines whether the T3Client is connected to a WebLogic Server, that is, whether the connect() method has been called for this T3Client and the T3Client is currently connected. Making a call on a disconnected client causes a T3Exception [T3Client not connected] to be thrown.

Also see Writing a T3Client application, in the WebLogic Server documentation, on how to set up a T3Client to listen for its own disconnect event.

Returns:
True if the T3Client is connected
See Also:
connect()

getT3Connection

public T3Connection getT3Connection()
Returns the T3Connection object by which a T3Client is connected to a WebLogic Server. The T3Connection represents other information necessary for the client to gain access to the WebLogic Server, including the WebLogic host and port and a UserInfo username and password.

Returns:
Connection object

getWorkspaceID

public java.lang.String getWorkspaceID()
Deprecated. Use t3.services.workspace().getID();


getWSID

protected java.lang.String getWSID()


getWorkspaceName

public java.lang.String getWorkspaceName()
Deprecated. Use t3.services.workspace().getName();


timeTraceEnabled

public boolean timeTraceEnabled()
Determines whether time tracing has been enabled.

Returns:
true if time tracing is enabled

timeTraceEnable

public boolean timeTraceEnable(java.io.PrintStream ps)
Enables time tracing to the specified print stream.

Parameters:
ps - PrintStream
Returns:
true if time tracing is enabled

connect

public T3Client connect()
                 throws java.io.IOException,
                        T3Exception,
                        T3ExecuteException,
                        java.lang.SecurityException
Connects the T3Client to a WebLogic Server.

Returns:
T3Client connected to a WebLogic Server
Throws:
java.io.IOException - if an IO error occurs
T3Exception - if there is an error with the connect request
T3ExecuteException - if there is an error with the connect request
java.lang.SecurityException - if there is an error with the connect request

addDisconnectListener

public void addDisconnectListener(DisconnectListener dl)
Adds a T3Client to the list of those clients listening for a DisconnectEvent.

Parameters:
dl - DisconnectListener

removeDisconnectListener

public void removeDisconnectListener(DisconnectListener dl)
Removes a T3Client from the list of those clients listening for a DisconnectEvent.

Parameters:
dl - DisconnectListener

disconnect

public T3Client disconnect()
                    throws java.io.IOException,
                           T3Exception
Disconnects a T3Client from the WebLogic Server. Calling disconnect invokes a soft disconnect. A T3Client's resources inside WebLogic will be cleaned up (destroyed) when the soft disconnect timeout expires. Setting the disconnect timeout to never effectively prevents WebLogic from disposing of the T3Client's resources.

Check the Developers Guide, Writing a T3Client application, in the WebLogic Server documentation, for info on how to set up a T3Client to listen for its own disconnect event. A T3Client can listen for a disconnect event that is the result of a soft or idle disconnect timeout.

Returns:
T3Client
Throws:
java.io.IOException - if an IO error occurs
T3Exception - if there is an error with the disconnect request

peerGone

public void peerGone(weblogic.rjvm.PeerGoneEvent pge)
Specified by:
peerGone in interface weblogic.rjvm.PeerGoneListener


dispatch

public void dispatch(java.lang.Throwable problem,
                     java.lang.Object msg)
Specified by:
dispatch in interface ClientCallback


getHardDisconnectTimeoutMins

public int getHardDisconnectTimeoutMins()
Gets the value for a T3Client's hard disconnect timeout in minutes. The timeout is how long WebLogic will wait to clean up a T3Client's resources after the socket supporting the T3Client's connection goes away. The default timeout is 0 (immediately).

Returns:
Minutes (as an int)

setHardDisconnectTimeoutMins

public T3Client setHardDisconnectTimeoutMins(int minutes)
                                      throws RemoteException,
                                             T3Exception
Sets the value for a T3Client's hard disconnect timeout in minutes. The timeout is how long WebLogic will wait to clean up a T3Client's resources after the socket supporting the T3Client's connection goes away. The default timeout is 0 (immediately).

Parameters:
minutes - Delay before cleanup after a hard disconnect occurs
Throws:
RemoteException - if there is an error

getSoftDisconnectTimeoutMins

public int getSoftDisconnectTimeoutMins()
Gets the value for a T3Client's soft disconnect timeout in minutes. The timeout is how long WebLogic will wait to clean up a T3Client's resources after the T3Client requests a disconnect with the disconnect() method. The default timeout is 0 (immediately).

Returns:
Minutes (as an int)
See Also:
disconnect()

setSoftDisconnectTimeoutMins

public T3Client setSoftDisconnectTimeoutMins(int minutes)
                                      throws RemoteException,
                                             T3Exception
Sets the value for a T3Client's soft disconnect timeout in minutes. The timeout is how long WebLogic will wait to clean up a T3Client's resources after the T3Client requests a disconnect with the disconnect() method. The default timeout is 0 (immediately). Setting the soft disconnect timeout to never effectively prevents WebLogic from cleaning up a client's resources after the disconnect() method is called.

Check the Developers Guide, Writing a T3Client application, in the WebLogic Server documentation for more info on how to set up a T3Client to listen for its own disconnect event.

Parameters:
minutes - Delay after T3Client requests disconnect
Throws:
RemoteException - if there is an error
See Also:
disconnect()

getIdleDisconnectTimeoutMins

public int getIdleDisconnectTimeoutMins()
Gets the value for a T3Client's idle disconnect timeout in minutes. This timeout is how long WebLogic will wait to clean up a T3Client's server resources after the WebLogic Server notices that the T3Client is idle. The default timeout is "never".

Check the Developers Guide, Writing a T3Client application, in the WebLogic Server documentation, for more info on how to set up a T3Client to listen for its own disconnect event.

Returns:
Minutes (int)

setIdleDisconnectTimeoutMins

public T3Client setIdleDisconnectTimeoutMins(int minutes)
                                      throws RemoteException,
                                             T3Exception
Sets the value for a T3Client's idle disconnect timeout in minutes. This timeout is how long WebLogic will wait to clean up a T3Client's server resources after the WebLogic Server notices that the T3Client is idle. The default timeout is "never".

Parameters:
minutes - Minutes
Returns:
T3Client
Throws:
RemoteException - if there is an error
T3Exception - if the timeout value is invalid or if it cannot be set

getServerName

public java.lang.String getServerName()
Gets the name of the WebLogic Server to which the T3Client is currently connected. The name of the WebLogic Server is defined in the property weblogic.system.name.


getVerbose

public boolean getVerbose()
Gets the verbose setting for a T3Client.

Returns:
true if verbose is set

setVerbose

public T3Client setVerbose(boolean verbose)
                    throws RemoteException
Sets the verbose setting for a T3Client.

Parameters:
verbose - True if verbose should be set
Throws:
RemoteException - if there is an error

toString

public java.lang.String toString()
Returns a string representation of the T3Client, including the name of the host, the port to which it is connected, and its Workspace ID.

Overrides:
toString in class java.lang.Object

sendOneWay

public void sendOneWay(java.lang.String clss,
                       java.lang.Object o)
                throws RemoteException


sendRecvAsync

public weblogic.rjvm.Response sendRecvAsync(java.lang.String clss,
                                            java.lang.Object o)
                                     throws RemoteException
Replaces sendRecv and sendLazy/recv, because it is non-blocking. The blocking calls are Response.getThrowable() and Response.getMsg().

Throws:
RemoteException - if there is an error

sendRecv

public java.lang.Object sendRecv(java.lang.String clss,
                                 java.lang.Object o)
                          throws T3Exception


registerCallback

public int registerCallback(ClientCallback c,
                            boolean orderingIsCrucial)
Registers a callback. The returned integer should be used on the server in ClientContext.sendUnsolicitedData. Unless ordering is crucial, each post results in a separate ExecuteRequest which is enqueued to perform the dispatch, which will typically result in the dispatch being in the same order as posts. If ordering is crucial, postings are queued in a queue specific for this callback and every dispatch waits for the previous one to return.


unregisterCallback

public void unregisterCallback(int callbackID)


loadClass

public java.lang.Class loadClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException


Documentation is available at
http://www.weblogic.com/docs51