Returns the current resource monitoring service client for RPC communications.
325521
def get_monitor() -> Optional[resource_pb2_grpc.ResourceMonitorStub]:
    
    monitor = SETTINGS.monitor
    if not monitor:
        require_test_mode_enabled()
    return monitor
1349719
public synchronized static BandwidthClient getInstance() {
        if (INSTANCE == null) {
            String userId = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_USER_ID);
            String apiToken = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_TOKEN);
            String apiSecret = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_SECRET);
            String apiEndpoint = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_ENDPOINT);
            String apiVersion = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_API_VERSION);
            String maxTotal = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_HTTP_MAX_TOTAL_CONNECTIONS);
            String defaultMaxPerRoute = System.getProperty(BandwidthConstants.BANDWIDTH_SYSPROP_HTTP_MAX_DEFAULT_CONNECTIONS_PER_ROUTE);

            if (userId == null || apiToken == null || apiSecret == null || apiEndpoint == null || apiVersion == null) {
                userId = System.getenv().get(BandwidthConstants.BANDWIDTH_USER_ID);
                apiToken = System.getenv().get(BandwidthConstants.BANDWIDTH_API_TOKEN);
                apiSecret = System.getenv().get(BandwidthConstants.BANDWIDTH_API_SECRET);
                apiEndpoint = System.getenv().get(BandwidthConstants.BANDWIDTH_API_ENDPOINT);
                apiVersion = System.getenv().get(BandwidthConstants.BANDWIDTH_API_VERSION);
            }

            if (maxTotal == null) {
                maxTotal = System.getenv().get(BandwidthConstants.BANDWIDTH_HTTP_MAX_TOTAL_CONNECTIONS);
            }

            Integer maxTotalNum=null;
            if (maxTotal != null) {
                try {
                    maxTotalNum = Integer.parseInt(maxTotal);
                } catch (NumberFormatException ex) {
                    throw new RuntimeException(String.format("Invalid parameter for MAX_TOTAL_CONNECTIONS %s", maxTotal), ex);
                }
            }

            if (defaultMaxPerRoute == null) {
                defaultMaxPerRoute = System.getenv().get(BandwidthConstants.BANDWIDTH_HTTP_MAX_DEFAULT_CONNECTIONS_PER_ROUTE);
            }

            Integer defaultMaxPerRouteNum=null;
            if (defaultMaxPerRoute != null) {
                try {
                    defaultMaxPerRouteNum = Integer.parseInt(defaultMaxPerRoute);
                } catch (NumberFormatException ex) {
                    throw new RuntimeException(String.format("Invalid parameter for MAX_DEFAULT_CONNECTIONS_PER_ROUTE %s", defaultMaxPerRoute), ex);
                }
            }

            INSTANCE = new BandwidthClient(userId, apiToken, apiSecret, apiEndpoint, apiVersion, maxTotalNum, defaultMaxPerRouteNum);

            if (userId != null || apiToken != null || apiSecret != null) {
                validateCredentials();
            }
        }
        return INSTANCE;
    }
377184
private ClientSocket openRecycle()
  {
    long now = CurrentTime.currentTime();
    ClientSocket stream = null;

    synchronized (this) {
      if (_idleHead != _idleTail) {
        stream = _idle[_idleHead];
        long freeTime = stream.getIdleStartTime();

        _idle[_idleHead] = null;
        _idleHead = (_idleHead + _idle.length - 1) % _idle.length;

        // System.out.println("RECYCLE: " + stream + " " + (freeTime - now) + " " + _loadBalanceIdleTime);
        
        if (now < freeTime + _loadBalanceIdleTime) {
          _activeCount.incrementAndGet();
          _keepaliveCountTotal++;

          stream.clearIdleStartTime();
          stream.toActive();

          return stream;
        }
      }
    }

    if (stream != null) {
      if (log.isLoggable(Level.FINER))
        log.finer(this + " close idle " + stream
                  + " expire=" + QDate.formatISO8601(stream.getIdleStartTime() + _loadBalanceIdleTime));

      stream.closeImpl();
    }

    return null;
  }
1191574
function getServer() {
  var server = new grpc.Server();
  server.addService(services.RouteGuideService, {
    getFeature: getFeature,
    listFeatures: listFeatures,
    recordRoute: recordRoute,
    routeChat: routeChat
  });
  return server;
}
880575
def client(self):
        
        if self._client is None:
            self._client = KeycloakClient(server_url=self._server_url,
                                          headers=self._headers)
        return self._client
268955
public com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomer getClient() {
        return client;
    }
521659
def current(cls):
        
        name = socket.getfqdn()
        ip = socket.gethostbyname(name)

        return cls(name, ip)
358661
def monitored_resource_descriptor_path(cls, project, monitored_resource_descriptor):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}",
            project=project,
            monitored_resource_descriptor=monitored_resource_descriptor,
        )
1048725
public int get_rpc_protocol(final DeviceProxy deviceProxy) throws DevFailed {
        checkIfTaco(deviceProxy, "get_rpc_protocol");

        build_connection(deviceProxy);

        return deviceProxy.taco_device.get_rpc_protocol();
    }
338757
private Client getClient() {
        Client client = hostMap.get(basePath);
        if (client!=null) return client;

        final ClientConfig clientConfig = new ClientConfig();
        clientConfig.register(MultiPartFeature.class);
        if (debug) {
            clientConfig.register(LoggingFilter.class);
        }
        client = ClientBuilder.newClient(clientConfig);

        hostMap.putIfAbsent(basePath, client);
        return hostMap.get(basePath); //be sure to use the same in case of a race condition.
    }
675127
function Client(rwStream, options)
{
	events.EventEmitter.call(this);
	
	var tidCounter = 0;
	var requestMap = {};
	var isClosed = true;
	var address = '';
	var host = '';
	
	var idlePingTimeout 	= getOption(options, 'idlePingTimeout',		0);
	var idleCloseTimeout	= getOption(options, 'idleCloseTimeout',	0);
	var autoRegister		= getOption(options, 'autoRegister', 		false);
	var logConnection		= getOption(options, 'logConnection', 		true);
	var autoResponseUnhandledCommand = getOption(options, 'autoResponseUnhandledCommand', true);
	
	this.isServer = options.isServer;
	
	function getAddress()
	{
		return util.format('%s:%s', rwStream.remoteAddress.replace(/^::ffff:/i, ''), rwStream.remotePort);		
	}
	
	function log(event)
	{
		if ( logConnection )
		{
			console.log(util.format('%s %s(%s)', event, host, address));
		}
	}
	
	this.closeStream = function() {

		//console.log('isClosed ' + isClosed);
		
		if ( !isClosed )
		{
			isClosed = true;
			
			log('CLOSE');
			
			if ( rwStream instanceof stream.Writable )
			{
				rwStream.end();
			}
		
			for ( var tid in requestMap )
			{
				if ( requestMap.hasOwnProperty(tid) )
				{
					clearTimeout(requestMap[tid].timer);
					requestMap[tid].callback({code: '500', tid: tid, args: ['socket_closed'], body: null, isValid: true});
					delete requestMap[tid];
				}
			}
			
			this.emit('close');
		}
	};
	
	if ( rwStream instanceof stream.Writable )
	{
		this.sendMessage = function(code, tid, args, body, callback) {
			var bodyBuf = Buffer.isBuffer(body) ? body : 
				typeof(body) === 'string' ? Buffer.from(body) : 
					null;
			tid = tid === -1 ? ++tidCounter : tid;
			tid = '' + tid;
			var bodyLen = bodyBuf ? bodyBuf.length : 0;
			var header = util.format('%s %s %d%s\r\n', code, tid, bodyLen, encodeArgs(args));
			var headerLen = Buffer.byteLength(header);
			var msg = {code: code, tid: tid, args: args, body: body};
			if ( options.debugHeader )
			{
				console.log("send msg: %s", msg2str(msg));
			}
			rwStream.write(header, callback);
			if ( bodyLen > 0 )
			{
				rwStream.write(bodyBuf);
			}
		};

		this.sendRequest = function(code, args, body, timeout, callback) {
			var tid = ++tidCounter;
			this.sendMessage(code, tid, args, body);
			requestMap[tid] = {
				callback: callback,
				timer: setTimeout(() => this.emit('message_timeout', tid), timeout)
			};
		};
	}
	
	if ( rwStream instanceof stream.Readable )
	{
		var parser = textParser.createParser((msg) => {

			if ( options.debugHeader )
			{
				console.log("recv msg: %s", msg2str(msg));
			}

			if ( !msg.isValid && this.sendMessage )
			{
				this.sendMessage('201', 0, 'invalid_command');
			}
			else
			{
				if ( /^\d+$/.test(msg.code) )
				{
					var tid = msg.tid !== null && /^\d+$/.test(msg.tid) ? msg.tid * 1 : 0;
					
					if ( tid > 0 )
					{
						if ( requestMap.hasOwnProperty(msg.tid) )
						{
							clearTimeout(requestMap[msg.tid].timer);
							requestMap[msg.tid].callback(msg);
							delete requestMap[msg.tid];
						}
						else
						{
							console.log(util.format('ERR dangling response: %s %s [%s]', msg.code, msg.tid, msg.args.join(' ')));
						}
					}
					else
					{
						console.log(util.format('ERR invalid tid: %s %s [%s]', msg.code, msg.tid, msg.args.join(' ')));
					}
				}
				else
				{
					var isHandled = false;
					
					if ( this.listenerCount(msg.code) > 0 )
					{
						isHandled = true;
						this.emit(msg.code, msg);
					}
					
					if ( this.listenerCount('message') > 0 )
					{
						isHandled = true;
						this.emit('message', msg);
					} 
					
					if ( !isHandled && autoResponseUnhandledCommand && this.sendMessage )
					{
						this.sendMessage('201', msg.tid, 'unknown_command');
					}
				}
			}
		});
		
		rwStream.on('data', (data) => {
			parser.feed(data);
		});
		
		rwStream.on('end', (e) => {
			this.closeStream();
		});
	}
	
	if ( rwStream instanceof net.Socket )
	{
		if ( !rwStream.connecting )
		{
			this.address = address = getAddress();
			isClosed = false;
			log('ACCEPT');
		}

		if ( idlePingTimeout > 0 )
		{
			rwStream.setTimeout(idlePingTimeout);
		}
		else if ( idleCloseTimeout > 0 )
		{
			rwStream.setTimeout(idleCloseTimeout);
		}
		
		rwStream.on('timeout', () => {
			if ( idlePingTimeout > 0 )
			{
				this.sendMessage('PING', 0, [], null);
				log('PING');
			}
			else if ( idleCloseTimeout > 0 )
			{
				this.closeStream();
			}
			else
			{
				this.emit('timeout');
			}
		});
		
		rwStream.on('connect', () => {
			this.address = address = getAddress();
			isClosed = false;
			log('CONNECT');
			if ( autoRegister )
			{
				this.sendMessage('RGST', 0, os.hostname());
				log('RGST');
			}
			this.emit('connect');
		});
		
		rwStream.on('close', (had_error) => {
			this.closeStream();
		});
		
		this._getSessionManager = function() {
			if ( !this.sessionManager )
			{
				this.sessionManager = new SessionManager(this, options);
			}
			return this.sessionManager;
		};
		
		this.onSession = function(protocol, callback) {
			var smgr = this._getSessionManager();
			var listener_options = Object.assign({}, options, {protocol: protocol});
			var slnr = new SessionListener(listener_options);
			slnr.on('session', callback);
			smgr.registerListener(slnr);
		};
		
		this.createSession = function(protocol, session_args) {
			var smgr = this._getSessionManager();
			var session_options = Object.assign({}, options, {protocol: protocol, session_args: session_args});
			return smgr.createSession(session_options);
		};
	} 
	
	rwStream.on('error', (e) => {
		log('ERROR ' + e.message);
		this.closeStream();
		this.emit('error', e);
	});
	
	this.on('message_timeout', (tid) => {
		if ( requestMap.hasOwnProperty(tid) )
		{
			requestMap[tid].callback({code: '500', tid: tid, args:['message_timeout'], body: null, isValid: true});
			delete requestMap[tid];
		}
	});
	
	this.on('RGST', (msg) => {
		host = msg.args.length > 0 ? msg.args[0] : '';
		log('RGST');
	});
	
	this.on('PING', (msg) => {
		log('PING');
	});
}
465829
def client(self):
        
        if self._client is None:
            self._client = Client_(self.servers)
        return self._client
702981
public static systemcounters get(nitro_service service) throws Exception{
		systemcounters obj = new systemcounters();
		systemcounters[] response = (systemcounters[])obj.get_resources(service);
		return response[0];
	}
383415
@Override
    public Client getClientInstance()
    {
        // if threadsafe recycle the same single instance; if not create a new
        // instance

        if (isThreadSafe())
        {
            logger.info("Returning threadsafe used client instance for persistence unit : " + persistenceUnit);
            if (client == null)
            {
                client = instantiateClient(persistenceUnit);
            }
        }
        else
        {
            logger.debug("Returning fresh client instance for persistence unit : " + persistenceUnit);
            // no need to hold a client reference.
            return instantiateClient(persistenceUnit);
        }

        return client;
    }
46265
def client(cls, config):
        
        if not hasattr(cls, "_client"):
            cls._client = statsd.StatsClient(config.STATSD_HOST, config.STATSD_PORT, config.STATSD_PREFIX)
        return cls._client
1338457
def get_snmp_service(self):
        
        return SnmpContextManager(self.enable_flow, self.disable_flow, self._snmp_parameters, self._logger)
36341
def get_resource_usage(self):
        
        response = self._send(http_method='GET',
                              location_id='3813d06c-9e36-4ea1-aac3-61a485d60e3d',
                              version='5.0-preview.2')
        return self._deserialize('BuildResourceUsage', response)