get current service context

@param clear true: framework will clear the ThreadLocal when return
@return RPC Service Context, it can be null
437588
public static RpcServiceContext currentServiceContext(boolean clear) {
        try {
            RpcInvokeContext invokeCtx = RpcInvokeContext.getContext();
            return (RpcServiceContext) invokeCtx.get(RemotingConstants.INVOKE_CTX_RPC_SER_CTX);
        } finally {
            if (clear) {
                clearServiceContext();
            }
        }
    }
880452
public ThreadDelegatedContext getContext()
    {
        ThreadDelegatedContext context = threadLocal.get();
        if (context == null) {
            context = new ThreadDelegatedContext();
            threadLocal.set(context);
        }
        return context;
    }
201404
public ServiceReference<?>[] fetchReferences() {
        try {
            LOGGER.debug("Try to locate a suitable service for objectClass = "
                    + serviceInterface + " and filter = " + filterString);
            return bundleContext.getAllServiceReferences(serviceInterface, filterString);
        } catch (InvalidSyntaxException e) {
            LOGGER.error("Creation of filter failed: {}", e.getMessage(), e);
            throw new RuntimeException("Creation of filter failed", e);
        }
    }
963177
@Deprecated
    public static RequestQueue getRequestQueue(Context context) {
        if (InstanceRequestQueue == null) {
            InstanceRequestQueue = newRequestQueue(context);
        }
        return InstanceRequestQueue;
    }
1151779
public ServiceReference<T> getHighestRankedReference() {
        Iterator<ConcurrentServiceReferenceElement<T>> iterator = elementSet.iterator();
        return iterator.hasNext() ? iterator.next().getReference() : null;
    }
279893
@SuppressWarnings("unchecked")
  public ServiceRpc getRpc() {
    if (rpc == null) {
      rpc = serviceRpcFactory.create((OptionsT) this);
    }
    return rpc;
  }
1199939
public synchronized Set<Service> getServices() {
        checkInitialized();
        if (legacyChanged || servicesChanged) {
            serviceSet = null;
        }
        if (serviceSet == null) {
            ensureLegacyParsed();
            Set<Service> set = new LinkedHashSet<>();
            if (serviceMap != null) {
                set.addAll(serviceMap.values());
            }
            if (legacyMap != null) {
                set.addAll(legacyMap.values());
            }
            serviceSet = Collections.unmodifiableSet(set);
            servicesChanged = false;
        }
        return serviceSet;
    }
538045
public synchronized Name getServiceName() {
        if (size() < 2) {
            return null;
        }
        if (cachedServiceName == null) {
            cachedServiceName = getCompositeKey().getPrefix(size() - 1);
        }
        return cachedServiceName;
    }
493543
public static base_response clear(nitro_service client) throws Exception {
		nspbr6 clearresource = new nspbr6();
		return clearresource.perform_operation(client,"clear");
	}
65161
public com.google.appengine.v1.Service getService() {
    return service_ == null ? com.google.appengine.v1.Service.getDefaultInstance() : service_;
  }
1222480
@Override
	public Object getService(IServiceReference serviceReference) {
		final String sourceMethod = "getService"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(PlatformServicesImpl.class.getName(), sourceMethod, serviceReference);
		}
		Object result = null;
		BundleContext bundleContext = Activator.getBundleContext();
		if (bundleContext != null) {
			result = bundleContext
					.getService((ServiceReference<?>) serviceReference.getPlatformObject());
		}
		if (isTraceLogging) {
			log.exiting(PlatformServicesImpl.class.getName(), sourceMethod, result);
		}
		return result;
	}
1222334
public static boolean isExistAccessContextOnThread() {
        final Stack<AccessContext> stack = threadLocal.get();
        return stack != null ? !stack.isEmpty() : false;
    }
195162
public function getStreamContext()
    {
        return ($this->getSoapClient() && isset($this->getSoapClient()->_stream_context) && is_resource($this->getSoapClient()->_stream_context)) ? $this->getSoapClient()->_stream_context : null;
    }
315293
public com.google.api.Context getContext() {
    return context_ == null ? com.google.api.Context.getDefaultInstance() : context_;
  }
1232002
public boolean hasApplicationContext() {
        String filter = getApplicationContextFilter(bundleContext.getBundle().getSymbolicName());
        ServiceReference<?>[] references = null;
        try {
            references = bundleContext.getServiceReferences(getContainerClass().getName(), filter);
        } catch (InvalidSyntaxException e) {
            throw new IllegalStateException("not possible", e);
        }
        return references != null && references.length != 0;
    }
386024
public <S> S getService(final ServiceReference<S> reference, final BundleContext context) {
        if (System.getSecurityManager() == null)
            return context.getService(reference);
        return AccessController.doPrivileged(new PrivilegedAction<S>() {
            @Override
            public S run() {
                return context.getService(reference);
            }
        }, controlContext);
    }
1088207
public static base_response clear(nitro_service client) throws Exception {
		nsacls clearresource = new nsacls();
		return clearresource.perform_operation(client,"clear");
	}