コード例 #1
0
 @Override
 public void run() {
   while (!stop) {
     ServiceObjects<String> serviceObjects = ctx.getServiceObjects(ref);
     try {
       String svc = serviceObjects.getService();
       if (!"bar".equals(svc)) System.out.println("Bad Service!");
       else counter++;
       //                serviceObjects.ungetService(svc);
     } finally {
       ctx.ungetService(ref);
     }
   }
   System.out.println("Thread done (" + getClass().getSimpleName() + ")");
 }
コード例 #2
0
 public MultiplePrototypeRefPair(BundleContext context, ServiceReference<T> ref) {
   super(ref);
   this.serviceObjects = context.getServiceObjects(ref);
 }