The Timer Interceptor example
This directory contains the timer interceptor example. The timer
interceptor example demonstrates how to use the Closure class to pass data
between interceptors. The code from the simple Bank
example discussed earlier has not been modified, illustrating how the
code for the interceptors can easily be added to existing applications.
This example illustrates how to:
- Implement a simple ClientInterceptor, ServerInterceptor, and BindInterceptor
- Implement a factories for the ClientInterceptor and ServerInterceptor.
- Use the initializers to install the interceptors when VisiBroker is
initialized
- Add interceptor factories (or interceptors themselves) to the ORB's
chaining interceptor
The timer example shows how to use the org.omg.CORBA.Closure class to
pass data between interceptor points.
Directory Contents
- Init.java
Sample code for standard initialization for a interceptor package. It shows
how to install interceptors and interceptor factories .
- TimerInterceptor.java
Super class for all the interceptors in this sample. It has some common
code shared by the sample interceptors.
- TimerClientInterceptor.java
A sample client interceptor, which intercepts communication at client side.
It also shows how to use Closure to pass information between interceptor
calls.
- TimerServerinterceptor.java
A sample client interceptor factory, which creates client interceptors.
It also shows how to use Closure to pass information between interceptor
calls.
- TimerClientInterceptorFactory.java
A sample client interceptor factory, which creates client interceptors.
- TimerServerInterceptorFactory.java
A sample server interceptor factory, which creates server interceptors.
- TimerData.java
Used by interceptors to pass time information between interceptor calls.
- TwoTimerData.java
Used by interceptors to pass multiple time information between interceptor
calls.
Used from the Bank sample
- Bank.idl
IDL interface for the 'Bank' object.
- Server.java
Server. Creates an instance of the Bank and calls org.omg.CORBA.BOA.impl_is_ready()
to make this object available to client programs. The Bank Server
implementation implements two methods: open(), which opens a bank
account, and balance(), which returns the balance in a person's
account whose name is provided as input. A random number is generated and
returned as the balance.
- Client.java
This is the bank client. It binds to an AccountManager object and invokes
open() to open a bank account. It then invokes the balance()
on the account object reference obtained to query the balance.
Running the timer interceptor example
To run the example, read the instructions
at the interceptor directory.
Here is the sample output from the server
Installing Timer Interceptors
AccountManager object is ready.
locate: 40 ms
balance: (process time) - 70 ms
balance: (prepare response) - 0 ms
balance: (send time) - 0 ms
balance: (total call) - 70 ms
Here is the sample output from the client
Installing Timer Interceptors
bind: 2 s, 503 ms
balance: (prepare time) - 70 ms
balance: (send time) - 0 ms
balance: (receive time) - 390 ms
balance: (total call) - 460 ms
The balance in Jack B. Quick's account is $94.89.
Return to the Interceptor Examples Page.