[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

[mwibbels] Corba  using OrbixWeb

Posted on 1999-11-08
16
Medium Priority
?
270 Views
Last Modified: 2013-12-29
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
0
Comment
Question by:JavaBoy060299
  • 8
  • 7
16 Comments
 
LVL 2

Expert Comment

by:mwibbels
ID: 2193350
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
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2193360
Hi JavaBoy,

I think , From netscape, to execute Corba Applets, you have to download a plugin ( patch ) from netscape.com
0
 

Author Comment

by:JavaBoy060299
ID: 2193475
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 2

Expert Comment

by:mwibbels
ID: 2193485
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
 

Author Comment

by:JavaBoy060299
ID: 2193543
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
 
LVL 2

Expert Comment

by:mwibbels
ID: 2193560
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
 

Author Comment

by:JavaBoy060299
ID: 2193648
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
 
LVL 2

Expert Comment

by:mwibbels
ID: 2193711
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
 

Author Comment

by:JavaBoy060299
ID: 2193734
>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
 
LVL 2

Expert Comment

by:mwibbels
ID: 2193750
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
 

Author Comment

by:JavaBoy060299
ID: 2207741
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
 
LVL 2

Expert Comment

by:mwibbels
ID: 2207810
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
 

Author Comment

by:JavaBoy060299
ID: 2208075
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
 
LVL 2

Expert Comment

by:mwibbels
ID: 2208101
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
 

Author Comment

by:JavaBoy060299
ID: 2209970
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
 
LVL 2

Accepted Solution

by:
mwibbels earned 300 total points
ID: 2210366
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

608 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question