示例#1
0
 /// <summary>
 ///Start recording metric data
 /// </summary>
 /// <param name="oid"></param>
 /// <param name="objType"></param>
 /// <param name="msgId"></param>
 public static void profileStart(String oid, short objType, String msgId)
 {
     com.OpenADK.sifprofiler.SIFProfilerClient c = com.OpenADK.sifprofiler.SIFProfilerClient.getInstance(fProfName);
     if (c != null)
     {
         c.metricStart(oid + "." + objType, msgId, objType);
     }
 }
示例#2
0
 /// <summary>
 ///Stop recording metric data
 /// </summary>
 public static void profileStop()
 {
     com.OpenADK.sifprofiler.SIFProfilerClient c = com.OpenADK.sifprofiler.SIFProfilerClient.getInstance(fProfName);
     if (c != null)
     {
         c.metricStop();
     }
 }
示例#3
0
        ///<summary>
        ///Called by the agent when it is ready to initialize the SIFProfilerClient instance
        ///of the ADK. This must be done after the agent has learned the Session ID to associate
        ///with all recorded metrics.
        ///</summary>
        public static void StartProfiling(int sessionId, ObjectTypeCodes otcImpl)
        {
            Adk.Log.Debug("SIFProfilerClient instance name: " + fProfName);
            ProfilerUtils.setProfilerSessionId(sessionId);
            ADK.getLog().debug("SIFProfilerClient session ID: " + fSessionId);


            com.OpenADK.sifprofiler.SIFProfilerClient prof =
                com.OpenADK.sifprofiler.SIFProfilerClient.getInstance(fProfName);
            if (prof != null)
            {
                try {
                    prof.setObjectTypeCodesImpl(otcImpl);
                    prof.open(new com.OpenADK.sifprofiler.api.ProfilerSession(ProfilerUtils.getProfilerSessionId()));
                } catch (Exception ex) {
                    Console.WriteLine("Failed to open SIFProfilerClient instance: " + ex);
                    System.exit(-1);
                }
            }
        }
示例#4
0
        public virtual void Shutdown(ProvisioningFlags provisioningOptions)
        {
            if (!fInit)
            {
                return;
            }

            fShutdownInProgress = true;
            if ((Adk.Debug & AdkDebugFlags.Lifecycle) != 0)
            {
                Log.Info("Shutting down agent...");
            }

            //	Close the SIFProfilerClient if supported
#if PROFILED
            {
                // TODO: Implement Support for Profiling
                com.OpenADK.sifprofiler.SIFProfilerClient prof =
                    com.OpenADK.sifprofiler.SIFProfilerClient.getInstance(ProfilerUtils.getProfilerName());
                if (prof != null)
                {
                    try
                    {
                        prof.close();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
#endif

            try
            {
                //  JAVA_TODO:  Unsubscribe, Unprovide topics

                //  Disconnect and shutdown each zone...
                IZoneFactory zf    = IZoneFactory;
                IZone[]      zones = zf.GetAllZones();
                for (int i = 0; i < zones.Length; i++)
                {
                    zones[i].Disconnect(provisioningOptions);
                    ((ZoneImpl)zones[i]).Shutdown();
                }

                if (fTransportManager != null)
                {
                    //  Shutdown transports
                    if ((Adk.Debug & AdkDebugFlags.Lifecycle) != 0)
                    {
                        Log.Info("Shutting down Transports...");
                    }
                    fTransportManager.Shutdown();
                }

                //  Close RequestCache
                try
                {
                    RequestCache rc = RequestCache.GetInstance(this);
                    if (rc != null)
                    {
                        rc.Close();
                    }
                }
                catch
                {
                    // Do nothing
                }

                if ((Adk.Debug & AdkDebugFlags.Lifecycle) != 0)
                {
                    Log.Debug("Agent shutdown complete");
                }
            }
            finally
            {
                fInit     = false;
                fShutdown = true;
            }
        }