...
| Code Block | ||
|---|---|---|
| ||
public final class SocketReader implements Runnable {
private final SocketChannel sc;
private final Object lock = new Object();
public SocketReader(String host, int port) throws IOException {
sc = SocketChannel.open(new InetSocketAddress(host, port));
}
@Override public void run() {
ByteBuffer buf = ByteBuffer.allocate(1024);
try {
synchronized (lock) {
while (!Thread.interrupted()) {
sc.read(buf);
// ...
}
}
} catch (IOException ie) {
// Forward to handler
}
}
}
public final class PoolService {
// ...
}
|
Exceptions
TPS02-EX1EX0: Short-running tasks that execute without blocking are exempt from this rule.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
TPS02-J | low | probable | medium | P4 | L3 |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8a5ee6d281d4587c-dbf9d7c4-498b49a9-871a8161-3fe758eeafb70815a9fe9a7e"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | interface ExecutorService | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="139708bddcfde4ff-c55496e9-44ef4871-85bfa065-9168a4e00549b4e211381fc9"><ac:plain-text-body><![CDATA[ | [[Goetz 2006 | AA. Bibliography#Goetz 06]] | Chapter 7: Cancellation and shutdown | ]]></ac:plain-text-body></ac:structured-macro> |
...