[jcifs] [PATCH] WaitNamedPipe example is not complete

Michael B Allen mba2000 at ioplex.com
Fri Sep 16 22:25:32 GMT 2005


On Fri, 16 Sep 2005 15:53:13 -0500
ddkilzer at kilzer.net (David D. Kilzer) wrote:

> The WaitNamedPipe example class in jCIFS is not complete.  Per the MSDN
> documentation on the WaitNamedPipe() method [1] and a Microsoft
> knowledgebase article about named pipes and SQL Server 6.5/7 [2], this
> method is supposed to retry the connection to the named pipe if an "All
> pipe instances are busy" error message (error code 231; "connection
> busy" or "pipe busy") is received while connecting.
> 
> To make WaitNamedPipe behave more like its namesake, the changes in the
> attached patch should be applied.  NOTE:  THESE CHANGES ARE UNTESTED!
> The SmbNamedPipe.getNamedPipeInputStream() method may also have to be
> wrapped.  Also note that I did not implement the "indefinite wait"
> feature, although a sufficiently large long value would suffice.

I think the correct way to fix this would be to alter the three instances
of TransWaitNamedPipe between jcifs/smb/SmbFileOutputStream.java and
jcifs/smb/TransactNamedPipeOutputStream.java. Or rather replace them with
some kind of 'connect' or 'open' method that catches the SmbException
and checks for NT_STATUS_PIPE_BUSY.

But if you want to use the current jCIFS I think the patch would be
better if you casted that IOException to SmbException and checked to
see if ex.getNtStatus() == NT_STATUS_PIPE_BUSY.

> I made similar changes to the jTDS JDBC driver [3] which have been
> tested in our development environment against SQL Server 6.5 and are
> working fine.  Note that these changes to jTDS wrapped both the
> SmbNamedPipe.getNamedPipeOutputStream() and getNamedPipeInputStream()
> methods, as well as the SmbNamedPipe constructor.  See also jTDS Bug
> 1277000 [4].
> 
> Dave
> 
> [1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/waitnamedpipe.asp
> [2] http://support.microsoft.com/default.aspx?scid=KB;EN-US;165189
> [3] http://cvs.sourceforge.net/viewcvs.py/jtds/jtds/src/main/net/sourceforge/jtds/jdbc/ConnectionJDBC2.java?r1=1.96&r2=1.97
> [4] http://sourceforge.net/tracker/index.php?func=detail&aid=1277000&group_id=33291&atid=407762
> 


More information about the jcifs mailing list