예제 #1
0
 /// <exception cref="System.IO.IOException"/>
 public UplinkReaderThread(InputStream stream, UpwardProtocol <K2, V2> handler, K2
                           key, V2 value)
 {
     inStream     = new DataInputStream(new BufferedInputStream(stream, BufferSize));
     this.handler = handler;
     this.key     = key;
     this.value   = value;
 }
예제 #2
0
        /// <summary>Create a proxy object that will speak the binary protocol on a socket.</summary>
        /// <remarks>
        /// Create a proxy object that will speak the binary protocol on a socket.
        /// Upward messages are passed on the specified handler and downward
        /// downward messages are public methods on this object.
        /// </remarks>
        /// <param name="sock">The socket to communicate on.</param>
        /// <param name="handler">The handler for the received messages.</param>
        /// <param name="key">The object to read keys into.</param>
        /// <param name="value">The object to read values into.</param>
        /// <param name="config">The job's configuration</param>
        /// <exception cref="System.IO.IOException"/>
        public BinaryProtocol(Socket sock, UpwardProtocol <K2, V2> handler, K2 key, V2 value
                              , JobConf config)
        {
            OutputStream raw = sock.GetOutputStream();

            // If we are debugging, save a copy of the downlink commands to a file
            if (Submitter.GetKeepCommandFile(config))
            {
                raw = new BinaryProtocol.TeeOutputStream("downlink.data", raw);
            }
            stream = new DataOutputStream(new BufferedOutputStream(raw, BufferSize));
            uplink = new BinaryProtocol.UplinkReaderThread <K2, V2>(sock.GetInputStream(), handler
                                                                    , key, value);
            uplink.SetName("pipe-uplink-handler");
            uplink.Start();
        }
예제 #3
0
 public BinaryProtocol(Stream down, DownwardProtocol handler, Stream up)
 {
     this.down = down;
     this.uplink = new BinaryUpwardProtocol(up);
     this.handler = handler;
 }
예제 #4
0
 public void SetProtocol(Protocol protocol, UpwardProtocol uplink)
 {
     this.protocol = protocol;
     this.uplink = uplink;
 }