use of org.apache.felix.upnp.basedriver.importer.core.event.message.SidExipired in project felix by apache.
the class Renewer method run.
public void run() {
while (bool) {
try {
sleep(timeout);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
boolean ok = ctrl.subscribe(service, sid, 180000);
if (ok) {
// renew ok
if (service.getTimeout() - time_before_renew > 0) {
timeout = service.getTimeout() - time_before_renew;
} else {
timeout = service.getTimeout();
}
} else {
// renew not ok
bool = false;
subqueue.enqueue(new SidExipired(sid, service));
}
}
}
use of org.apache.felix.upnp.basedriver.importer.core.event.message.SidExipired in project felix by apache.
the class SubScriber method run.
public void run() {
while (running) {
Object msg = subQueue.dequeue();
if (running) {
if (msg instanceof FirstMessage) {
FirstMessage firstmsg = (FirstMessage) msg;
Service service = firstmsg.getService();
if (!service.isSubscribed()) {
// is not subscribe
boolean ok = ctrl.subscribe(service, 120000);
String sid = "";
if (ok) {
// subcribe ok
sid = service.getSID();
firstmsg.setSid(sid);
monitor.addListener(sid, firstmsg.getListener());
} else {
// subscribe not ok
Activator.logger.log(LogService.LOG_ERROR, "Sucribe failed");
}
} else {
// already subscribe
monitor.addListener(service.getSID(), firstmsg.getListener());
}
} else if (msg instanceof ListenerModified) {
monitor.updateListener((ListenerModified) msg, subQueue, ctrl);
} else if (msg instanceof ListenerUnRegistration) {
ListenerUnRegistration unreg = (ListenerUnRegistration) msg;
monitor.delListener(unreg.getListener(), ctrl);
} else if (msg instanceof SidExipired) {
Activator.logger.WARNING("[Importer] Please report the bug. Used code - should be checked and removed");
}
}
}
}
Aggregations