2010-01-14 5 views
0

service lifecycle에있는 문서에 따라 예외를 발생시킵니다. RegistryShutdownListener를 구현하고 내 리소스를 정리할 수 있어야합니다 (이 경우, threadpool을 종료하십시오). 그러나 예외가 발생하고 서비스를 다시 초기화하려고하는 것 같습니다. 청취 청취자를 수행하기 위해!?RegistryShutdownListener가

2010-01-14 10:59:01,750 [main] ERROR org.apache.hivemind.impl.ShutdownCoordinatorImpl - Unable to shutdown <SingletonProxy for svc.MyService($MyService_1262a1db992)>: Unable to construct service svc.MyService: The HiveMind Registry has been shutdown. 
org.apache.hivemind.ApplicationRuntimeException: Unable to construct service svc.MyService: The HiveMind Registry has been shutdown. 
    at org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewServiceImplementation(AbstractServiceModelImpl.java:166) 
    at org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServiceImplementation(AbstractServiceModelImpl.java:140) 
    at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualServiceImplementation(SingletonServiceModel.java:69) 
    at $$MyService_1262a1db992_1262a1db994._service($$MyService_1262a1db992_1262a1db994.java) 
    at $$MyService_1262a1db992_1262a1db994.registryDidShutdown($$MyService_1262a1db992_1262a1db994.java) 
    at $$MyService_1262a1db992_1262a1db993.registryDidShutdown($$MyService_1262a1db992_1262a1db993.java) 
    at org.apache.hivemind.impl.ShutdownCoordinatorImpl.shutdown(ShutdownCoordinatorImpl.java:97) 
    at org.apache.hivemind.impl.ShutdownCoordinatorImpl.shutdown(ShutdownCoordinatorImpl.java:80) 
    at org.apache.hivemind.impl.RegistryInfrastructureImpl.shutdown(RegistryInfrastructureImpl.java:379) 
    at org.apache.hivemind.impl.RegistryImpl.shutdown(RegistryImpl.java:94) 
    at org.apache.tapestry.ApplicationServlet.destroy(ApplicationServlet.java:322) 
    at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1394) 
    ... 
Caused by: org.apache.hivemind.ApplicationRuntimeException: The HiveMind Registry has been shutdown. 
    at org.apache.hivemind.impl.RegistryInfrastructureImpl.checkShutdown(RegistryInfrastructureImpl.java:404) 
    at org.apache.hivemind.impl.RegistryInfrastructureImpl.getServicePoint(RegistryInfrastructureImpl.java:153) 
    at org.apache.hivemind.impl.ModuleImpl.getServicePoint(ModuleImpl.java:169) 
    at org.apache.hivemind.impl.InvokeFactoryServiceConstructor.setupFactoryAndParameters(InvokeFactoryServiceConstructor.java:78) 
    at org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServiceImplementation(InvokeFactoryServiceConstructor.java:55) 
    at org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructCoreServiceImplementation(AbstractServiceModelImpl.java:108) 
    at org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewServiceImplementation(AbstractServiceModelImpl.java:158) 
    ... 31 more 

Hivemodule.xml :

<service-point id="MyService" interface="package.MyService"> 
    <invoke-factory><construct class="package.MyService" /></invoke-factory> 
</service-point> 

package.MyService.java :

public class MyService implements RegistryShutdownListener 
{ 
... 
    private ExecutorService executors; 

    private void intitialise() 
    { 
... 
    executors = Executors.newFixedThreadPool(3); 
... 
    } 

... 

    @Override 
    public void registryDidShutdown() 
    { 
     if (executors.isShutdown()) 
      return; 
     executors.shutdown(); 
    } 
} 

추신 : 난 당신이 registryDidShutdown() 다른 hivemind 서비스를 참조 할 수 없습니다 것을 이해하지만, 집행은 외설 ' AFAIK hivemind 서비스를 T, 그것은 발견 후 java.util.concurrent

답변

0

의 일부 ing this 나는 그것이 버그라는 것을 알 수있다. 해결 방법은 hivemodule에서 생성 및 인터페이스 구현을 사용하는 대신 서비스 인터페이스 (때로는 건너 뜁니다)를 사용하는 것입니다.