Re: Resetting global options on client?

Milos Kleint <[email protected]> Mon, 22 Jul 2002 13:59:46 +0200
Newsgroups gmane.comp.java.netbeans.modules.javacvs.devel
Message-ID <[email protected]>
Robbie Gibson wrote:
>  --- Milos Kleint <[email protected]> wrote:
> 
>>Robbie Gibson wrote:
>>
>>>I am trying to build a small app around javaCVS
>>
>>which
>>
>>>will retrieve a list of files to be updated for a
>>>given module, then ask for individual confirmation
>>
>>of
>>
>>>each one before performing a real update. This is
>>>automation of my normal command-line workflow:
>>>cvs -qn update ...
>>>cvs -q update file1 file2 filen
>>>
>>>I'm using the GlobalOptions to specify the
>>
>>doNothing
>>
>>>flag, however it seems as if this object is only
>>
>>used
>>
>>>on the first call to
>>>client.executeCommand (command, globalOptions)
>>>
>>>Is this correct?  If not, what am I doing wrong? 
>>
>>If
>>
>>>yes, what else do I need to do?
>>
>>hmm.. I create a new Client for every command (I do
>>that primarily because a new pserver connection 
>>should be created for each command.. theoretically
>>it's not necessary, however I believe some people 
>>reported problems with such approach.. cvs is not
>>ready for that.)
>>
> 
> 
> OK I didn't realise that - I now create a new Client &
> PConnection each time and everything works fine.  Is
> there any more cleanup to do when I'm finished with a
> client/connection pair other than Connection.close ()?
> 

Well, I try to get rid of everything once the command finishes. The library is designed in a way 
that allows you to gc everything quite effectively. (no many static singletons for example)
I remove the listeners from the command. I also create a new command each time. (I have a factory 
that creates the commands with or without the default switches + always create the client based on 
the right, correct and uptodate information about the server and repository)


Milos