[jcifs] getType question
Michael B. Allen
miallen at eskimo.com
Wed Dec 18 07:31:52 EST 2002
On Tue, 17 Dec 2002 11:09:08 +0100
andrea.lanza at frameweb.it wrote:
> OK for all.
> I "armed" the java exception trapping and I didn't see a real performance
> Maybe this is due to the fact that my network is really little (about 20
> computers sharing resources) and all of them share a limited number of
> object (5-20)
> Anyway I will consider your "alarm" about performance.
Testing the attributes will not be slow. To be a little
more specific, after listing smb://, smb://workgroup/, or
smb://server/ some default attributes are assumed and cached for
jcifs.smb.client.attrExpirationPeriod milliseconds which is 5000 unless
specified otherwise. If you can test the attributes of each file in the
this in that time no extra calls will be made to the server. So if you
create a list of SmbFiles using listFiles() then wait 10 seconds and
then query each for an attribute it will be quite slow.
What I was trying to say would be slow would be trying to list the
contents of each share to see if it was truely accessable. That
would be slow. It would be slightly less slow to call exists on a
bogus file smb://server/share/dummy which will achive the same effect
without impolitely listing the contents of the open share. Or maybe
smb://server/share/*.mp3 would be better :~) Remember, wild cards are
supported by list and listFiles.
> thanks, as usual
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not
yet been conceived.
More information about the jcifs