My ConnectionFactoryImpl implements two interfaces ConnectionFactory having a getConnection(String) and a ConnectionManager having a shutDown() as above.
both these methods are synchronized in ConnectionFactory and the shutdown method will loop thr' its filename_DataInterfacePlusLockManager Map and try to obtain a DATABASE_LOCK on all the DataInterfaces . note though, it wont "wait", till all the locks are obtained for all the datafiles. so, as getConection and shutdown are synchornized, no new connections can take effect. and the server(ConnectionManager) will shutodwn gracefully.
My main concern is:-
1. Can i make the shutDown public in ConnectionFactoryImpl . what if the client calls it. but the idea soundswondeful to me, ie., to do a shutdown from any remote machine. but as the ConnectionManager is public i cant narrow its scope in the ConnectionFactoryImpl.
removing the shutdown altogether wont be a an awkward way, but that will be my last fort.
your comments will boost me a lot! help!!
1) i thought of changing the method signature in ConnectionManager to shutDown(String userName, String password) but i wont check it in my ConnectionFactoryImpl(which is also behvaes like a virtual ConnectionManagerImpl).
2) have a getDbFiles method in ConnectionFactoryImpl and loop thr' and acquire a DATABASE_LOCK till exhausting the DbFiles. but NOTHING prevents me the ConectionFactoryImpl from issuing a new connection(RemoteDataInterface), when this dbFile looping is performing. ie., no other class can keep the dbFiles collection upto-date.
the "Information expert", "reponsibility based classes" all indicate the shutdown would be rightfully placed in the ConnectionFactoryImpl.
currently i am planning to go with shutdown(String,String) !!!
Please put in your thoughts and let me get some new ideas.
Originally posted by Eugene Kononov:
You don't need the shutDown() method, -- this is outside of the requirements and it adds nothing to simplicity, flexibility, and reusability of your design.
[ March 19, 2003: Message edited by: Eugene Kononov ]
thats good to hear. to rephrase, i will give the option to start the server and when he wants to shutdown , i will blindly call unbind, is that right. (equivalent to SHUTDOWN IMMEDIATE in oralce and not shutdown transactional). is that right??
Better put your energy into MVC.
i think , maybe, i have become an expert in MVC after your and Marks valuable guides. finally i have implemented the hook as Mark adviced and using Observer-Observable (a push from model, including the startup values). no hardcoding in the Views, except the hateful ANY. doing fine!!