Martin Sturzenhecker

Greenhorn
+ Follow
since Dec 11, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Martin Sturzenhecker

Originally posted by Alex Sharkoff:
Hi my fellow ranchers,

What potential problems can you see in running RMI Client in jre1.4.2 that talks to RMI Server running in jre5.0.5:

------------- -------------
rmi client | <---- | rmi server |
jre1.4.2 | ----> | jre 5.0.5 |
------------- -------------



1. class file compatibility is not a problem AFAIK. If you compile all code gainst java 1.4.2 there shoud be no problem.

2. You can't send objects from server to client, that contain java 1.5 specific features (enums, annotations, java.util.concurrent..., etc.).

I'd try to use the same vm on server and client or at least set the compile settings in the ide)accordingly so I don't get seduced to use new features.

hope this helps a little
-martin

Originally posted by Josh Allen:
10 Kb or 3 1/2 pages.



Thanks a lot, that makes my 13k (6 pages) look quite adapt.


martin
18 years ago
Congratulations!

Just a short question: How long (xx kB) was your choices.txt ?

I'm currenlty wrapping up mine and really have no clue what should be sufficient.


Cheers
martin
18 years ago

Originally posted by Ali Hussain:

No I do not. I was considering to do this in finalize method but decided not to do so. More code == More bugs.



How many bugs may be coded into


?

cheers
martin
Hi Arun,

Originally posted by Arun G Rao:

Regarding 3b) Should I maintain a log.xml or some properties file to have settings like location, size of the logs, granularity of the logs, format etc..

Which brings to my next question

Should we provide a UI for all such settings because it is clearly stated that the assessor will not modify any file. More importantly, Should we provide a UI for DB file location and persist it?



I configure logging using a properties file which I deliver within runme.jar. There is no way to configure logging in my application apart from that. But one must implement a way to set file location (host + path) and persist that setting. A few days ago Andrew Monkhouse replied to a thread with very much the same problem.

-martin
Hi Arun,

welcome to the ranch greenhorn

Ad 1: Exactly.

Ad 2: Generally I don't think there is such a penalty. My spec (URLyBird 1.1.3) has a section called "Use of Standard Elements" which states:


Use of functionality provided by the core Java classes will be preferred to your own implementation of that functionality, unless there is a specific advantage to providing your own implementation.



Having such a section one may argue not using generics violates this rule; yet I don't believe they are so picky.

Ad 3a: Be sure to not introduce any platform dependcies here. "C:\" won't exit on a linux, mac os x, solaris machine. I'd prefer using a "tmp" dir, the current working dir or the user home dir.

Ad 3b: I use several rotating files, 64kB each.

Ad 4: You can generate the cookies as you like. Some strategies may be:
  • Always use the same value.
  • Use a counter.
  • Use the record number.
  • Generate a (pseudo) random long.
  • Somehow "entangle" the record number, a client id and maybe a random number.
  • <your own strategy goes here>

  • The first three attempts are easy to guess, so clients with a bad attitude may grab the lock on a record although they do not own it.

    -martin
    Hi everybody,

    sorry for being offline a few days.

    @Jiju: The only locking I do is like in . Using the sync'ed blocks ensures only one caller can write to the file at a time. Calls to read are not sync'ed.

    @Slava: I do not remove record semaphores. So, after some warm up time every record will have a semaphore in the map. This semaphore may have permits available (unlocked) or not (locked). My tests didn't reveal any deadlocks or dubbed semaphores yet. Which map do you use? I use a ConcurrentMap, which has atomic "compare and set" methods. I found these very useful.

    Merry Christmas
    -martin
    Hi Steve,

    I don't think the magic cookie will change in the metadata. The magic cookie value identifies a file as a valid data file that adheres to the format specified in your assignment.

    For this reason I assume the data file structure is the same for all data files.

    You are right, the database server should support several data files, so a singleton is not the most useful here.

    My db server uses a map of data instances, the keys being the data file names, the values being data instances. I think is called a "Multiton", but I'm not sure this is either the correct name nor such a pattern is widely known (a web search will yield some ruby modul).

    regards,
    -martin
    Hi Jiju,

    Originally posted by jiju ka:

    So in what mode you will add new room. Standalone mode is most appropriate. It you do it in network mode, it will not be easy to attain concurrency.
    Further adding a new room is not a "must".



    Since adding new rooms (as well as deleting rooms) is not a must, I will not support it (in the GUI). The application we are to implement assists CSRs and their job is to sale accomodations, not maintaining data.

    Nevertheless my Data implementation supports add/delete operations. Concurrency for these ops is attained by synchronising (small code sections) on the data instance.

    I hope my answer is useful.

    regards,
    -martin
    Hi Mo,

    your approach should not be a problem as long as the effect of what is done makes it look as if the record were read from the file.

    This means you have to ensure that your "record cache" keeps somehow in sync with the data file.

    As far as I saw a couple of other threads in the forum deal with record caches as you describe it.

    I for my part will not use a cache and read/write the file instead.

    regards
    -martin
    Hi Jiju,

    thanks for your reply

    Below are the steps you will be executing to do an insert.

    Get number of records
    curr record num <--- add one to number of records
    new sempophore <-- new Semophore for curr record num
    acquire lock
    insert record to physical table
    release lock

    The operations starting from "creating rec number" through "write" need to be synchronized without giving chance to dead locks.



    I do not generate a lock for a new record. A record that doesn't exist yet has no need to get locked.

    So my steps are:

    Insert record to physical table (possibly reusing a deleted entry).

    You are right, the insertion and record position calculation has to be synchronized.

    regards
    -martin
    Hi Jiju,


    1. "In either case" means while in network mode using either RMI or serialized objects. Right or Wrong?


    Right.


    2. What does the location of the database mean here? Is it an absolute path + file name to data file or just path? What are the possible values?


    I assume "location of the database" may be a path + filename relative to the working directory, or an absolute path + filename. You have to be able to configure the location in your preferences. A sensible default may the name of the dbFile supplied with the submission, located in the working directory.


    3. In network mode location of the database need to be provided by user. In non-network mode user need not provide database location. Right or wrong?


    Wrong. See above


    4. If Aplication is started in stand alone mode, can another gui started with "mode left out" (Just gui) connect to the database in stand alone mode?


    No. Starting standalone mode means starting a local (non-networked) database and the client gui, bypassing any networking code. Starting the network client (no argument to main) means starting the client gui and using your networking code to connect to a remote (i.e. not the one just started) JVM hosting the database server.

    Regards,
    martin
    Hi Jiju,

    Is sun asking to book multiple rooms in single user action?



    I don't think so. My solution supports the booking of 1 room for 1 night by 1 customer. In the case of the hockey team, several single night bookings have to be done. On the other this case should be very rare, as a hockey team usually uses a longer term booking.


    Regards,
    martin
    [ December 17, 2005: Message edited by: Martin Sturzenhecker ]
    Hi Mahuri,

    I'd suggest to stay with the tool you like and master best.

    In my case this is eclipse.



    -martin
    Hi Andrew,

    it seems I missed your point in my previous post.



    Data simply delegates calls to locky and fily.


    So a Map.Entry in locky.semaphores represents a single record and its associated lock (cookie and semaphore) of a single data file. There can be only 1 such semaphore.

    Is this class collaboration too complex ?

    Do I still miss your point?
    If this is the case you must use a simpler wording so my humble non-native english mind can follow ;-)

    regards
    martin

    [ December 14, 2005: Message edited by: Martin Sturzenhecker ]
    [ December 14, 2005: Message edited by: Martin Sturzenhecker ]