}
@Override
- protected void encode(final ChannelHandlerContext ctx, final Notification msg, final ByteBuf out) throws Exception {
+ protected void encode(final ChannelHandlerContext ctx, final Notification msg, final ByteBuf out) {
LOG.trace("Encoding message: {}", msg);
final byte[] bytes = this.registry.serializeMessage(msg);
LOG.trace("Encoded message: {}", ByteArray.bytesToHexString(bytes));
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleHoldTimer();
}
}, this.holdTimerValue, TimeUnit.SECONDS);
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleKeepaliveTimer();
}
}, this.keepAlive, TimeUnit.SECONDS);
/**
* Handles incoming message based on their type.
- *
+ *
* @param msg incoming message
*/
@Override
/**
* Closes PCEP session from the parent with given reason. A message needs to be sent, but parent doesn't have to be
* modified, because he initiated the closing. (To prevent concurrent modification exception).
- *
+ *
* @param closeObject
*/
private void terminate(final BGPError error) {
} else {
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleHoldTimer();
}
}, nextHold - ct, TimeUnit.NANOSECONDS);
}
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleKeepaliveTimer();
}
}, nextKeepalive - ct, TimeUnit.NANOSECONDS);
final Object lock = this;
this.timer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
synchronized (lock) {
if (BGPSessionNegotiator.this.state != State.Finished) {
BGPSessionNegotiator.this.sendMessage(buildErrorNotify(BGPError.HOLD_TIMER_EXPIRED));
/**
* Create a new negotiator. This method needs to be implemented by subclasses to actually provide a negotiator.
- *
+ *
* @param promise Session promise to be completed by the negotiator
* @param channel Associated channel
* @param sessionId Session ID assigned to the resulting session
this.channel.closeFuture().addListener(new ChannelFutureListener() {
@Override
- public void operationComplete(final ChannelFuture future) throws Exception {
+ public void operationComplete(final ChannelFuture future) {
synchronized (lock) {
AbstractPCEPSessionNegotiatorFactory.this.sessions.inverse().remove(this);
}
}
@Override
- protected void handleMessage(final Message msg) throws Exception {
+ protected void handleMessage(final Message msg) {
throw new IllegalStateException("Bootstrap negotiator should have been replaced");
}
};
private Short nextSession(final byte[] clientAddress) throws ExecutionException {
final PeerRecord peer = formerClients.get(clientAddress, new Callable<PeerRecord>() {
@Override
- public PeerRecord call() throws Exception {
+ public PeerRecord call() {
return new PeerRecord(ID_CACHE_SECONDS, null);
}
});
if (getDeadTimerValue() != 0) {
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleDeadTimer();
}
}, getDeadTimerValue(), TimeUnit.SECONDS);
if (getKeepAliveTimerValue() != 0) {
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleKeepaliveTimer();
}
}, getKeepAliveTimerValue(), TimeUnit.SECONDS);
} else {
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleDeadTimer();
}
}, nextDead - ct, TimeUnit.NANOSECONDS);
this.stateTimer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
handleKeepaliveTimer();
}
}, nextKeepalive - ct, TimeUnit.NANOSECONDS);
/**
* Sends message to serialization.
- *
+ *
* @param msg to be sent
*/
@Override
/**
* Sends PCEP Error Message with one PCEPError and Open Object.
- *
+ *
* @param value
* @param open
*/
* sent (CAPABILITY_NOT_SUPPORTED) and the method checks if the MAX_UNKNOWN_MSG per minute wasn't overstepped.
* Second, any other error occurred that is specified by rfc. In this case, the an error message is generated and
* sent.
- *
+ *
* @param error documented error in RFC5440 or draft
*/
@VisibleForTesting
/**
* Handles incoming message. If the session is up, it notifies the user. The user is notified about every message
* except KeepAlive.
- *
+ *
* @param msg incoming message
*/
@Override
channel.close().addListener(new ChannelFutureListener() {
@Override
- public void operationComplete(final ChannelFuture f) throws Exception {
+ public void operationComplete(final ChannelFuture f) {
LOG.debug("Server channel {} closed", f.channel());
try {
}
@Override
- public void close() throws Exception {
+ public void close() {
reg.close();
}
*/
package org.opendaylight.bgpcep.programming.impl;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.SettableFuture;
import io.netty.util.Timeout;
import io.netty.util.Timer;
import io.netty.util.TimerTask;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+
import org.opendaylight.bgpcep.programming.NanotimeUtil;
import org.opendaylight.bgpcep.programming.spi.ExecutionResult;
import org.opendaylight.bgpcep.programming.spi.Instruction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.SettableFuture;
public final class ProgrammingServiceImpl implements AutoCloseable, InstructionScheduler, ProgrammingService {
private static final Logger LOG = LoggerFactory.getLogger(ProgrammingServiceImpl.class);
public ListenableFuture<RpcResult<CleanInstructionsOutput>> cleanInstructions(final CleanInstructionsInput input) {
return this.executor.submit(new Callable<RpcResult<CleanInstructionsOutput>>() {
@Override
- public RpcResult<CleanInstructionsOutput> call() throws Exception {
+ public RpcResult<CleanInstructionsOutput> call() {
return realCleanInstructions(input);
}
});
// Schedule a timeout for the instruction
final Timeout t = this.timer.newTimeout(new TimerTask() {
@Override
- public void run(final Timeout timeout) throws Exception {
+ public void run(final Timeout timeout) {
timeoutInstruction(input.getId());
}
}, left.longValue(), TimeUnit.NANOSECONDS);