import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Notification;
responseCache = CacheBuilder.newBuilder()
.concurrencyLevel(1)
.expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
- .removalListener(new RemovalListener<RpcResponseKey, SettableFuture<?>>() {
-
- @Override
- public void onRemoval(
- RemovalNotification<RpcResponseKey, SettableFuture<?>> notification) {
- SettableFuture<?> future = notification.getValue();
- if (!future.isDone()) {
- LOG.warn("rpc response discarded: " + notification.getKey());
- future.cancel(true);
- }
- }
- }).build();
+ .removalListener(new ResponseRemovalListener()).build();
LOG.info("ConnectionAdapter created");
+
+
}
/**
systemListener.onDisconnectEvent((DisconnectEvent) message);
responseCache.invalidateAll();
disconnectOccured = true;
- }
+ } else if (message instanceof SwitchIdleEvent) {
+ systemListener.onSwitchIdleEvent((SwitchIdleEvent) message);
+ }
// OpenFlow messages
else if (message instanceof EchoRequestMessage) {
messageListener.onEchoRequestMessage((EchoRequestMessage) message);
throw new IllegalStateException("Missing listeners: " + buffer.toString());
}
}
+
+ static class ResponseRemovalListener implements RemovalListener<RpcResponseKey, SettableFuture<?>> {
+
+ @Override
+ public void onRemoval(
+ RemovalNotification<RpcResponseKey, SettableFuture<?>> notification) {
+ SettableFuture<?> future = notification.getValue();
+ if (!future.isDone()) {
+ LOG.warn("rpc response discarded: " + notification.getKey());
+ future.cancel(true);
+ }
+ }
+ }
}