Beispiel #1
0
 public void register(Selector mSelector, int opRead, object client)
 {
     throw new NotImplementedException();
 }
Beispiel #2
0
		/// <summary>
		/// Register the debugger's listen socket with the Selector.
		/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void registerListener(java.nio.channels.Selector sel) throws java.io.IOException
		internal virtual void registerListener(Selector sel)
		{
			mListenChannel.register(sel, SelectionKey.OP_ACCEPT, this);
		}
Beispiel #3
0
        /// <summary>
        /// Watch for activity from clients and debuggers.
        /// </summary>
        public void run()
        {
            Log.d("ddms", "Monitor is up");

            // create a selector
            try
            {
                mSelector = Selector.open();
            }
            catch (IOException ioe)
            {
                Log.logAndDisplay(Log.LogLevel.ERROR, "ddms", "Failed to initialize Monitor Thread: " + ioe.Message);
                return;
            }

            while (!mQuit)
            {

                try
                {
                    /*
                     * sync with new registrations: we wait until addClient is done before going through
                     * and doing mSelector.select() again.
                     * @see {@link #addClient(Client)}
                     */
                    lock (mClientList)
                    {
                    }

                    // (re-)open the "debug selected" port, if it's not opened yet or
                    // if the port changed.
                    try
                    {
                        if (AndroidDebugBridge.clientSupport)
                        {
                            if ((mDebugSelectedChan == null || mNewDebugSelectedPort != mDebugSelectedPort) && mNewDebugSelectedPort != -1)
                            {
                                if (reopenDebugSelectedPort())
                                {
                                    mDebugSelectedPort = mNewDebugSelectedPort;
                                }
                            }
                        }
                    }
                    catch (IOException ioe)
                    {
                        Log.e("ddms", "Failed to reopen debug port for Selected Client to: " + mNewDebugSelectedPort);
                        Log.e("ddms", ioe);
                        mNewDebugSelectedPort = mDebugSelectedPort; // no retry
                    }

                    int count;
                    try
                    {
                        count = mSelector.select();
                    }
                    catch (Exception ioe)
                    {
                        Console.WriteLine(ioe.ToString());
                        Console.Write(ioe.StackTrace);
                        continue;
                    }
                    /*catch (CancelledKeyException cke)
                    {
                        continue;
                    }*/

                    if (count == 0)
                    {
                        // somebody called wakeup() ?
                        // Log.i("ddms", "selector looping");
                        continue;
                    }

                    var keys = mSelector.selectedKeys();
                    foreach (var key in keys)
                    {
                        //SelectionKey key = iter.Current;
                        //iter.remove();

                        try
                        {
                            if (key.attachment() is Client)
                            {
                                processClientActivity(key);
                            }
                            else if (key.attachment() is Debugger)
                            {
                                processDebuggerActivity(key);
                            }
                            else if (key.attachment() is MonitorThread)
                            {
                                processDebugSelectedActivity(key);
                            }
                            else
                            {
                                Log.e("ddms", "unknown activity key");
                            }
                        }
                        catch (Exception e)
                        {
                            // we don't want to have our thread be killed because of any uncaught
                            // exception, so we intercept all here.
                            Log.e("ddms", "Exception during activity from Selector.");
                            Log.e("ddms", e);
                        }
                    }
                }
                catch (Exception e)
                {
                    // we don't want to have our thread be killed because of any uncaught
                    // exception, so we intercept all here.
                    Log.e("ddms", "Exception MonitorThread.run()");
                    Log.e("ddms", e);
                }
            }
        }
 public void register(Selector sel, int opAccept, object client)
 {
     throw new NotImplementedException();
 }
 public void register(Selector sel, int opAccept, object client)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
		/// <summary>
		/// Registers the client with a Selector.
		/// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: void register(java.nio.channels.Selector sel) throws java.io.IOException
		internal virtual void register(Selector sel)
		{
			if (mChan != null)
			{
				mChan.register(sel, SelectionKey.OP_READ, this);
			}
		}
Beispiel #7
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private void startDeviceMonitorThread() throws java.io.IOException
        private void startDeviceMonitorThread()
		{
			mSelector = Selector.open();
            
            var thread = new Thread(deviceClientMonitorLoop);
            thread.Name = "Device Client Monitor";
            thread.Start();
		}