本文整理了Java中java.util.concurrent.LinkedBlockingDeque.contains()
方法的一些代码示例,展示了LinkedBlockingDeque.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedBlockingDeque.contains()
方法的具体详情如下:
包路径:java.util.concurrent.LinkedBlockingDeque
类名称:LinkedBlockingDeque
方法名:contains
[英]Returns true if this deque contains the specified element. More formally, returns true if and only if this deque contains at least one element e such that o.equals(e).
[中]如果此数据包含指定的元素,则返回true。更正式地说,当且仅当此deque至少包含一个元素e,使得o.equals(e)时,返回true。
代码示例来源:origin: alibaba/jstorm
public boolean containsKey(K entry) {
synchronized (_lock) {
for (LinkedBlockingDeque<K> bucket : _buckets) {
if (bucket.contains(entry)) {
return true;
}
}
return false;
}
}
代码示例来源:origin: alibaba/jstorm
public void remove(K entry) {
synchronized (_lock) {
for (LinkedBlockingDeque<K> bucket : _buckets) {
if (bucket.contains(entry)) {
bucket.remove(entry);
return;
}
}
}
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
public boolean containsKey(K entry) {
synchronized (_lock) {
for (LinkedBlockingDeque<K> bucket : _buckets) {
if (bucket.contains(entry)) {
return true;
}
}
return false;
}
}
代码示例来源:origin: apache/uima-uimaj
private void addFirst(LinkedBlockingDeque<MultiThreadInfo> pool) {
if (ASSERTS) {
if (pool.contains(this)) throw new RuntimeException("ERROR 2x add t#" + t_number);
if (pool == run_pool && isPendingLowPriWait) {
throw new RuntimeException(sb + "\nERROR inserting pending wait into run pool");
}
}
if (TRACE) sb.append((pool == run_pool) ? " +rf" : " +wf");
pool.addFirst(this);
}
代码示例来源:origin: apache/uima-uimaj
private void addLast(LinkedBlockingDeque<MultiThreadInfo> pool) {
if (ASSERTS) {
if (pool.contains(this)) throw new RuntimeException(sb + "\nERROR 2x add t#" + t_number);
if (pool == run_pool && isPendingLowPriWait) {
throw new RuntimeException(sb + "\nERROR inserting pending wait into run pool");
}
}
if (TRACE) sb.append((pool == run_pool) ? " +rl" : " +wl");
pool.addLast(this);
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
public void remove(K entry) {
synchronized (_lock) {
for (LinkedBlockingDeque<K> bucket : _buckets) {
if (bucket.contains(entry)) {
bucket.remove(entry);
return;
}
}
return;
}
}
代码示例来源:origin: org.apache.commons/commons-jcs-core
/**
* Perhaps the composite cache itself should be the observable object. It doesn't make much of a
* difference. There are some problems with region by region shutdown. Some auxiliaries are
* global. They will need to track when every region has shutdown before doing things like
* closing the socket with a lateral.
* <p>
* @param observer
*/
@Override
public void registerShutdownObserver( IShutdownObserver observer )
{
if (!shutdownObservers.contains(observer))
{
shutdownObservers.push( observer );
}
else
{
log.warn("Shutdown observer added twice " + observer);
}
}
代码示例来源:origin: org.mariadb.jdbc/mariadb-java-client
@Override
public void connectionClosed(ConnectionEvent event) {
MariaDbPooledConnection item = (MariaDbPooledConnection) event.getSource();
if (poolState.get() == POOL_STATE_OK) {
try {
if (!idleConnections.contains(item)) {
item.getConnection().reset();
idleConnections.addFirst(item);
}
} catch (SQLException sqle) {
//sql exception during reset, removing connection from pool
totalConnection.decrementAndGet();
silentCloseConnection(item);
logger.debug("connection removed from pool {} due to error during reset", poolTag);
}
} else {
//pool is closed, should then not be render to pool, but closed.
try {
item.close();
} catch (SQLException sqle) {
//eat
}
totalConnection.decrementAndGet();
}
}
代码示例来源:origin: bitcraze/crazyflie-android-client
/**
* Send a packet through the driver interface
*
* @param packet packet to send to the Crazyflie
*/
// def send_packet(self, pk, expected_reply=(), resend=False):
public void sendPacket(CrtpPacket packet){
if (mDriver.isConnected()) {
if (packet == null) {
mLogger.warn("Packet is null.");
return;
}
mDriver.sendPacket(packet);
if (packet.getExpectedReply() != null && packet.getExpectedReply().length > 0) {
//add packet to resend queue
if(!mResendQueue.contains(packet)) {
mResendQueue.add(packet);
} else {
mLogger.warn("Packet already exists in Queue.");
}
}
}
}
代码示例来源:origin: MariaDB/mariadb-connector-j
@Override
public void connectionClosed(ConnectionEvent event) {
MariaDbPooledConnection item = (MariaDbPooledConnection) event.getSource();
if (poolState.get() == POOL_STATE_OK) {
try {
if (!idleConnections.contains(item)) {
item.getConnection().reset();
idleConnections.addFirst(item);
}
} catch (SQLException sqle) {
//sql exception during reset, removing connection from pool
totalConnection.decrementAndGet();
silentCloseConnection(item);
logger.debug("connection removed from pool {} due to error during reset", poolTag);
}
} else {
//pool is closed, should then not be render to pool, but closed.
try {
item.close();
} catch (SQLException sqle) {
//eat
}
totalConnection.decrementAndGet();
}
}
代码示例来源:origin: stackoverflow.com
return stack.contains(o);
内容来源于网络,如有侵权,请联系作者删除!