[mwibbels] Corba using OrbixWeb

I have developed a 3-tier architecture project, using JApplet at tier-1, Corba (OrbixWeb) as Application server at tier-2 and MS-SQL server 7.0 as database server at tier-3.

I have 2 problem :
 - My Applet didn't work using Netscape Navigator 7.0, but work using IE 4.0 and appletviewer, with IE works but I have to put Corba classes in the Codebase tag of my html (I have deploy my applet into IIS) and It runs very slow, any idea ? and why didn't work using Netscape ?
 - I want to do callback from server to client (JApplet), actually I'm not sure about callback concept, correct me If i'm wrong, callbacks means the server call a method in the client object ?
I need to do with callbacks, since my app server need to check the SQLServer
(I have capacity for class on my JTable on the client side, that have to be the most update class capacity), so If the capacity for certain class change, then I do callbacks to all the client, but the problem how the client know If being sent most update capacity ?
Ok, That is my idea, maybe there is a better way. Hope you can helps me

ps : sorry, about the points. I only have 100 pts at this time.

  Thanks
JavaBoy060299Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mwibbelsCommented:
Your perception of callbacks is correct. I have no idea why NN 7 and IE4 give you problems.

I'll first try to understand what you're trying to do. You have a number of clients that have registered with the app-server. Whenever the capacity for something changes, your server calls all clients to tell them about the update. Correct?

Then what is the problem? Clients know that their current capacity value is valid until the next update arrives. From that moment on the new value is valid.

There is of course a short period of time in which the server knows that the capacity changed to 3, while the clients still think it is 4. But you cannot eliminate that, you have to be aware of that and live with it.

If the above is what you want, then the basic idea sounds ok to me.
0
Ravindra76Commented:
Hi JavaBoy,

I think , From netscape, to execute Corba Applets, you have to download a plugin ( patch ) from netscape.com
0
JavaBoy060299Author Commented:
mwibbels, the problem is, the client (applet) doesn't know when the capacity updated, even the server have call the method on the client that the capacity have been changed.
I hope you understand my Q

>There is of course a short period of >time in which the server knows that >the capacity changed to 3, while the >clients still think it is 4. But you >cannot eliminate that, you have to be >aware of that and live with it.
I agree with you, but in my case It is better if the client know the current capacity (although not the real one).

ravindra76, where can I get the patches for Navigator 4.7 to run Corba Applets
(Please, I need the link)
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

mwibbelsCommented:
No, I'm afraid I don't understand. If the server called the client to tell it that the capacity has changed, then what else does it need to know? The exact time? The current value?
0
JavaBoy060299Author Commented:
Ok, I have build idl like this

module krs {        
      typedef sequence<string> stringList;
      
      interface clientSetKapasitas {
            long setKapasitas(in stringList list);
      };

      interface KRS99 {
            boolean validasiNIM (in string nim, in string pin);
            boolean cekKRShasil (in string nim);
                boolean cekPemakai (in string nim);                            
              boolean cekTglKRS (in string nim);                   
            boolean cekHari1 (in string nim);
            boolean cekAngsuran (in string nim);
            string getID (in string nim);
            string cekUang (in string nim);
            string getIPK (in string nim);
            stringList getWorkFile (in string nim, in string kdfak, in string kdjur, in string angkatan);
            stringList getJadwal (in stringList list);
            short cekValid (in stringList list,in boolean angsur,in long sksKum,in long sksBayar,in long nSksPagi,in long nSksMalam);
            long getKapasitas(in clientSetKapasitas ObjClient,in stringList data);
      };
};

where clientSetKapasitas is client object and  KRS99 is server object
then I wrote the implemantation for both interface,
so when the capacity change, server call
setKapasitas(String[] ) method, but at that time, the client doesn't know that the capacity have been changed
In Short word, the server only change the value of capacity (not tell the client, capacity have changed)
0
mwibbelsCommented:
Ok, this long setKapasitas(in stringList list) is called by the server, right. It does that when the capacity is changed. So then the client knows that the capacity changed, is it not?

In other words: The very fact that the server calls setKapasitas means that the capacity changed.

I feel I'm missing someting very obvious here, so please be patient with me. Is the method called at any other time?
0
JavaBoy060299Author Commented:
When the server call setKapasitas, the capacity was updated, but the client didn't know that server have called setKapasitas or capacity have updated
here it is, I paste some of code at client side :

public class JApplet1 extends JApplet
{
     .
     .
     .
   private KRS99 Interface = null;
   private ClientKRS client = new ClientKRS();

   void JButton1_actionPerformed (java.awt.event.ActionEvent event)
   {
       Interface = client.Connect(":Server", "10.20.10.1");
       //connected to corba server
       // ready to call remote object/method
   }

   void JButton4_actionPerformed(java.awt.event.ActionEvent event)
   {
        ImplClientSetKapasitas ObjClient = new ImplClientSetKapasitas();
        Interface.getKapasitas(ObjClient,data);
   }
}
0
mwibbelsCommented:
Your code has two clients:

ClientKRS client;

ImplClientSetKapasitas ObjClient (in JButton4_actionPerformed)

I'm assuming that the ObjClient is being notified of changes in the capacity (its setKapasitas method will be called by the server  whenever the capacity changes). So this client *will* know whenever the capacity is updated.

If the problem is that the ClientKRS client doesn't know about the update, why don't you simply let the ObjClient notify the ClienKST client?

Or am I still not getting it? If not, please try to put it in completely different words.
0
JavaBoy060299Author Commented:
>I'm assuming that the ObjClient is >being notified of changes in the >capacity (its setKapasitas method will >be called by the server  whenever the >capacity changes). So this client >*will* know whenever the capacity is >updated.
 
 Yes, It is true.

Ok, How objClient notify ClientKRS client ?
0
mwibbelsCommented:
Define a notifier interface:

interface UpdateListener {
  public void objectUpdated(Object o);
}

Expand your ObjClient constructor, and/or add a setUpdateListener method:

public class ImplClientSetKapasitas bla bla {

   UpdateListener client;

   public ImplClientSetKapasitas(UpdateListener client) {
       super(); // or this();
       setUpdateListener(client);
   }

   // and/or:
   public setUpdateListener(UpdateListener client) {
       this.client = client;
   }

   public int setKapasitas(String[] list) {
       // .. do your stuff ..
       ...
       // notify client
      client.objectUpdated(this);
   }
}

and let your ClientKRS client implement the UpdateListener interface:

public class ClientKRS bla bla implements UpdateListener {

   ....
   
   public void objectUpdated(Object o) {
        ImplClientSetKapasitas ObjClient = ( ImplClientSetKapasitas)o;
        // do something
   }
}

I defined a listener interface for this. You could also pass ClientKRS references and not use a listener interface, but this is more generic: the listener interface can be used in multiple situations.

Is this what you meant?
0
JavaBoy060299Author Commented:
mwibbels, I have solved this problem without using listener, but CallBack
I can explain how it works, but If you interested I'll send you the examples.

Thanks for your help
I think, I still need your help.
The callback works well, but I think I should change the implementation.
my previous implemantation, every client connected to the server will make one new thread to some query into SQL Server. By this way, It takes almost the server resource (CPU usage history reach 100%) It just only one user connected, I can't imagine, If 50 users connected concurrently.

So, I just want to make only one thread to query from SQL Server, and save the result set into cache, then every client create a new thread to check the cache, If the capacity have been changed
but the problem, I don't know how to code it.
Hope you understand my question.

  Thanks
0
mwibbelsCommented:
The listener was a callback interface, so you solved it in the same way ...


Your problem is (I'm trying to put it in other words):

your clients all need the same data from the server and query it. This query takes up a lot of server time.

So the solution might be: upon the first request, let the server perform the query and cache the result. When clients issue a second, third, ... request, return the cached results.

If the data changes, invalidate the cached result. The first client request will then result in a query, all other requests can then return the cached result again.

Is this what you mean?
0
JavaBoy060299Author Commented:
yes, almost exactly.

actually, the client not requesting for the same data.
but the data client need must be in the cache.
then every client connected, only need to check at the cache.
so the server only query on time, when the server up or run.
0
mwibbelsCommented:
If the clients do not all need the same data, then how do you know that 2 clients request the same data?

If you know that, then store the identifying quantity as a key, and the query result as a value in some Hashtable. Before performing a query, first check if the result is already in the table. If yes return the cached result, otherwise perform an actual query.

When the database changes, empty the Hashtable (thereby invalidating the cache). Subsequent queries will then return the updated values.

Shouldn't be too difficult.
0
JavaBoy060299Author Commented:
No, there is no need to know that 2 client request for the same data, even this could be happened.

Yes, I know the logic well, but I didn't know how to implement it with Corba support. How to code it.
I don't know how to make a cache, that the cache only one, and every client connected check wheather the needed data have been changed or not.

Now what I can do is, make an implemantation of the server method, and every client call the method, (I think the client make one new remote object) so I don't want to make one new cache for every client connected.
0
mwibbelsCommented:
I'm rereading your comments to try and figure out what you're having trouble with. But I can't.

I don't see what influence CORBA would have on caching. You have some server object with a CORBA interface and inside that object you do the caching. So the caching itself does not involve CORBA.

The only thing you need to figure out is what data needs to be cached. That depends on your data structure and the queries your clients can perform, but it isn't hard.

I get the impression that you think that there is a server object for every client. Normally there isn't, I think.

Again, I don't understand what exactly is the problem. Sorry.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.