Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
Created March 15, 2013 15:41
Show Gist options
  • Save mathieuancelin/5170772 to your computer and use it in GitHub Desktop.
Save mathieuancelin/5170772 to your computer and use it in GitHub Desktop.
public void lookup() {
while (Thread.currentThread() == m_logTestThread) {
ServiceReference logServiceRef =
m_context.getServiceReference(LogService.class.getName());
if (logServiceRef != null) {
try {
LogService logService =
(LogService) m_context.getService(logServiceRef);
if (logService != null) {
logService.log(LogService.LOG_INFO, "ping");
} else {
alternativeLog("LogService has gone");
}
} catch (RuntimeException re) {
alternativeLog("error in LogService " + re);
} finally {
m_context.ungetService(logServiceRef);
}
} else {
alternativeLog("LogService has gone");
}
pauseTestThread();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment