パッケージ jcifs.util.transport

クラス Transport

  • すべての実装されたインタフェース:
    AutoCloseable, Runnable

    public abstract class Transport
    extends Object
    implements Runnable, AutoCloseable
    This class simplifies communication for protocols that support multiplexing requests. It encapsulates a stream and some protocol knowledge (provided by a concrete subclass) so that connecting, disconnecting, sending, and receiving can be syncronized properly. Apparatus is provided to send and receive requests concurrently.
    • フィールドの詳細

      • state

        protected volatile int state
      • inLock

        protected final Object inLock
      • outLock

        protected final Object outLock
    • コンストラクタの詳細

      • Transport

        public Transport()
    • メソッドの詳細

      • readn

        public static int readn​(InputStream in,
                                byte[] b,
                                int off,
                                int len)
                         throws IOException
        Read bytes from the input stream into a buffer
        パラメータ:
        in -
        b -
        off -
        len -
        戻り値:
        number of bytes read
        例外:
        IOException
      • acquire

        public Transport acquire()
        戻り値:
        session increased usage count
      • release

        public void release()
      • getUsageCount

        protected long getUsageCount()
        戻り値:
        the number of known usages
      • isDisconnected

        public boolean isDisconnected()
        戻り値:
        whether the transport is disconnected
      • isFailed

        public boolean isFailed()
        戻り値:
        whether the transport is marked failed
      • sendrecv

        public <T extends Response> T sendrecv​(Request request,
                                               T response,
                                               Set<RequestParam> params)
                                        throws IOException
        Send a request message and recieve response
        パラメータ:
        request -
        response -
        params -
        戻り値:
        the response
        例外:
        IOException
      • handleIntermediate

        protected <T extends Response> boolean handleIntermediate​(Request request,
                                                                  T response)
        パラメータ:
        request -
        response -
        戻り値:
      • getResponseTimeout

        protected abstract int getResponseTimeout​(Request request)
        パラメータ:
        request -
        戻り値:
      • doDisconnect

        protected abstract boolean doDisconnect​(boolean hard,
                                                boolean inUse)
                                         throws IOException
        例外:
        IOException
      • connect

        public boolean connect​(long timeout)
                        throws TransportException
        Connect the transport
        パラメータ:
        timeout -
        戻り値:
        whether the transport was connected
        例外:
        TransportException
      • disconnect

        public boolean disconnect​(boolean hard)
                           throws IOException
        Disconnect the transport
        パラメータ:
        hard -
        戻り値:
        whether conenction was in use
        例外:
        IOException
      • disconnect

        public boolean disconnect​(boolean hard,
                                  boolean inUse)
                           throws IOException
        Disconnect the transport
        パラメータ:
        hard -
        inUse - whether the caller is holding a usage reference on the transport
        戻り値:
        whether conenction was in use
        例外:
        IOException
      • run

        public void run()
        定義:
        run インタフェース内 Runnable