GD Deepz

Ranch Hand
+ Follow
since Sep 29, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by GD Deepz

I am new to SCEA, can I start on PartII without starting Part1. Will Sun allow me to do this
Thanks Andrew for you reply. I think you are right, serialization might not be required for my design. This is what is happenning:

1. On application start, data is read from the flat file. A new bean that implements serializable is created for each row of data. These beans are then stored in ArrayList in the backend. Each bean is identified by a record number

2. The beans are never sent over the wire to the client. For example, if a client want to do a search, the required bean(s) are accessed in the ArrayList, data contained in the beans is then sent over the wire to the client. The beans itself which are serialized are never sent across the wire.

So serializing my beans MIGHT NOT required. Am I correct.

TKS
This is what Sun says in the user requirements:


"Non-Networked Mode
The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.
The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all"


Ok, my program bypasses all networked code in standalone mode BUT serialization of objects is still happenning. I have a class that functions as a serialized JavaBean. A new JavaBean is created for each new row of data in the persistent storage. The beans are created and cached in an ArrayList(container)in the backend layer. This only happens once when the program first loads. The bean instances are never sent over the wire even in Network mode. Only data contained in the bean are sent over the wire.

Will this cause automatic failure for standalone mode because I am still performing serialization, eventhough serialization objects are never sent across the wire.
I am trying to get Sun Java App Server to communicate with a MSSQL database with no luck. I am using the jtds JDBC driver. I have copied the jtds.jar to the apporpriate folders in the installation folder of the App Server. The error message is cannot find driver class name, cannot establish a communication etc

The jtds driver is no supported by Sun App server for CMP entity beans, is that the problem? Do I only have to use supported drivers? I am using the bundled version of NetBeans 4.1 and Sun Java App server

Thanks everyone
19 years ago
Thanks John. I almost completed my SCJD but currently working on a real life application. I would like use what I have learned fron SJCD in my real app.

1. Thread A does a search and gets a bunch of results. If Thread B makes a change to a particular flight or record, HOW do I inform Thread A that the record is modified and it needs to refresh to get the latest data. Will Oberverable/Observer work OR can the server inform all clients that data have changed. How do I implement this?

2. I think in a real life app, even read process should be locked. My locking mechanism must now be very elaborate instead of just locking record no. I need to lock the actual client which is doing database operations. Can I sent an instance of the client to the server and lock it. I think RMI server can give me the client ID.

As you can see real life applications can get complicated.

Thanks
Assuming we have a real relation database like SQL Server which provides all kinds of locking feature, do we need a locking mechansim such as what SCJD candidates are doing.

Can we just use the locking feature provider SQL server instead of coming up with one of our own programatically.

Ghana
Hello everyone,

Does not anyone have a solution how to determine if a registry is running a specific host and port.

LocateRegistry.createRegistry(port) --- works
LocateRegistry.getRegistry(host, port) ---- does not tell me much

What I want to do is that if a user starts a registry on a specific host and port and if another user want to start a registry on the SAME host and port, I want to bypass the the creation of the remote object and binding it to the registry.

Otherwise, I am going to get an AlreadyBoundExeption.

if (LocateRegistry.getRegistry(host, port)==null) --- should work but it does not
I am planning to teach Intro Java and the SCJP course. Because I am not an authorized center, SUN will not sell me the instructor guides. Does anyone know where I can buy these guides instead?
"The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run"

Ok, this is how I interperted it:

1. If mode flag = "server", "only" run the server/database and nothing-else. This indciates standalone.

2. If mode flag = "client without networking", "only" run the client/gui/database without the server. This means client/gui/database all runs on the same machine. No networking.

3. If mode flag = "client with networking", run the client/gui/server/database. This means client/gui/server/database can run on different JVMs and machines. Note in this mode, the server must be launched first.

So basically there are 3 ways to start the application. Feedback anyone?

Anyone knows what this means:

"All configuration must be done via a GUI, and must be persistent between runs of the program"
I am using the leasing solution deadlocks or orphan locks.
Have a dameon thread running in the background to check if a locked record has been locked for certain time limit. Call unlock and notifyAll() if the lease has expired for the locked record.

However, the client is never informed by the server when the locked record has been unlocked. Not taking this into consideration.

Any feedback?
What do you all think of a Timer Thread as an inner class in the Data class that checks locked records every 5 mins. If any of the locked records have been locked for more than, say 20 secs, the record is unlocked by calling the unlock().

We can use this idea if a client loses communication with the server for example it gets a RemoteException. Although my client never calls the lock/unlock methods directly and I put the lock/unlock in a try/catch/finally, I could sill have an orphan lock.

As such, there is no need for WeakHashMap or java.server.rmi.Unreferencd
Thanks Clivant. I am using RMI, just looking at the various ways how lost clients are handled. Some say, this is beyond the scope of the requirements but people who got 44/80 on the locking might have not handled lost clients eventhough they felt confident in their locking solution.
20 years ago
Hi Clivant, you got 80/80 for locking, did you take orphan locks(i.e lost clients) into consderation?
20 years ago
Hi guys, I think of the reasons people get hit by the 44/80 bug is because they do not take orphan locks (i.e lost clients) into consideration. I am going to use java.server.rmi.unreferenced to detect any lost clients. Thanks AndrewM for your help on this.

If we use unferenece, how do I detect a clientID? If each client gets its own Remote instance using a Connection Factory when doing a remote lookup, how do I identify that client. For example, my client does remote lookup for the Controller class (I am using a MVC pattern), do I do this during a remote lookup:

new Thread(new Controller())--- This thread identifies this client. I can then do this:

Thread.currentThread()-----> will identify the thread that is associated with this client. So when this client dies, its thread dies, unrefenced is invoked and I releas orphan locks. I am not sure how to associate a Thread to a recNo yet.

Correct me guys if I am way off in my analsis.

Anton, there is no locking in the create() so how does your solution work. My solution is as follows for the create():

1. Cache deleted recNos.
2. Use these recNos for a new record
3. Write to the database overwriting the delete record, i.e use the same storage space
4. Update the LIVE cache with the new record
5. Note the create() is sychronized

No records are ever locked using the create(), there is no need to.


Thanks guys
I am trying to use this interface java.rmi.server.Unreferenced to handle lost clients. I start up my server and then my client but when I close my client, the method i.e unreference) is not being invoked.

I just put a simple print system to see if the method invoked even after waiting 15 mins, the method is not invoked. By the way my Remote class implements this interface.