/** @param reference */ public ActivityHandle removeActivityHandleReference(final ActivityHandleReference reference) { if (doTraceLogs) { logger.trace("removeActivityHandleReference( reference = " + reference + " )"); } ActivityHandle handle = getActivityHandle(reference); if (handle != null) { // if in tx we need to remove only on commit final TransactionContext txContext = getTxManager().getTransactionContext(); if (txContext != null) { TransactionalAction action = new TransactionalAction() { @Override public void execute() { final ActivityHandle handle = ref2handle.remove(reference); if (handle != null) { handle2ref.remove(handle); } } }; txContext.getAfterCommitActions().add(action); } else { ref2handle.remove(reference); handle2ref.remove(handle); } if (logger.isDebugEnabled()) { logger.debug("Removed activity handle reference " + reference); } } return handle; }
@Override public void dropTable(String databaseName, String tableName) { List<String> locations = listAllDataPaths(this, databaseName, tableName); SchemaTableName schemaTableName = new SchemaTableName(databaseName, tableName); Table table = relations.remove(schemaTableName); if (table == null) { throw new TableNotFoundException(schemaTableName); } views.remove(schemaTableName); partitions .keySet() .stream() .filter(partitionName -> partitionName.matches(databaseName, tableName)) .forEach(partitions::remove); // remove data for (String location : locations) { if (location != null) { File directory = new File(URI.create(location)); checkArgument( isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory"); deleteRecursively(directory); } } }
/** Check the transactions info that have expired */ public void checkMsrpTransactionInfo() { if (mTransactionInfoMap != null) { List<MsrpTransactionInfo> msrpTransactionInfos = null; synchronized (mTransactionMsgIdMapLock) { // Copy the transaction info items to accelerate the locking while doing // expiring process msrpTransactionInfos = new ArrayList<MsrpTransactionInfo>(mTransactionInfoMap.values()); } for (MsrpTransactionInfo msrpTransactionInfo : msrpTransactionInfos) { long delta = System.currentTimeMillis() - msrpTransactionInfo.mTimestamp; if ((delta >= TRANSACTION_INFO_EXPIRY_PERIOD) || (delta < 0)) { if (sLogger.isActivated()) { sLogger.debug( "Transaction info have expired (transactionId: " + msrpTransactionInfo.mTransactionId + ", msgId: " + msrpTransactionInfo.mMsrpMsgId + ")"); } mTransactionInfoMap.remove(msrpTransactionInfo.mTransactionId); if (mMessageTransactionMap != null) { mMessageTransactionMap.remove(msrpTransactionInfo.mMsrpMsgId); } } } } }
@Override public boolean endSubscribtionToChannel(String exchangeName) { Channel channel = subscribedChannels.get(exchangeName); if (channel != null) { try { String queueName = channel.queueDeclare().getQueue(); channel.queueUnbind(queueName, exchangeName, ""); // channel.basicConsume(queueName, arg1) // channel.close(0,exchangeName); subscribedChannels.remove(exchangeName); channel = null; Log.i( LOGTAG, "subscribed to " + subscribedChannels.size() + " Channels" + "\n" + "ended subscribtion to : " + exchangeName); return true; } catch (AlreadyClosedException e) { Log.e(LOGTAG, "endSubcribtionToChannel: " + e.toString()); subscribedChannels.remove(exchangeName); } catch (IOException e) { Log.e(LOGTAG, "endSubcribtionToChannel: " + e.toString()); } catch (ShutdownSignalException e) { Log.e(LOGTAG, "endSubcribtionToChannel: " + e.toString()); } } return false; }
@Override public void deletePort(String portName) { synchronized (portLock) { portsByNumber.remove(portsByName.get(portName).getPortNumber()); portsByName.remove(portName); } }
public static void removeFilename(String fileName) { if (fileNameToVSInstance.containsKey(fileName)) { VSensorConfig config = (fileNameToVSInstance.get(fileName)).getConfig(); vsNameTOVSConfig.remove(config.getName()); fileNameToVSInstance.remove(fileName); } }
@Override public void deletePort(short portNumber) { synchronized (portLock) { portsByName.remove(portsByNumber.get(portNumber).getName()); portsByNumber.remove(portNumber); } }
/** Process WAMP messages coming from the background reader. */ protected void processAppMessage(Object message) { if (message instanceof WampMessage.CallResult) { WampMessage.CallResult callresult = (WampMessage.CallResult) message; if (mCalls.containsKey(callresult.mCallId)) { CallMeta meta = mCalls.get(callresult.mCallId); if (meta.mResultHandler != null) { meta.mResultHandler.onResult(callresult.mResult); } mCalls.remove(callresult.mCallId); } } else if (message instanceof WampMessage.CallError) { WampMessage.CallError callerror = (WampMessage.CallError) message; if (mCalls.containsKey(callerror.mCallId)) { CallMeta meta = mCalls.get(callerror.mCallId); if (meta.mResultHandler != null) { meta.mResultHandler.onError(callerror.mErrorUri, callerror.mErrorDesc); } mCalls.remove(callerror.mCallId); } } else if (message instanceof WampMessage.Event) { WampMessage.Event event = (WampMessage.Event) message; if (mSubs.containsKey(event.mTopicUri)) { SubMeta meta = mSubs.get(event.mTopicUri); if (meta != null && meta.mEventHandler != null) { meta.mEventHandler.onEvent(event.mTopicUri, event.mEvent); } } } else if (message instanceof WampMessage.Welcome) { WampMessage.Welcome welcome = (WampMessage.Welcome) message; // FIXME: safe session ID / fire session opened hook if (DEBUG) Log.d( TAG, "WAMP session " + welcome.mSessionId + " established (protocol version " + welcome.mProtocolVersion + ", server " + welcome.mServerIdent + ")"); } else { if (DEBUG) Log.d(TAG, "unknown WAMP message in AutobahnConnection.processAppMessage"); } }
public synchronized Project removeProject(Project project, User deleter) throws ProjectManagerException { projectLoader.removeProject(project, deleter.getUserId()); projectLoader.postEvent(project, EventType.DELETED, deleter.getUserId(), null); projectsByName.remove(project.getName()); projectsById.remove(project.getId()); return project; }
private static void finalRemoveLava(Block block) { if (AFFECTED_BLOCKS.containsKey(block)) { TempBlock.revertBlock(block, Material.AIR); AFFECTED_BLOCKS.remove(block); } if (WALL_BLOCKS.containsKey(block)) { TempBlock.revertBlock(block, Material.AIR); WALL_BLOCKS.remove(block); } }
public void destroyChannel(final String id) { final SipChannel sipChannel = channels.remove(id); if (sipChannel != null) { iChannels.remove(sipChannel.getDatagramChannel().hashCode()); try { sipChannel.getDatagramChannel().close(); } catch (IOException e) { log.error("Could not Close Channel: " + id, e); } } }
private void removeListenerFromCandidates(DistributionRequest listener) { /** Locker variable should be modified EXACTLY like candidateListeners variable. */ logger.debug("Updating the candidate list [" + listener.toString() + " (removed)]."); if (candidatesForNextRound.contains(listener)) { candidateListeners.put(listener, makeDataEnum(listener)); candidatesForNextRound.remove(listener); } else { locker.remove(listener); candidateListeners.remove(listener); } }
public static void cleanup() { for (Block block : AFFECTED_BLOCKS.keySet()) { TempBlock.revertBlock(block, Material.AIR); AFFECTED_BLOCKS.remove(block); WALL_BLOCKS.remove(block); } for (Block block : WALL_BLOCKS.keySet()) { TempBlock.revertBlock(block, Material.AIR); AFFECTED_BLOCKS.remove(block); WALL_BLOCKS.remove(block); } }
/** * Remove transaction info item from list * * @param transactionId */ public void removeMsrpTransactionInfo(String transactionId) { if (mTransactionInfoMap != null && transactionId != null) { synchronized (mTransactionMsgIdMapLock) { if (mMessageTransactionMap != null) { MsrpTransactionInfo transactionInfo = getMsrpTransactionInfo(transactionId); if (transactionInfo != null && transactionInfo.mMsrpMsgId != null) { mMessageTransactionMap.remove(transactionInfo.mMsrpMsgId); } } mTransactionInfoMap.remove(transactionId); } } }
@SuppressWarnings("deprecation") public static void remove(Block block) { if (ignitedblocks.containsKey(block)) { ignitedblocks.remove(block); } if (ignitedtimes.containsKey(block)) { ignitedtimes.remove(block); } if (replacedBlocks.containsKey(block.getLocation())) { block.setType(replacedBlocks.get(block.getLocation()).getItemType()); block.setData(replacedBlocks.get(block.getLocation()).getData()); replacedBlocks.remove(block.getLocation()); } }
@Override public OAuth1Token newAccessToken(final OAuth1Token requestToken, final String verifier) { if (verifier == null || requestToken == null || !verifier.equals(verifierByTokenString.remove(requestToken.getToken()))) { return null; } final Token token = requestTokenByTokenString.remove(requestToken.getToken()); if (token == null) { return null; } final Token at = new Token(newUUIDString(), newUUIDString(), token); accessTokenByTokenString.put(at.getToken(), at); return at; }
@Override public void closed(EndPoint endpoint) { try { OutputStream out = _in.remove(endpoint); if (out != null) out.close(); } catch (IOException e) { LOG.warn(e); } try { OutputStream out = _out.remove(endpoint); if (out != null) out.close(); } catch (IOException e) { LOG.warn(e); } }
@Override public MessageConsumer createConsumer( Destination destination, String selector, final MessageListener messageListener, Map<String, Object> args) { try { AMQPDestination dest = (AMQPDestination) destination; String routingKey = dest.getDestination(); // as a nicety we declare and bind the queues on the consumer side if the queue is not // temporary if (!dest.isTemporary()) { ConcurrentHashMap<String, Object> p = new ConcurrentHashMap<String, Object>(args); p.putIfAbsent("durable", durableQueue); p.putIfAbsent("exclusive", exclusiveQueue); p.putIfAbsent("autoDelete", autoDeleteQueue); channel.queueDeclare( routingKey, (Boolean) p.remove("durable"), (Boolean) p.remove("exclusive"), (Boolean) p.remove("autoDelete"), args); channel.queueBind( routingKey, exchangeName, routingKey, createBindingArgs(selector + " AND routingKey = " + routingKey)); } DefaultConsumer consumer = new DefaultConsumer(channel) { @Override public void handleDelivery( String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { messageListener.onMessage(new AMQPMessage(body, envelope, properties, channel)); } }; String consumerTag = channel.basicConsume(routingKey, autoAck, consumer); return new AMQPMessageConsumer(dest, consumer, consumerTag); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public boolean clearExpired(Date date) { boolean clearedAny = false; SharedPreferences.Editor prefsWriter = cookiePrefs.edit(); for (ConcurrentHashMap.Entry<String, Cookie> entry : cookies.entrySet()) { String name = entry.getKey(); Cookie cookie = entry.getValue(); if (cookie.isExpired(date)) { // Clear cookies from local store cookies.remove(name); // Clear cookies from persistent store prefsWriter.remove(COOKIE_NAME_PREFIX + name); // We've cleared at least one clearedAny = true; } } // Update names in persistent store if (clearedAny) { prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", cookies.keySet())); } prefsWriter.commit(); return clearedAny; }
@Benchmark public void measureDefault(Ids ids) { for (String s : ids.ids) { mapSingle.remove(s); mapSingle.put(s, s); } }
/** * Non-standard helper method, to delete cookie * * @param cookie cookie to be removed */ public void deleteCookie(Cookie cookie) { String name = cookie.getName() + cookie.getDomain(); cookies.remove(name); SharedPreferences.Editor prefsWriter = cookiePrefs.edit(); prefsWriter.remove(COOKIE_NAME_PREFIX + name); prefsWriter.commit(); }
/** * Gets a {@link JSONObject} containing the post data supplied with the current request as * key-value pairs appended with the instrumentation data. * * <p>* @param instrumentationData {@link ConcurrentHashMap} with instrumentation values * * @return A {@link JSONObject} containing the post data supplied with the current request as * key-value pairs and the instrumentation meta data. */ public JSONObject getPostWithInstrumentationValues( ConcurrentHashMap<String, String> instrumentationData) { JSONObject extendedPost = new JSONObject(); try { // Add original parameters if (params_ != null) { JSONObject originalParams = new JSONObject(params_.toString()); Iterator<String> keys = originalParams.keys(); while (keys.hasNext()) { String key = keys.next(); extendedPost.put(key, originalParams.get(key)); } } // Append instrumentation metadata if (instrumentationData.size() > 0) { JSONObject instrObj = new JSONObject(); Set<String> keys = instrumentationData.keySet(); try { for (String key : keys) { instrObj.put(key, instrumentationData.get(key)); instrumentationData.remove(key); } extendedPost.put(Defines.Jsonkey.Branch_Instrumentation.getKey(), instrObj); } catch (JSONException ignore) { } } } catch (JSONException ignore) { } catch (ConcurrentModificationException ex) { extendedPost = params_; } return extendedPost; }
@Benchmark public void measureFollowThreads(Ids ids) { for (String s : ids.ids) { mapFollowThreads.remove(s); mapFollowThreads.put(s, s); } }
@Override public void removeEvent(final String eventName) { final OScheduledEvent event = events.remove(eventName); if (event != null) { event.interrupt(); } }
/* * (non-Javadoc) * * @see * javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet * .http.HttpSessionBindingEvent) */ public void valueUnbound(HttpSessionBindingEvent event) { // 刷新页面的时候,TSysUser为null,所以要判断一下 LoginUserVO user = (LoginUserVO) event.getValue(); if (user != null) { /** ********************** UniId begin ******************************** */ // 通知统一身份认证服务中心。此处的实现是通过数据库 boolean singleLogin = PropDbUtil.getBoolean(IdConstants.SINGLE_LOGIN); // 是否开启了同一用户同一时间所有节点上只能登录一个的要求 if (singleLogin) { String sql = SQLConfigUtil.getSql("sql.loginUserVO.delete"); DBUtil.executeSQL(sql, user.getUserloginid()); // 移除在线用户表中用户信息 } /** ********************** UniId end ******************************** */ onlineUsers.remove(event.getSession().getId()); if (LOG.isInfoEnabled()) { LOG.info( user.getUsername() + "[账号:" + user.getUserloginid() + "]" + " 退出系统" + ",目前有" + getCurrentOnlineCount() + "个用户已登录"); } } else { if (LOG.isInfoEnabled()) { LOG.info(" 一个用户刷新系统" + ",目前有" + getCurrentOnlineCount() + "个用户已登录"); } } }
/** * Clear the mapping relationship between Reference and {@link WXDomObject}. The mapping info is * stored in {@link #mRegistry}. * * @param domObject */ private void clearRegistryForDom(WXDomObject domObject) { int count = domObject.childCount(); mRegistry.remove(domObject.getRef()); for (int i = count - 1; i >= 0; --i) { clearRegistryForDom(domObject.getChild(i)); } }
@Override public void onClientDisconnected(String id) { if (serverAlreadyExists(id)) { TumpiServer server = getServer(id); try { Map<String, Cliente> clientes_socket = socket.clientes; for (TumpiClient cliente_tumpi : server) { Cliente cliente_socket = clientes_socket.get(cliente_tumpi.id); cliente_socket.close(); } server.removeAllClients(); } catch (IOException ex) { Log.$.error("Error al desconectar al cliente"); } servidores.remove(id); } else { Collection<TumpiServer> values = servidores.values(); for (TumpiServer server : values) { if (server.isClient(id)) { server.removeCliente(id); sendClientNotification(server.id, id, "off"); } } } Log.$.info("Cliente desconectado >> " + id); }
public void unregister(QName pid) throws BpelEngineException { if (__log.isTraceEnabled()) __log.trace("unregister: " + pid); try { ODEProcess p = _registeredProcesses.remove(pid); if (p == null) return; // TODO Looks like there are some possible bugs here, if a new version of a process gets // deployed, the service will be removed. p.deactivate(); // Remove the process from any services that might reference it. // However, don't remove the service itself from the map. for (List<ODEProcess> processes : _serviceMap.values()) { __log.debug( "removing process " + pid + "; handle " + p + "; exists " + processes.contains(p)); processes.remove(p); } __log.info(__msgs.msgProcessUnregistered(pid)); } catch (Exception ex) { __log.error(__msgs.msgProcessUnregisterFailed(pid), ex); throw new BpelEngineException(ex); } }
/** {@inheritDoc} */ @Override public Broadcaster lookup(Class<? extends Broadcaster> c, Object id, boolean createIfNull) { Broadcaster b = store.get(id); if (b != null && !c.isAssignableFrom(b.getClass())) { String msg = "Invalid lookup class " + c.getName() + ". Cached class is: " + b.getClass().getName(); logger.debug(msg); throw new IllegalStateException(msg); } if ((b == null && createIfNull) || (b != null && b.isDestroyed())) { if (b != null) { logger.debug("Removing destroyed Broadcaster {}", b.getID()); store.remove(b.getID(), b); } Broadcaster nb = store.get(id); if (nb == null) { nb = createBroadcaster(c, id); store.put(id, nb); } if (nb == null) { logger.debug("Added Broadcaster {} . Factory size: {}", id, store.size()); } b = nb; } return b; }
/** {@inheritDoc} */ public boolean remove(Broadcaster b, Object id) { boolean removed = store.remove(id, b); if (removed) { logger.debug("Removing Broadcaster {} factory size now {} ", id, store.size()); } return removed; }