Exemplo n.º 1
0
        /// <summary> Creates a new instance that uses the given resources.
        ///
        /// </summary>
        /// <param name="theRouter">
        /// </param>
        /// <param name="theTransport">a <code>TransportLayer</code> used for both locally-initiated
        /// and remotely-initiated message exchanges
        /// </param>
        /// <param name="theStorage">
        /// </param>
        public NuGenProcessorContextImpl(NuGenApplicationRouter theRouter, NuGenTransportLayer theTransport, NuGenSafeStorage theStorage)
        {
            myRouter = theRouter;
            myRemotelyDrivenTransport = theTransport;
            myLocallyDrivenTransport  = theTransport;
            mySafeStorage             = theStorage;

            myValidators     = new System.Collections.ArrayList(8);
            myMetadataFields = new System.Collections.ArrayList(30);
        }
Exemplo n.º 2
0
 /// <summary> Tries to send the message, and if there is an error reconnects and tries again. </summary>
 private void  trySend(NuGenTransportLayer theTransport, NuGenTransportable theTransportable)
 {
     try
     {
         theTransport.send(theTransportable);
     }
     catch (NuGenTransportException)
     {
         theTransport.disconnect();
         theTransport.connect();
         theTransport.send(theTransportable);
     }
 }
Exemplo n.º 3
0
        /// <summary> Tries to receive a message, and if there is an error reconnects and tries again. </summary>
        private NuGenTransportable tryReceive(NuGenTransportLayer theTransport)
        {
            NuGenTransportable message = null;

            try
            {
                message = theTransport.receive();
            }
            catch (NuGenTransportException)
            {
                theTransport.disconnect();
                theTransport.connect();
                message = theTransport.receive();
            }
            return(message);
        }
Exemplo n.º 4
0
        /// <summary> Accepts a single inbound connection if the same ServerSocket is used for
        /// all message exchanges, or a connection from each if two ServerSockets are
        /// being used.
        ///
        /// </summary>
        /// <param name="theAddress">the IP address from which to accept connections (null means
        /// accept from any address).  Connection attempts from other addresses will
        /// be ignored.
        /// </param>
        /// <returns> a <code>Processor</code> connected to the given address
        /// </returns>
        /// <throws>  TransportException </throws>
        public virtual NuGenProcessor accept(System.String theAddress)
        {
            NuGenTransportLayer   transport = getTransport(myServerSocket, theAddress);
            NuGenProcessorContext context   = null;

            if (myServerSocket2 == null)
            {
                //we're doing inbound & outbound on the same port
                transport.connect();
                context = new NuGenProcessorContextImpl(myRouter, transport, myStorage);
            }
            else
            {
                NuGenTransportLayer         transport2 = getTransport(myServerSocket2, theAddress);
                NuGenDualTransportConnector connector  = new NuGenDualTransportConnector(transport, transport2);
                connector.connect();

                context = new NuGenProcessorContextImpl(myRouter, transport, transport2, myStorage);
            }
            return(new NuGenProcessorImpl(context, true));
        }
 /// <param name="theTransportA">one <code>TransportLayer</code> we will want to connect
 /// </param>
 /// <param name="theTransportB">another one
 /// </param>
 public NuGenDualTransportConnector(NuGenTransportLayer theTransportA, NuGenTransportLayer theTransportB)
 {
     myTransportA = theTransportA;
     myTransportB = theTransportB;
 }
 public ConnectThread(NuGenTransportLayer theTransport)
 {
     myTransport = theTransport;
 }
		/// <summary> Creates a new instance that uses the given resources.  
		/// 
		/// </summary>
		/// <param name="theRouter">
		/// </param>
		/// <param name="theLocallyDrivenTransport">a <code>TransportLayer</code> used for locally-initiated
		/// and message exchanges 
		/// </param>
		/// <param name="theRemotelyDrivenTransport">a <code>TransportLayer</code> used for remotely-initiated
		/// and message exchanges 
		/// </param>
		/// <param name="theStorage">
		/// </param>
		public NuGenProcessorContextImpl(NuGenApplicationRouter theRouter, NuGenTransportLayer theLocallyDrivenTransport, NuGenTransportLayer theRemotelyDrivenTransport, NuGenSafeStorage theStorage)
		{
			
			myRouter = theRouter;
			myRemotelyDrivenTransport = theRemotelyDrivenTransport;
			myLocallyDrivenTransport = theLocallyDrivenTransport;
			mySafeStorage = theStorage;
			
			myValidators = new System.Collections.ArrayList(8);
			myMetadataFields = new System.Collections.ArrayList(30);
		}