当我在 osgi 中使用我的 Bundle 时,我需要 ServiceReference 和 Service Object。但是,当我按照下面的代码所示进行操作时,我的包不再能找到绑定方法。我究竟做错了什么?
public class AServiceImpl implements AService{
TestService t;
JournalService journalService;
BundleContext context;
ServiceReference testServiceRef;
public void bindTestService(TestService testService, ServiceReference sv) {
t = testService;
testServiceRef = sv;
//this.testServiceRef = testServiceRef;
test.api.TestStaticVariable.getUniqueInstance().add("TEST A");
System.out.println(test.api.TestStaticVariable.getUniqueInstance().toString());
}
public void unbindTestService(TestService testService){
System.out.println("");
if(t.equals(testService)){
t = null;
}
}
public void bindJournalService(JournalService journalService){
this.journalService = journalService;
}
public void unbindJournalService(JournalService journalService){
if(this.journalService.equals(journalService)){
this.journalService = null;
}
}
}