但是服务定位器不应包含资源缓存。
But the service locator should not include a resource cache.
我第二个实现使用了缓存服务定位器。
我的第三个实现使用没有缓存的服务定位器。
My third implementation used a service locator with no cache.
要解决由服务定位器导致的问题的难度有多大呢?
How hard will it be to figure out that the service locator is causing the problem?
重载资源名使得服务定位器与其缓存之间变得混乱。
So overloaded resource names mess up a service locator and its cache.
为了安全,你需要用一种机制来锁定服务定位器并使之只读。
To make this safe, you need to have a mechanism to lock the service locator and make it read only.
由于缓存服务定位器的原因,两个bean现在使用相同数据源。
Because of the caching service locator, the two beans are now using the same data source.
服务定位器代码两次查找资源,因为第一次查找没有被缓存起来。
The service locator's code looks up the resource both times because the first lookup is not cached. Here is the output
模块化模式:分离界面和插件、服务定位、事件聚合、外观模式。
Modularity patterns: Separated Interface and Plug In, Service Locator, Event Aggregator, facade.
服务定位器实现通常包括资源缓存,以此来避免对相同资源的重复查找。
Service locator implementations usually include a resource cache to avoid repeated lookups of the same resource.
我们为Cairngorm提供了一个可配置在IoC容器中的服务定位器。
For Cairngorm, we offer a service locator that can be configured in the IoC container.
业务逻辑代码使用服务定位器避免目录查找代码变得混乱,因此它很容易理解。
Business logic code that USES a service locator avoids becoming cluttered with directory lookup code, and so is easier to understand.
将其应用于现有应用程序很简单:只要改变服务定位器实现去禁止或去除缓存。
This is simple to apply to an existing application: just change the service locator implementation to disable or remove the cache.
我的第一个实现没有使用服务定位器,bean本身执行所有的JNDI代码。
My first implementation used no service locator; the beans performed all of the JNDI code themselves. Here are the two toString 's I got.
因此,在J2EE 1.3应用程序中,服务定位器的实现不应该包含资源缓存。
Therefore, J2EE 1.3 applications should not include the resource cache in their service locator implementations.
不要只假设缓存服务定位器能显著的提高应用程序的性能,要使用性能测试来证明这一点。
Do not just assume that a caching service locator significantly improves application performance; use performance testing to confirm that it does.
凡是在遗留代码集中出现单件查找的地方,稍加修改即可换用服务定位器来查找同样的组件。
Wherever there are singleton lookup in the legacy codebase, a small change is made to lookup the same component via the service locator instead.
包含缓存服务定位器的应用程序迟早要出问题,而且这个问题将很难检测、很难再现且很难诊断。
Applications that contain a caching service locator are a problem waiting to happen — a problem that will be difficult to detect, difficult to reproduce reliably, and difficult to diagnose.
客户端为资源传递一个唯一的标识符(资源名),服务定位器找到这个资源并把它返回给客户端。
The client passes in a unique identifier — a resource name — for the resource; the service locator finds the resource and returns it to the client.
迈向服务定位器设计、摆脱单件血统的第一个组件是不依赖于其它单件、但被其它单件依赖的组件。
The first component to move towards the service locator design, and away from its singleton origins, is the one that depends on no other singletons, yet may be depended by other singletons.
缓存引用的服务定位器将导致J2EE 1.3(以及以后版本)中有重载资源名的应用程序工作不正常。
A service locator that caches references will cause a J2EE 1.3 (and later) application with an overloaded resource name to work incorrectly.
业务定位程序可以采用多种形式,比如Web服务定位程序、EJB组件定位程序或者JMS定位程序。
A business locator can take many forms — for instance, it could be a web service locator, an EJB component locator, or a JMS locator.
当两个组件使用一个重载的资源名,也就是说,一个名称绑定到两个不同的资源,缓存服务定位器为两个组件返回相同的资源。
When two components use a resource name that is overloaded — that is, a name that is bound to two different resources — a caching service locator returns the same resource to both components.
应该在main方法结束的地方、调用任何启动生命周期方法之前调用lock方法锁定服务定位器,这样可以有效地防止误用。
That lock method would be called at the end of the main method before any start lifecycle were invoked and would very effectively prevent misuse.
其思想是在程序的入口(main方法?) ,把与服务名对应的实例填充进服务定位器,单元测试的时候可以混合使用真实或模拟的实例来填充。
The idea is that in a boot-like place (the main method?) it is populated with appropriate instances for the service names, and that unit tests can program it with a mix of real and mock instances.
GPSIII将改善定位、导航和定时服务,并提供先进的抗干扰能力,提供优秀的系统安全、精度和可靠性。
GPS III will improve position, navigation and timing services and provide advanced anti-jam capabilities yielding superior system security, accuracy and reliability.
当然,定位服务的种类有很多种。
在撰写本文时InternetExplorer不支持定位服务。
At the writing of this article, Internet Explorer does not support location services.
前端web页面使用webkit浏览器支持的定位服务来获取用户的GPS坐标。
The front-end web page USES the location services supported by webkit browsers to get the GPS coordinates of the user.
前端web页面使用webkit浏览器支持的定位服务来获取用户的GPS坐标。
The front-end web page USES the location services supported by webkit browsers to get the GPS coordinates of the user.
应用推荐