本文整理汇总了Java中org.apache.felix.ipojo.ComponentInstance.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentInstance.dispose方法的具体用法?Java ComponentInstance.dispose怎么用?Java ComponentInstance.dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.felix.ipojo.ComponentInstance
的用法示例。
在下文中一共展示了ComponentInstance.dispose方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnbindMessageHandler
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
/**
* Test unbind message handler.
*/
@Test
public void testUnbindMessageHandler() {
ComponentInstance componentInstanceMock = EasyMock
.createMock(ComponentInstance.class);
EasyMock.expect(messageConsumersMock.remove(testHandlerMock))
.andReturn(componentInstanceMock);
componentInstanceMock.dispose();
EasyMock.replay(componentInstanceMock, messageConsumersMock);
ProviderMessageConsumerFactoryImpl factory = new ProviderMessageConsumerFactoryImpl();
factory.setMessageConsumerFactory(messageConsumerFactoryMock);
factory.setMessageConsumers(messageConsumersMock);
factory.unbindMessageHandler(testHandlerMock);
EasyMock.verify(componentInstanceMock);
}
示例2: unbindMessageHandler
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
/**
*
* Is invoked when a communote message handler is removed from the OSGi context. The method is
* responsible for stopping appropriate provider message consumer instance
*
* @param messageHandler
* message handler, that was removed
*/
@Override
@Unbind
public void unbindMessageHandler(
CommunoteMessageHandler<? extends BaseMessage> messageHandler) {
ComponentInstance consumerToBeRemoved = messageConsumers.remove(messageHandler);
if (consumerToBeRemoved != null) {
consumerToBeRemoved.dispose();
LOG.debug("Provider message consumer has been unbound");
} else {
LOG.warn("Provider message consumer for the removed message handler was not found. MessageHandler == "
+ messageHandler);
}
}
示例3: deleteIPojoInstance
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
private void deleteIPojoInstance( ComponentInstance instance ) {
String userDataFilePath = this.ipojoNameToUserDataFile.get( instance.getInstanceName());
if( userDataFilePath != null )
Utils.deleteFilesRecursivelyAndQuietly( new File( userDataFilePath ));
instance.dispose();
}
示例4: killInstance
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
private boolean killInstance(String name) throws InvalidSyntaxException, NoSuchFieldException, IllegalAccessException {
ComponentInstance instance = getComponentInstance(name);
if (instance == null) {
return false;
}
// FATALITY!!!
instance.dispose();
return true;
}
示例5: tearDownFinal
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
@After
public void tearDownFinal() {
ComponentInstance importer = ipojoHelper.getInstanceByName(IMPORTER_NAME);
if (importer != null) {
importer.dispose();
}
if (httpServer != null) {
httpServer.stop(0);
httpServer = null;
}
}
示例6: denyImportDeclaration
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
@Override
public void denyImportDeclaration(ImportDeclaration importDeclaration) throws BinderException {
String id = (String) importDeclaration.getMetadata().get(ID);
unhandleImportDeclaration(importDeclaration);
if (clients.containsKey(id)) {
String klassName = (String) importDeclaration.getMetadata().get(SERVICE_CLASS);
if (klassName != null) {
// Unregister the proxy from OSGi
ServiceRegistration sReg = registrations.remove(id);
if (sReg != null) {
sReg.unregister();
} else {
throw new IllegalStateException("The serviceRegistration of the given object is null." +
"It could not be unregister.");
}
} else {
ComponentInstance componentInstance = componentInstances.remove(id);
if (componentInstance != null) {
componentInstance.dispose();
}
}
// Remove the client
clients.remove(id);
} else {
throw new BinderException("The given object has not been created through this factory");
}
}
示例7: dispose
import org.apache.felix.ipojo.ComponentInstance; //导入方法依赖的package包/类
@Override
public void dispose() {
for (ComponentInstance instance : instances) {
instance.dispose();
}
}